Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

Can a Configuration change the name of a Part based on the selected options

daniel_cookdaniel_cook Member Posts: 40 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,


Best Answer

Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 768 ✭✭✭✭
    edited March 16
    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.
  • brucebartlettbrucebartlett Member, OS Professional, Mentor Posts: 1,707 PRO
    edited March 17
    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.
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • brucebartlettbrucebartlett Member, OS Professional, Mentor Posts: 1,707 PRO
    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.
    So you need a renaming custom feature? If so where can we find this?
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 768 ✭✭✭✭
    So you need a renaming custom feature? If so where can we find this?
    @brucebartlett
    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

  • brucebartlettbrucebartlett Member, OS Professional, Mentor Posts: 1,707 PRO
    Thanks, @konstantin_shiriazdanov I'll give yours ago. 
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 768 ✭✭✭✭
    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
  • daniel_cookdaniel_cook Member Posts: 40 PRO
    NeilCooke said:
    Thanks Neil - I'll have a look into that and see what I can adapt to my document.
  • john_whitleyjohn_whitley Member Posts: 2
    NeilCooke said:
    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.

    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.
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers Posts: 404
    @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!

  • daniel_cookdaniel_cook Member Posts: 40 PRO
    edited March 28
    NeilCooke said:
    I've been playing around with this FS, and have come across a few issues I am having:

    -- 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.


  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,092
    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 Team
  • shaun_singhshaun_singh OS Professional Posts: 8 PRO
    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 models
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,092
    edited June 29
    @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 Team
  • daniel_verstegendaniel_verstegen Member Posts: 1
    edited November 11
    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
    });
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,092
    @daniel_verstegen

    We know of this defect and the trouble it brings.  We are working on a solution.
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.