Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:
- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Can a Configuration change the name of a Part based on the selected options
daniel_cook
Member Posts: 48 PRO
Hi, just started working with configurations for some common plant items I use.
Currently I have a machine which has the following options:
Model (ex. Model 3508, 3514, 3518)
Discharge Side (ex. Left, Right or Dual Side)
Drive Side (ex. Left or Right)
Discharge Height (infinitely variable from around 2000mm to 30000mm)
I see there is the properties configuration where I can manually enter the part name for each configuration line, but what I am wondering is can the name be dynamically changed based on the selected variables: i..e.
3508-RightDischarge-LeftDrive-2000Discharge
Or do I need to manually enter this for all the potential configs.
Thanks,
Currently I have a machine which has the following options:
Model (ex. Model 3508, 3514, 3518)
Discharge Side (ex. Left, Right or Dual Side)
Drive Side (ex. Left or Right)
Discharge Height (infinitely variable from around 2000mm to 30000mm)
I see there is the properties configuration where I can manually enter the part name for each configuration line, but what I am wondering is can the name be dynamically changed based on the selected variables: i..e.
3508-RightDischarge-LeftDrive-2000Discharge
Or do I need to manually enter this for all the potential configs.
Thanks,
0
Best Answer
-
It was in the what’s new, you might have missed it.
https://cad.onshape.com/documents/cb387c60a50e49e2a50a65da/w/38f957562c3238fb6debd3a3/e/c6024f1ff135baf098509c71
Senior Director, Technical Services, EMEA7
Answers
-
If you configure text variables for values of Model, Discharge Side and Drive Side it would be possible to create the feature which would take text expression like #model~#disSide~#drSide and assign the result of it evaluation to the part property like Name. But if the Name was once edited manually, custom features have no more affection on it. Would be nice to see some comments about this behavior from OS developers.
0 -
I am just trying to do this today too. I want to be able to determine which part I am using in an assembly based part name which I'd like to be different depending on the configuration. I can not see how to do this.0
-
So you need a renaming custom feature? If so where can we find this?konstantin_shiriazdanov said:If you configure text variables for values of Model, Discharge Side and Drive Side it would be possible to create the feature which would take text expression like #model~#disSide~#drSide and assign the result of it evaluation to the part property like Name. But if the Name was once edited manually, custom features have no more affection on it. Would be nice to see some comments about this behavior from OS developers.0 -
@brucebartlettbrucebartlett said:So you need a renaming custom feature? If so where can we find this?
one was posted a while ago by OS, i personally have another example. it can consume string expressions, but requares strings to be inserted in qotes
https://cad.onshape.com/documents/67e94d9f28bea28acfe4cd2f/w/148839604556a1f380541be8/e/6390c076d48caa89151017d9
1 -
-
It was in the what’s new, you might have missed it.
https://cad.onshape.com/documents/cb387c60a50e49e2a50a65da/w/38f957562c3238fb6debd3a3/e/c6024f1ff135baf098509c71
Senior Director, Technical Services, EMEA7 -
by the way, could somebody from OS explain what was the reason to make part properties as enum? i expected some custom property type based on map with fields for all the properties in one container
1 -
Thanks Neil - I'll have a look into that and see what I can adapt to my document.NeilCooke said:It was in the what’s new, you might have missed it.
https://cad.onshape.com/documents/cb387c60a50e49e2a50a65da/w/38f957562c3238fb6debd3a3/e/c6024f1ff135baf098509c710 -
In case anyone missed it, this document contains a FeatureScript, "Part Number", that provides a bridge from the part's configuration data to the actual Part Number. AFAICT, you'll need to copy and tweak this script to implement your own part naming policy based on your part's configurations.NeilCooke said:It was in the what’s new, you might have missed it.
https://cad.onshape.com/documents/cb387c60a50e49e2a50a65da/w/38f957562c3238fb6debd3a3/e/c6024f1ff135baf098509c71
This is a nice starting point. It'd be helpful to have a blog post or other documentation that lays this out a bit more clearly. Especially with the new BOM feature having just launched, the BOM is remarkably useless in the presence of configured parts because there's no obvious way to surface part configurations in the BOM. A BOM with a line item "38 socket cap screws" is not really informative.
FWIW, the use case that brought me here is a project built using off the shelf aluminum extrusion. The vendor can output CAD for any of their shipping configurations, but that's a slow process of downloading and importing. I made a configurable part based on the extrusion profiles I'm using, which greatly sped up the process of building my assembly. Of course, I hit this snag in the BOM. The BOM lists a separate line item for each different part configuration in the assembly, but the part numbers all show up the same. Naively trying to edit a configuration's part number in the BOM changes it for all configurations of that part in the document, which isn't what I had hoped for.1 -
@john_whitley
On the Part Number FS:
You should be able to simply right-click "configure" any of the fields that comprise the part number and set them in configurations tables (or, use a configuration variable as part of an expression in those fields e.g. round(#Length / mm) ). Either way, you shouldn't need to edit the FeatureScript. The custom feature is designed to be used as is.
On editing inside the BOM:
The rule here is: If the property you're changing is coming from the Configured Part Properties table, your change gets applied to that table, which changes one configuration. If the property you're changing isn't in that table, the edit gets applied to all configurations. If you want the BOM to control individual configurations, you need to set those properties on individual configurations first.
One shortcoming here is that, if you're using the custom Part Number FS, those numbers unfortunately aren't in the Configured Part Properties tables. This means you should be using the Configured Part Properties table to set any properties which you decide should apply only to individual configurations. This is currently the only way the BOM knows to not edit all configurations.
If you'd like this behavior to be different, please submit an improvement request for us to consider!
1 -
I've been playing around with this FS, and have come across a few issues I am having:NeilCooke said:It was in the what’s new, you might have missed it.
https://cad.onshape.com/documents/cb387c60a50e49e2a50a65da/w/38f957562c3238fb6debd3a3/e/c6024f1ff135baf098509c71
-- I can only seem to use numbers for the part numbers segment in the FS - i.e. if I have a "RH Drive" option, if I select the configuration table for that line, and select the "RH Drive" line, the FS gives me an "Error Regenerating" error. However if I change "RH Drive" to "1" then it works fine.
-- I have a custom height of 3000mm - but in the part number is defines it as "3 metres". I think I need to get around that by making a number variable for the discharge height, instead of driving that dimension straight off the sketches. [Solved that one as I wrote]
-- The FS changes the part number property in the properties dialogue (and associated BOM), but not the actual part name like in the example FS. Not sure what I am doing wrong there.
0 -
Hi @daniel_cook
For your first and third questions:
1) Those input boxes for the segments allow anything as input, but giving them a string is somewhat quirky. Rather than putting `RH Drive`, you'll have to put `"RH Drive"` (a.k.a. you'll have to include quotes).
3) Do you have `also set name` checked? The part name and part number are different properties in the system, so the custom feature will only attempt to set the name if you have that boxed checked. If you do have the box checked and it's not working, you probably have set the name of that part already manually. Manual changes to the name currently override programmatic changes. We're aware of this defect and making plans for a solution.Jake Rosenfeld - Modeling Team0 -
On the Part Number featurescript, it is creating the part number correctly, but not setting the name. I am driving 2 segments from a config table - is that the issue?
Aside from that I cannot see the difference between the models0 -
@shaun_singh
Could you share the URL of you document? If not, do you have "also set name" checked? See my answer above for possible issues.Jake Rosenfeld - Modeling Team0 -
FWIW The script only works when you have not set the part name manually before. It looks like the manual rename always takes precedence. And can not be overwritten by the FS. This is slightly annoying because for this to then work, you have to delete the part and recreate it. After doing so reselecting the part in the Part Number feature it works.
I tried setting value to undefined first to try to clear it, but that also doesn't work:setProperty(context, {"entities" : definition.part,"propertyType" : PropertyType.NAME,"value" : undefined});setProperty(context, {"entities" : definition.part,"propertyType" : PropertyType.NAME,"value" : partNumber});1 -
Jake Rosenfeld - Modeling Team0
-
A workaround for this that I'd recommend (though, of course, Onshape certainly will have a real fix at some point) is to create a dummy part that's fully inside the part you want to rename, then boolean them together, selecting the dummy part first, then the part to rename. That way the geometry doesn't change and Onshape sees the blank name of the dummy part, instead of the name you gave the first part. It feels silly to do, but it's way less silly than re-building the part.daniel_verstegen said:FWIW The script only works when you have not set the part name manually before. It looks like the manual rename always takes precedence. And can not be overwritten by the FS. This is slightly annoying because for this to then work, you have to delete the part and recreate it. After doing so reselecting the part in the Part Number feature it works.
I tried setting value to undefined first to try to clear it, but that also doesn't work:setProperty(context, {"entities" : definition.part,"propertyType" : PropertyType.NAME,"value" : undefined});setProperty(context, {"entities" : definition.part,"propertyType" : PropertyType.NAME,"value" : partNumber});4 -
I encountered the same problem today, can onshape please fix this?
(for example lock the manual rename, or choose to overwrite it, or give a messagebox warning, or some other sort of solution)1 -
Hmmm. This problem still seems to exist. Annoying. I'll try the workaround mentioned by Evan.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
- 75 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







