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.

Is it possible to set a property within a Part Configuration from Configuration Variables?

StephenGStephenG Member Posts: 367 ✭✭✭
I have created a configured part studio with 2 configuration input variables: "Dia" and "Length".

I want to set the the property "Name" of the part to be a combination of a fixed text string followed by the diameter and length information.

Are there functions in OS that can be used in a Part Configuration table to convert a variable to formatted text? 

Answers

  • Evan_ReeseEvan_Reese Member Posts: 2,059 PRO
    I have a custom feature I'd use for this called Part Name. It's based on the Part Number feature by @NeilCooke. Here's my example. It can be a bit finnicky to set up, for example, you need to divide your dimensions by your units to get rid of them in the expression (i.e. #Length/mm). If you want to add them back in as a string, you can do it on a new line.

    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • StephenGStephenG Member Posts: 367 ✭✭✭
    I was hoping there was an official (or undocumented) mechanism to accomplish this. Something along the lines of a function that could be entered into a configuration table cell. Essentially, I am attempting to mimic what happens when creating an instance of a Standard Library item into an assembly, but using "Other documents" with configured Part Studios. I want to set/propagate the "Name" and "Description" part properties with meaningful information.

    For example, something along the lines of the C Standard Library function sprintf(). Using your example the part configuration table for the property "Name" would contain: sprintf("Cylinder_%u_%u",#Length,#Diameter). 

    I will investigate using your FS as a workaround.

    Thanks.
  • Evan_ReeseEvan_Reese Member Posts: 2,059 PRO
    edited April 2021
    @StephenG
    I'm using this method for a configured hardware library, where the configured items populate the name of the part. Sound similar to what you're trying to do too. I think this feature should do what you want. Ping me if you get stuck.
    Evan Reese / Principal and Industrial Designer with Ovyl
    Website: ovyl.io
  • shawn_crockershawn_crocker Member, OS Professional Posts: 797 PRO
    edited May 2021
    StephenG said:
    I was hoping there was an official (or undocumented) mechanism to accomplish this. Something along the lines of a function that could be entered into a configuration table cell. 
    @StephenG
    The custom features are the official way to do this.  And they work very good.  onshape is built so that custom features are an integral way to use the system.  If you are not using or sub-consciously labeling custom features as "not as good as integrated features" you are seriously impairing your ability to function efficiently within onshape.  Custom feature only differ in one way from standard integrated ones.  The person who created it was not being paid to do so(usually).  I would advise you to let go and start making custom features your go to when trying to perform a task that is not immediately obvious within the standard tool set.  I love watching YouTube videos of people making things like knives and hammers and creating other tools with mills and lathes.  When they are done making there tool, it always seems to perform as good or better then one that could have been bought in a store.  The one in the store usually doesn't fit your hand as well though.
Sign In or Register to comment.