Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

How can I use a sketch to create a label on a flat (or curved) surface and color the faces

monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
I'm creating a FS for creating a ruler or a scale that can be transferred to a surface. Here is the part studio demo. I have two questions:
  1. How do I transfer this sketch to a selected surface and have the faces of the ticks and the letters show as a different color than the selected surface? I'd like to do this using Feature Script. 
  2. I found somewhere that SplitFace might be the right approach. I'd like to understand if that is right how this operation is like splitting an object.

Best Answer

Answers

  • monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
    This is a good solution for creating this ruler/scale one time. I'd like to build transferring the scale to the surface into the feature. I think it should be similar to the wrap feature, but wrap (opWrap) only works for cylinders. There must be an equivalent function for plane surfaces that doesn't involve creating an extrude.
  • EvanReeseEvanReese Member, Mentor Posts: 2,142 ✭✭✭✭✭
    Answer ✓
    @monroe_weber_shirk I got something kind of half-working here. I don't have a ton of time to throw at it right now, but I hope this can help you find the right direction.

    Evan Reese
  • monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
    Thank you @Evan_Reese. That code was exactly what I needed. I'm still working on not filling the centers of the numbers, but I'm close!
  • EvanReeseEvanReese Member, Mentor Posts: 2,142 ✭✭✭✭✭
    you could loop through each face and use qAdjacent. If it gives you 2 or more faces then it has a face inside (and the other one is the main base surface, which you could filter out). That might get wonky if your base surface already had split lines in it though, and there may be other issues with this approach, but it's probably what I'd try next. Hopefully, someone smarter comes along to save you from this idea with something more elegant :D
    Evan Reese
  • EvanReeseEvanReese Member, Mentor Posts: 2,142 ✭✭✭✭✭
    This one got my gears turning. You could filter out the middles of the letters if you use qAdjacent, with this face as the reference, which should pick the outer letter faces but not the inner ones, plus some extra faces you don't want, like the sides of the box.

    Next, us qIntersection that with all of the faces made by the opSplit. I updated the code here to test a bit and commented there a bit more. It's definitely not done, but seems like a good solution to the letter centers.

    Evan Reese
  • monroe_weber_shirkmonroe_weber_shirk Member Posts: 96 EDU
    edited January 2021
    Thank you! I'm continuing to work on this. I fixed some bugs in my code and added instancing so we can create a much simpler scale for production and for debugging now. Update... I now have a working version and now have a list of improvements to make including making this work for putting scales on cylinders. This is my first time using queries so I had a lot of learning to do and am grateful for your help!
Sign In or Register to comment.