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

otaolafrotaolafr Member Posts: 113 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: 1,221 ✭✭✭✭✭
    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,660 PRO
    Nice work Mr Russian-Hacker-Sir :+1:
    Now if only OS would give us a "get property" method...
    OwS.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • otaolafrotaolafr Member Posts: 113 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, @kons@konstantin_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: 1,221 ✭✭✭✭✭
    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, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    See here for what ilya_baran said about it:
    https://forum.onshape.com/discussion/comment/46448#Comment_46448
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • otaolafrotaolafr Member Posts: 113 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: 1,221 ✭✭✭✭✭
    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.
  • otaolafrotaolafr Member Posts: 113 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
    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: 1,221 ✭✭✭✭✭
    @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
    @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: 1,221 ✭✭✭✭✭
    edited August 2019
    Any length value internally is in meters, to get it value in inches you have to divide it on the inch value.
  • otaolafrotaolafr Member Posts: 113 EDU
    Hey @konstantin_shiriazdanov ,
    I was doing a custom icon for a FS and I thought about reaching you, I made a simple loop icon with the color scheme of other icons for property explorer, I could send you the .svg if you want to add it to the FS :smiley:  would be a pleasure to give my to cents to the community with what i can do.
    I could modify it too if you dont like it (and send you the inkscape file too)


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @Otaola_Franco hi, though I named this feature "explorer" it is more "editor" or something like this, so I beleve the icon in this style may suit it 
    better. Just searched by request "text properties icon". If you could modify one of them to satisfy Onshape icon requrements and share here the link to the document with version of .svg file I would add link it directly to the feature. Thank you for taking part)

  • otaolafrotaolafr Member Posts: 113 EDU
    edited December 2020
    @Otaola_Franco hi, though I named this feature "explorer" it is more "editor" or something like this, so I beleve the icon in this style may suit it 
    better. Just searched by request "text properties icon". If you could modify one of them to satisfy Onshape icon requrements and share here the link to the document with version of .svg file I would add link it directly to the feature. Thank you for taking part)

    yes you are right I even though about a "writing pen" as icon too. right now i don't have a mouse so use a design software without one is almost impossible tonight i will do it :D

    there we are :) dont hesitate if you want any changes, I think the V2 is the better suited IMO but you take what you want :D also, if yu want modifications https://cad.onshape.com/documents/ffb39cdd758f74f190ace43a/w/944b43ede94c7a51ace17957/e/3216fa1bffc021e7845ac1ae
Sign In or Register to comment.