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.

New Featurescript: PP Surface Text 2.0

2»

Comments

  • dave_cowdendave_cowden Member, Developers Posts: 450 ✭✭✭
    edited November 2018
    @kevin_o_toole_1
    @stuart_rampy
    @here

    I've created a new version of Surface Text ( v2.1.5 ) that includes ability to use expressions. Thanks @kevin_o_toole_1
    for the pointers on the syntax, that definitely saved time!

    The test case in the new version is pictured below ( it uses Kevin's suggested expression)



    Document Link:  https://cad.onshape.com/documents/cfec40e2b66bb4ddb2f3414b
  • dave_cowdendave_cowden Member, Developers Posts: 450 ✭✭✭
    konstantin_shiriazdanov after a long time, (and another reminder from the community), i finally implemented your suggested edits to this feature. Sorry it too so long!
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 1,836 PRO
    ilya_baran said:
    One thing I'd like at some point is for the user of a feature to be able to replace a parameter like a boolean, string, or enum (or even the suppression state) with an expression.
    I would really like this.
    Should I create an Improvement Request?
    MB - I make FeatureScripts: View FeatureScripts
  • phillip_saboltaphillip_sabolta Member Posts: 1
    Hi @dave_cowden I just stumbled across this handy tool. It has made my life so much easier. Thank you. 
    However, it doesn't recognise Japanese font.. which Onshape does, under Noto Sans Japanese.

    Is there an easy way to add it to the list under fontface library?
  • jmsaltzmanjmsaltzman Member Posts: 8 PRO
    Wow @dave_cowden thank you for this! The string expression can be fiddly, so I just make another variable with an "any" type value first to form the string. Anyway, much appreciated!
  • dave_cowdendave_cowden Member, Developers Posts: 450 ✭✭✭
    @jmsaltzman
    You are welcome, thank you for taking the time to comment! Eventually i'll make a new version with various improvements folks have asked for, but I'm glad the current version is helpful!
  • thomas_aathomas_aa Member Posts: 17
    edited May 1
    Thanks for the great script @dave_cowden !

    I have run into a problem: When I used "Raised Add", the part I add to gets renamed to "Part 1". Also, children break (I'm making an inverted mold) every time I change the text. I think this can be resolved by having the target as the first element in the add/union list. At least it works that way for the Union tool.

    I tried to make a test, but I think the code that actually does this is in the PP_Text_Libraries text.fs, which is not public or I mangled the URL trying to open it.

    edit. For anyone with the same problem, my workaround was to us "Raise New" and then do a 0.1mm extrude from the surface into my part to be able to use "Merge with all" to union all the letters with the part.

    edit2. It turns out that Raise New failed to handle my text when it is "5", but works fine for "25" :S. It worked fine for raised add. It seems that I always need at least 2 letters for Raise New.

    edit3. Work around for the Raise New problem: Do a new on a throw-away part that is then "Merge with all"-merged with my real part. So:
     * Extrude a small throw-away part into my part.
     * Text with Raise Add on the throw-away part.
     * Extrude into my original part and use "Merge with all" to merge the throw-away part with the original part.
  • Otaola_FrancoOtaola_Franco Member Posts: 86 EDU
    Hello,
    I am having an issue with using variables in the feature, I want to add 1 mm (the variable is for example #d=1 mm)
    the issue is if i say that it is an expression and use #d I get 0.001 m (when i would like to be displayed in mm)
    I tried: (#d/1mm)~"mm" but now i get "1 milimeter" obviously I was looking to have a small text length so not the best solution.
  • mahirmahir Member, Developers Posts: 998 ✭✭✭✭
    @dave_cowden, I can confirm the behavior @Otaola_Franco is seeing. Work around is to use the syntax below.

    #Test / m * 1000  ~ " " ~ "mm"
  • dave_cowdendave_cowden Member, Developers Posts: 450 ✭✭✭
    @Otaola_Franco
    @mahir thanks for the heads up/workaround.  I'm glad this thread is here, whenever i do a new version, i can gather up all of the little things and make it nicer. 

    Now if somehow OS made it possible for me to make even a little amount of money on FS development.......    
  • mahirmahir Member, Developers Posts: 998 ✭✭✭✭
    @dave_cowden I feel you. I've created a handful of FS and who knows how many SW macros. In both cases sharing code is easy enough, but monetization doesn't work well unless it's an addin/API based prospect.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 1,836 PRO
    Hello,
    I am having an issue with using variables in the feature, I want to add 1 mm (the variable is for example #d=1 mm)
    the issue is if i say that it is an expression and use #d I get 0.001 m (when i would like to be displayed in mm)
    I tried: (#d/1mm)~"mm" but now i get "1 milimeter" obviously I was looking to have a small text length so not the best solution.
    The reason this doesn't work is because #d/1 is evaluated first, then multiplied by a millimeter.
    If you just use (#d / mm) ~ " mm" that should work
    MB - I make FeatureScripts: View FeatureScripts
  • mahirmahir Member, Developers Posts: 998 ✭✭✭✭
    The reason this doesn't work is because #d/1 is evaluated first, then multiplied by a millimeter.
    If you just use (#d / mm) ~ " mm" that should work
    I tried this first. Two things happen. First, it converts the number into scientific notation, dividing by 1000 in the process "1E-6". Next, adding " mm" instead of " " ~ "mm" causes the unit to display as "millimeter" for some reason. There's all sorts of weirdness. Not sure if it's a bug in how expressions are parsed by FS, but it sure seems buggy.
  • Otaola_FrancoOtaola_Franco Member Posts: 86 EDU
    mahir said:
    @dave_cowden, I can confirm the behavior @Otaola_Franco is seeing. Work around is to use the syntax below.

    #Test / m * 1000  ~ " " ~ "mm"
    thanks! it worked, i dont get exatly why this happens but thanks a lot!
    @MBartlett21
    as @mahir said if we use directly (#d / mm) ~ " mm" as I mentioned in the first post, you get the "correct" value (I mean the variable in mm) but it shows milimiters instead of mm.
    @dave_cowden I cant imagine how much time have you spend in this FS.... as mahir mentioned i do not think at all that is an issue with the FS itself, I think is more of an bug. nothing to correct in your code, it is great <3.  thanks a lot for you great work! (right now I use your thread creator and the surface text at least that i can remember, they are great FS!) thanks a lot!

     
  • Cache_River_MillCache_River_Mill Member Posts: 188 PRO
    edited June 22
    @dave_cowden

    Thank you for this! 

    There are so many good things about this feature. After using it for a while, there are only two improvements I would request:

    - When using the option "Raise Add", the feature takes an existing part and adds it to the letters making it a new part, loosing its id and breaking features to follow. A solution to this would be to select the part you want to add to, and have the feature add the letters to that part instead of adding the part to the letters.

    - The text height is not a consistent number when set to one. For example, set the text to center, and text height to 1 inch. The font size will change and adjust to measure what you have typed. A very neat and useful, but could cause problems if you aren't aware it is happening and all of your different text are different font sizes.



    Awesome feature! We really appreciate this great tool.


Sign In or Register to comment.