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.

Custom Feature Part Name (Ovyl)

EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
edited October 2022 in General
Many of you all have already used the Part Name feature that I wrote (based on some code originally by @NeilCooke). I just pushed a pretty big update to it, so I thought I'd go ahead and make a dedicated post about the feature, which can be a good way for people to find it, ask questions about it, and for me to add update notes as needed.

Here are the updates I made for V10:
  1. It no longer has a dedicated part number area. You just pick whether it should set the part name, part number, or both. I thought having a single field to fill for PN was a pain, and that having up to 6 to work with was nicer. If you need the number to be different than the name, I recommend just using the feature twice in a row.
  2. It handles rounding better. If you're using an expression, you have the option to round it to a certain decimal place. If the output of the expression is a length or angle, then you'll also see the option to choose display units", so that when the number is rounded, it shows the right thing. For example if you give it 1*inch you'll be able to choose "inch" as a display unit and the output will be 1, not 0.0254 (which is 1 inch in meters)
  3. The delimiter character can just be typed so you can use whatever you want.
Many of these updates are likely to break any existing models they're used in, so I recommend not updating places it's already been used, and just using V9 for new features.

Evan Reese
Tagged:

Comments

  • julian_julian372julian_julian372 Member Posts: 14
    Hi Evan,
    thankyou so much for this FS, It is absolutely amazing. I have been using it alot with 'configurations' for part naming and part numbering.
    Keeping my documents clean and labeled nicely. Especially when using variable configured parts into Assemblies. The part names and part numbers all now make sense. More so the Part Names.

    I was having a lot of issues initially where the Parts Names were not getting updated in existing part studio projects., I was finally able resolved my issue by right click Part, selecting properties and resetting all properties. Then everything started to work as expected.
  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭
    @julian_julian372 Glad it's helpful. I know it's been handy for us!
    Evan Reese
  • Zabi_GhafarZabi_Ghafar Member Posts: 2

    Hi Evan,

    Thank you for this custom feature it has been an absolute lifesaver. I did notice however that the max number of segments you could have is limited to 6. Is there a way I can increase the number of segments?

  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭

    Wow I never thought anyone would hit that limit haha. I'll take a look when I can. You might be able to work around it for now by getting more than 1 out of a segment using toString() functions and ~ for concatenation. You can also stretch the feature UI wide to have more room to read since it will become long.

    Evan Reese
  • _anton_anton Member, Onshape Employees Posts: 413

    You could rework the feature to use an array parameter instead - unlimited segments that way.

  • EvanReeseEvanReese Member, Mentor Posts: 2,186 ✭✭✭✭✭

    Thanks for the suggestion! It's been a while since writing this (and I based most of it off of one by Neil). I do recall starting with an array param and hitting a dead end somewhere with that. Might have just been lack of code skill at the time. Now that we can right click a string field and convert to expression this feature is probably due for a full V2 anyway, so I'll give it a look.

    Evan Reese
Sign In or Register to comment.