Custom Feature Part Name (Ovyl)
Here are the updates I made for V10:
- 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.
- 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)
- The delimiter character can just be typed so you can use whatever you want.
Comments
-
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.0 -
@julian_julian372 Glad it's helpful. I know it's been handy for us!0
-
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?
0 -
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.
1 -
You could rework the feature to use an array parameter instead - unlimited segments that way.
1 -
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.
1 -
Thanks for this FS Evan, I've used it quite a bit for labeling configurable parts, but there were some UI elements that annoyed me so I decided to fix them.
Here's what I changed:
- you can now add a space around the separator (I think this reads more easily)
- the segments are now an array, which means you can add as many as you like, but more importantly, you can reorder them.
- the option to round a value only appears if the expression actually is a value with units.If anyone else wants to use this, you can find it here: Part Name FS
she/her
0 -
This is one I'd do pretty differently if I re-wrote it today. Love those changes. I think the array thing won't be configurable, right? If I recall that was the reason for not doing it that way.
0 -
@marci_van_dort:
Have you tried the set property FS?Could be an alternative depending on what you are trying to do…
Also the variable to string is quite useful:
https://cad.onshape.com/documents/19dacc01596e7c326bbfb137/v/c0b9911b5033a220bcbe87e5/e/16035d1ed4a973a81c4d8bc01 -
Huh indeed, I hadn't realized they weren't configurable. Though that is fairly easily worked around by using a variable and configuring that instead.
she/her
0 -
Thank eric, I'll keep that in mind for the future. For now just setting the part name suffices for me
she/her
0 -
This is a very useful feature, thank you!
Would you add a note, that this FS only works on parts that hasn't been renamed manually. If a part was renamed manually, user must use
Reset ALLbutton in part's properties, which is a bummer…1 -
I like this a lot and have added it into my workflow.
I see another potential improvement - but I think it might get messy (coding is not my forte)
In a current project we are working on, we have a wiring harness created using routing curves. We name the parts "Wire Type" - "Length" - "Termination".
We have a variable that measures the length of the routing curve, and would like to enter "#WireLength" into one of the 'part name' fields. This probably gets messy using a variable instead of a string though.
Thanks for all your contributions!
0 -
You can do this easily with the "set property" and "variable to string" FS:
1 -
If you right-click on the input field, you can select "Convert to expression". That'll let you put the variable name in the input field.
Here's an example: https://cad.onshape.com/documents/cdac3bd62fd1cc23d2ad852d/w/39aea9c5f1ba08cd159fe8db/e/2b39c493419e25836f778ce0
You might need to use a
toStringfunction to make the variable work.Ramon Yip | glassboard.com
0 -
Great feature script, this takes a lot of busy work and silly typo mistakes off my plate, thank you!
I'm not sure if this is too "pie in the sky" but if it were possible to re-arrange the strings after they've been assigned to configurations that would be really helpful
Lastly, for anyone implementing this to a studio they've already manually changed the part name on, you'll need to reset your properties for this to work! Might be worth adding a note to your original post, or to the feature script studio to let folks know
0
Categories
- All Categories
- 10.2K Community Support
- 4.6K General
- 194 Account and subscriptions
- 353 Data management
- 1.6K Product Feedback
- 215 New in Onshape
- 15 Onshape Labs
- 76 CAM Studio
- 35 PCB Studio
- 107 Simulation
- 209 Onshape Mobile
- 315 App Store & Partners Apps
- 8.2K Using Onshape
- 1.8K Drawings
- 2.3K FeatureScript
- 324 Learning Center
- 254 Education Community






