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: 475 ✭✭✭
    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: 2,050 ✭✭✭✭✭
    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 - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • 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: 16 ✭✭
    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: 475 ✭✭✭
    @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: 19 ✭✭
    edited May 2020
    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.
  • otaolafrotaolafr Member Posts: 113 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: 1,309 ✭✭✭✭✭
    @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: 475 ✭✭✭
    @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: 1,309 ✭✭✭✭✭
    @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: 2,050 ✭✭✭✭✭
    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 - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,309 ✭✭✭✭✭
    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.
  • otaolafrotaolafr Member Posts: 113 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: 225 PRO
    edited June 2020
    @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.


  • aleks_clarkaleks_clark Member Posts: 5
    @dave_cowden this is awesome, and I'd throw some money at you for this sort of quality of life improvement. could you possibly set up a patreon, and find a way to share your stuff only with patreon subscribers?
  • sebastian_glanznersebastian_glanzner Member, Developers Posts: 425 PRO
    edited August 2020
    @aleks_clark
    Good idea I would also think that something like pareon could be a good solution for @dave_cowdenand other FeatureScript creators.


    Maybe with different tiers:

    Basic $:
    You get access to the newest versions of the FeatureScripts.

    Medium $$:
    You can request improvements for the Basic FeatureScripts.

    Premium $$$:
    You get customized FeatureScripts based on the Basic scripts available.

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @aleks_clark @sebastian_glanzner thank you all for the kind words about these FS!

    Limiting access has been the problem for the most part. Onshape just hasn't made it easy to do it.  It would be possible to manually share new features with certain individuals, but there is no way to limit their ability to share further. Version management becomes hard too.

    I have a few other projects right now, but I will consider setting up a patreon, and ill do a few tests to see how far I could get with manual sharing. At the very least I could honor feature requests only for supporters!

    Thanks again everyone for your ideas and support!
  • john_doubledayjohn_doubleday Member Posts: 58 EDU
    Looks like a great script but how does one control the Kerning?......letter spacing right?
     I am using it to make cut out lettering for a Metal work challenge in an Australian high school. Thanks for a great tool
  • otaolafrotaolafr Member Posts: 113 EDU
    hello @dave_cowden
    second time in a row! ehehe, first of all, thanks for another great feature,
    secondly, the other day I found myself with a "bug" in the surface text FS? I was using a variable value concatenate with text and when I was puting "1.3 mm" as value surface text showed "1.30000000000000000000000002 mm" I got around by cutting decimals but not sure why there was a problem as for other values worked correctly, E.G for "1.315 mm" it showed "1.315 mm".
    thirdly ^^, I am offering to make custom icons for the FS of people that I use as I love the idea of helping with what I can....
    i thought of something like this for the surface text (but it is quiet hard to imagine something for it to "visualise" the function...) If you want I could send you the svg file and also if you want modification i could do it with pleasure :smiley: 
     the surface looks a little bit as a leaf :open_mouth: ahahaha

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @Otaola_Franco I love it. Your design skills far surpass mine! that's why i didnt even _try_ to make an icon.
    How do you add an icon? i dont even know how to do it.
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    Info on adding custom icons can be found here. It looks to me like @Otaola_Franco is having a rounding error, which could possibly be fixed by switching the text FS to using roundToPrecision to output numbers, unless I'm misdiagnosing the issue.
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • otaolafrotaolafr Member Posts: 113 EDU
    edited December 2020
    Info on adding custom icons can be found here. It looks to me like @Otaola_Franco is having a rounding error, which could possibly be fixed by switching the text FS to using roundToPrecision to output numbers, unless I'm misdiagnosing the issue.
    hello @Alex_Kempen
    yes exactly, it was that way i solve it, thanks to god, i was working in a fs and came across this function, but what was intriging me it was that the behavior was not the same for different values.... as you mention I solvid with roundToPrecision, but what was strange that for 2 different values I got different answers. also the roundToPrecision is not a perfect solution, as I dont know the decimals that could change the rounding number in the function will round differently, and for example if in the case of 1.3155 mm i put roundToPrecision(#variable,3) i will get  1.3155 (as the number of decimals will change..)
    @dave_cowden you are way more experiene than me with onshape FS so you might get everything from the doc alex linked but when I was doing it myself I couldnt finish to understand it, here is explained a little bit easier and better in my opinion https://forum.onshape.com/discussion/2499/importing-part-studios-and-feature-studios (septs 1. to 3.)
    also another issue with the FS is that it changes the id of the part? at least I think is doing that as when editing the text in the feature sometimes broke the features applied to the part down the line. I think it could come from the boolean operation type UNION at the end where the first element is not the original body so sometimes it changes as the resulting body saves another ids? I think.... not sure.... 

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Ah ok thanks for the 🔗 I'll try to work the roundtoprecision and icon into my next feature version.
  • tgunrtgunr Member Posts: 44 ✭✭
    How do you select the baseline? I have tried everything I can think of and it always remains blank. In the example on a flat surface which  has the "Change Me" text, I deleted the baseline which was the edge of an extrude. I could never get it back.

    https://cad.onshape.com/documents/a2d4cd65d4fdb270b80e0727/w/ede8a4fc2867490d73f0d14a/e/44b979dcb4aec81089858ce1
  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO
    edited September 2021

    @tgunr

    Try something like this:
    • Hide all sketches, the base surface works best when it is the actual surface of the part.
    • Then, select the base line you wanted. Make sure the base line input box is active by clicking on it then selecting your base line.
    https://cad.onshape.com/documents/8142c7e1306198a02e50c833/w/61bb5e8d797f3e0e6a48b472/e/087e961a785f1a7575907d3f



    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • kevin_mason558kevin_mason558 Member Posts: 47 EDU
    Good afternoon
    i can't seem to work out the cut out feature 

    I've added text to the surface of a sheet metal lid 
    add new works  but cut out doesn't  
    I've ended up doing extrude, remove through the new letters and the surface disc 
    but the cutout would a lot easier 

    any suggestions on what I may have done wrong please? Thanks 
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @kevin_mason558 those look cool! Hey, yeah i think something has happened in FS core land that has broken this, because test cases that used to work no longer work for cut.  Its not always broken, but several cases that used to work do not, so its not something obvious you are doing wrong!
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    @dave_cowden Would you mind sharing those cases with support and pointing us to them?  Thanks!
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @ilya_baran great to hear from you after such a long time!
    In this document: https://cad.onshape.com/documents/cfec40e2b66bb4ddb2f3414b/w/24132f252a02825eb0606641/e/1ac9d45620418b8d1e3154f5
    "Surface Text 1" fails but worked previously i think.

    One such example is instance #2 of of this tab

    In fact, in this document, i'm fairly sure than any examples using "cut out" used to work, but don't.

    I fiddled a bit with depth of text and a few other things, and nothing obvious materialized. 

    I should point out that its actually very stunning that these have worked this long-- ive not done anything to upgrade them, and i'm shocked to learn that some of these are 8 years old now!  So, even if these finally did break, that's a very impressive track record of resverse compatibility! 
Sign In or Register to comment.