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.

Names of parts with parameters values inside

Otaola_FrancoOtaola_Franco Member Posts: 54 EDU
hello,

is it possible to use a parameter from features or a parameter from a configuration to being use in the name of the part in a way that changes automatically?

for E.G i have #D=5cm that i use to define the length of a circle in a sketch that i extrude with a #H=15cm, i would like that the part is called for example "tube of 5cm of diam and 15cm of high" and that if i change the values of #D and #H their values changes in the name of the part. #D=2cm #H=20cm will result in a part with the name "tube of 2cm of diam and 20cm of high"

also as i think is in the same subject, is it possible to use these parameters in notes or tables in drawings? thanks


Comments

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 931 ✭✭✭✭✭
    edited November 2018
    I have Property explorer FS for setting properties based on external variables - select the part, then select a property and put in string expression for the property: for example: "tube of "~toString(#D)~"of diam "~"and "~toString(#H)~" of hight". If the whole expression is not convinient to handle in one input field you can add multiple consecutive substrings for the same property, they all will be concatenated in one string in the given order and set to property.
    https://cad.onshape.com/documents/67e94d9f28bea28acfe4cd2f/w/148839604556a1f380541be8/e/6390c076d48caa89151017d9

  • owen_sparksowen_sparks Member, Developers Posts: 2,448 PRO
    Nice work Mr Russian-Hacker-Sir :+1:
    Now if only OS would give us a "get property" method...
    OwS.
    Production Engineer
    HWM-Water Ltd
  • Otaola_FrancoOtaola_Franco Member Posts: 54 EDU
    edited November 2018
    I have Property explorer FS for setting properties based on external variables - select the part, then select a property and put in string expression for the property: for example: "tube of "~toString(#D)~"of diam "~"and "~toString(#H)~" of hight". If the whole expression is not convinient to handle in one input field you can add multiple consecutive substrings for the same property, they all will be concatenated in one string in the given order and set to property.
    https://cad.onshape.com/documents/67e94d9f28bea28acfe4cd2f/w/148839604556a1f380541be8/e/6390c076d48caa89151017d9

    GOD! one of the best FS i have saw! thanks

    but i had a problem, @[email protected]_shiriazdanov it doesnt modify the name of the part
     
    in the secont entry i put it "toString(#DE)" without the ".
    the part still has the same name SUPPORT BLOCKER


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 931 ✭✭✭✭✭
    sadly if you once have edited the name of the part manually you can't change it's name via featurescript anymore. this is how onshape properties work
  • MBartlett21MBartlett21 Member Posts: 1,668 EDU
    See here for what ilya_baran said about it:
    https://forum.onshape.com/discussion/comment/46448#Comment_46448
    MB - I make FeatureScripts:View FeatureScripts
  • Otaola_FrancoOtaola_Franco Member Posts: 54 EDU
    I have Property explorer FS for setting properties based on external variables - select the part, then select a property and put in string expression for the property: for example: "tube of "~toString(#D)~"of diam "~"and "~toString(#H)~" of hight". If the whole expression is not convinient to handle in one input field you can add multiple consecutive substrings for the same property, they all will be concatenated in one string in the given order and set to property.
    https://cad.onshape.com/documents/67e94d9f28bea28acfe4cd2f/w/148839604556a1f380541be8/e/6390c076d48caa89151017d9

    excuse me, i would like to know if it possible to use configurations too, i had succed to use variables from feature script, but i would like to know if it is possible to use the name of a list imput (from a list, like the name)

    thanks :)
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 931 ✭✭✭✭✭
    I'm not quite understand, but if you need to use this FS in configured part studio, as I remember you can't configure list input parameters itself, but you can configure variable features, which are referenced by the FS.
  • Otaola_FrancoOtaola_Franco Member Posts: 54 EDU
    I'm not quite understand, but if you need to use this FS in configured part studio, as I remember you can't configure list input parameters itself, but you can configure variable features, which are referenced by the FS.
    one of my configuration is a list imput where i choose between name 1, name 2, etc...
    i wanted to use that "name" to use it in the FS to configure name. i solved by adding a variable that is a string with the same name as the name of the list of the configuration, and configurated to change with the configuration. but i wanted to know if there was a directly way to used. but thanks anyway :) and, really, it is a great FS!
  • Matthew_RaunMatthew_Raun Member Posts: 2 PRO
    This is a really cool FS but I'm having a problem where the units are always convereted into meters even though the default units of the document are inches. Is there a way to make the units in the name the same as the default document units. It happens even from units in millimeters or centimeters as default being changed to meters.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 931 ✭✭✭✭✭
    @Matthew_Raun you need to convert your values in inches manually then. For example #l_in=#l_m/inch. To avoid of additional decimals take a look at round() and roundToPrecision() functions.
  • Matthew_RaunMatthew_Raun Member Posts: 2 PRO
    @Matthew_Raun you need to convert your values in inches manually then. For example #l_in=#l_m/inch. To avoid of additional decimals take a look at round() and roundToPrecision() functions.
    Thank you for your quick response. The units are in inches, which is what I want, and I would like to have the name be given in units of inches as well, instead of converting to meters. Is there a way to change the Property explorer to output units in inches instead of meters for part names? 
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 931 ✭✭✭✭✭
    edited August 9
    Any length value internally is in meters, to get it value in inches you have to divide it on the inch value.
Sign In or Register to comment.