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

dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭

We are pleased to announce that version 2.0 of our Surface Text creator Featurescript is now available.

Add the feature to your toolbar by searching for "PP Surface Text", or open this document:

https://cad.onshape.com/documents/cad175bd2990f3c9314a1c10/w/05ec37b276b1dd333f6afc16/e/08c7b53ee50a34dc6966a026


New Features:

  • Improved performance, especially on planar surfaces
  • Much more robust. If the text does not fit on the surface, it will be truncated, rather than creating a render error (thanks @owen_sparks )
  • New alignment modes allow selecting text to be aligned with baseline, or with the full extent of text
  • It is now easy to use the edges of a face as the align curve 
  • Custom tracking allows tweaking spacing between letters (thanks @SledDriver )
  • Custom Kerning allows fine-tuning the spacing between each pair of letters
  • Text is projected onto the selected surface, so that base curves can be located on another plane if desired
  • Text letters can now be filleted

As always, this feature is a BETA, free for personal and commercial use.  We only ask that you report both good and bad experiences so we can improve the product.  Make sure to open the example folder for lots of good examples of the feature in action!    More information is available here:

http://store.parametricparts.com/store/p10/CURVED-TEXT-2.0

This feature and our others are available on the Parametric Parts store, at http://store.parametricparts.com/products.html



«13

Comments

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @paul_britton  @owen_sparks @SledDriver @mac_mcquaid

    The newest version incorporates much of your feedback-- thanks!
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    edited May 2017
    also, just to add, the old document has been upgraded with the new changes, so for existing users, you should be able to upgrade your toolbar to the newest version of the same document (https://cad.onshape.com/documents/cfec40e2b66bb4ddb2f3414b/w/24132f252a02825eb0606641/e/7af1344ab1e54af102d0f4b9​) 
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Wow, that's quite an upgrade @dave_cowden !

    Can't wait to try it out.

    Cheers,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Works like a charm :)



    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Hah, thanks @owen_sparks, especially for thread where we discussed handling overhanging text. 

    I ended up doing the best I could to make it 'just work'.  The solution turned out to treat 'add' differently than cuts.  For add, we can simply add the text, even if it 'falls off' of the surface.  For cuts, its easy to just not remove the material.

    Here's an example:

    Until you get your goal of banning all fonts that go below the baseline, the current functionality is the best I could do-- the user can choose whether to consider the entire text or just the 'baseline':







  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    hi, Dave
    have a little request to encrease parametric capabilities of your text feature, i suppose you take a text itself as string parameter, so we cant pass any variable-dependent expression, i would like to have an option to pass a text as featurescript string expression using isAnything() predicate. so we could make some kind of auto-labeling capabilities, when text is ruled by external variables like so: "M"~toString(#d)~"-"~toString(#l)

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,211
    @konstantin_shiriazdanov
    It is possible also wrap Dave's feature with a different interface, including isAnything fields.  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.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Hi @konstantin_shiriazdanov

    I don't mind making this modification.  I'm not really familiar with how isAnything fields work, though.

    Is it as simple as changing my input variable declaration to isAnything(), and then doing toString() on it before running the routines?  I didn't know that variable references would magically get replaced inside of toString...

    Anyway, this is a pretty simple modification to make, I think-- i'm happy to do it!
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited January 2018
    Is it as simple as changing my input variable declaration to isAnything(), and then doing toString() on it before running the routines?  I didn't know that variable references would magically get replaced inside of toString...
    Made some tests, and seems like modified feature would requare text input that is already a string expression (ie quotes would be requared) like this: "Change me".And converting it to string doesn't needed. With confiqured part studios functionality it becomes important to be able to have variable dependent text annotations on your parts, and your feature with this modification can do the job. thank you

    @ilya_baran thanks for the idea, is there a way to take a string using "as string" type tag and convert it to code inside the feature itself?
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Hi guys, configurations has string variables. I might be missing the point but I've used Dave's existing feature to extrude part numbers into configurable parts...
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @konstantin_shiriazdanov

    I don't understand your latest comment. I already accept a string parameter, and I'm not sure how quotes would help.  Thanks @owen_sparks for weighing in, when you did that, did you include a variable reference in the message along with other text, or was it a variable by itself? I think the need here might be to have an sprintf like capability that can mix text along with variable values.

    If that's the case,  I don't know how to get fs to do that other that to write my own implementation. 
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    I don't understand your latest comment.
    i meant that isAnything() predicate requares a valid FS expression so it wouldn't allow string like Change me because it is not FS expression but would accept string "Change me". and as @owen_sparks said configuration table alows string variables and parameters but it seem like doesn't allows string expressions that should be evaluated before passed to the feature, ie one should manually define string variable for each row of config table
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    konstantin_shiriazdanov oh ok, so forgive my ignorance on this, but does isAnything() allow mixing strings and variables? For example "Change Me" + #myvariable ?

    I had bad experiences trying to do simple things like format numbers with FS.  So i think its not possible to, for example, control the format of a number to be two decimals, etc-- so i'm guessing "Change Me" + #myLength, if it works at all, would produce something really ugly like "Change Me 1.999999999999 mm or something ugly.

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited January 2018
    does isAnything() allow mixing strings and variables? For example "Change Me" + #myvariable ?
    it allows mixing but one should keep FS syntax: "Change me"~toString(#myVariable) or "Change me"~#myVariable
    I had bad experiences trying to do simple things like format numbers with FS.  So i think its not possible to, for example, control the format of a number to be two decimals, etc-- so i'm guessing "Change Me" + #myLength, if it works at all, would produce something really ugly like "Change Me 1.999999999999 mm or something ugly.
    i think you could make an overload inside your feature, and possibly user could call this functions from feature studio. theese functions seem to work
    <br>export function toString(value is number, n) returns string<br><br>{<br>&nbsp;&nbsp;&nbsp; value = round(value * 10 ^ n);<br>&nbsp;&nbsp;&nbsp; return toString(value / 10 ^ n);<br>}<br><br>export function toString(value is ValueWithUnits, n) returns string<br><br>{<br>&nbsp;&nbsp;&nbsp; const unitName = keys(value.unit)[0];<br>&nbsp;&nbsp;&nbsp; var absValue = value["value"];<br>&nbsp;&nbsp;&nbsp; absValue = round(absValue * 10 ^ n);<br>&nbsp;&nbsp;&nbsp; return toString(absValue / 10 ^ n) ~ " " ~ unitName;<br>}



  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    konstantin_shiriazdanov thanks that helps! I understand now-- i'll add this to my list.  I think providing text in FS expression syntax is powerful, but probably too confusing for most users.  But I think i could allow this as an alternative advanced option, because I can definitely see the value and power of this strategy.

    I'll try to add this functionality soon. Thanks for the suggestion!
  • chris_sturgischris_sturgis Member Posts: 25 ✭✭
    I am working on a part that is cylindrical. I am trying to carve out a lot of the part so its ends up being kinda like a cage, but ideally with hex instead of bars. I have been trying to use projected curves without much success. Enter this featurescript. I am very easily able to use this featurescript to add text cutouts to the cylindrical surface. Could this possibly be updated to add a fill pattern of some sort? I am not a programmer and havent done any learning on how to use featurescript, but is anyone out there able to edit for this use?
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Hi, @chris_sturgis
    I'm Dave, I developed PP_Surface_Text

    Can you tell me more about what you mean by a fill pattern? I do maintain a list of enhancement requests, and I try to get them into new feature versions...
  • mahirmahir Member, Developers Posts: 1,307 ✭✭✭✭✭
  • ryan_young880ryan_young880 Member Posts: 1
    I'm trying to use your text to curve tool, but can't seem to find a way to rotate the text 180 degrees.  I want curved text similar to how a coin has "United states of America" curved across the top, and then "Quarter Dollar" curved across the bottom.  but no matter what I do it just puts two phrases on top of each other. Here's the part I'm working on.  https://cad.onshape.com/documents/5ab583e0523ddd794d1d6974/w/52df45e56259d54b62f04587/e/53c92b4420c4d7d0b4b65a7a


  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @ryan_young880

    Looks like you figured it out?
    Jake Rosenfeld - Modeling Team
  • lars_rengersenlars_rengersen Member Posts: 32 ✭✭
    Hi @dave_cowden your Surface Text Featurescript is probably exactly what I need, but unfortunately despite trying many settings I do not get the desired result.
    Whatever I do, the "cut out" option turns red / results in an error.
    Here is my document https://cad.onshape.com/documents/3fcf4d7004a36d1682dfa7f6/w/6809b8a6283e6a572be51cec/e/dbe0df79ad2805f3c8f1a3e3
    In the tab "Custom bezel" you can see what I am trying to achieve.
    But even on a simple square block "ST test" I do not manage to get the cutout.
    Hope you or someone else can help me out to fix it.


  • lars_rengersenlars_rengersen Member Posts: 32 ✭✭
    Found it!
    Due to the fact that Sketch 7 was still visible, that one was selected while clicking on the part. Tried to select the extrude earlier by clicking on it in the left menu, but did not work.
    Hiding the sketch allowed me to select the extrude in the part and now it works. 
    (Hope his is helpful to others too).
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Awesome, glad it worked for you! 
  • RobotMan2006RobotMan2006 Member Posts: 3
    Hi Dave,

    Nice tool. I've run into one issue, I didn't see that anyone else is reporting this problem so maybe I'm doing something wrong. (See attached screenshot) I want to use export a dxf to laser cut this part, but the exported dxf is missing the results of the surface text tool. Only the inner and outer circles appear in the dxf, the outlines of the cutout text are missing. Any ideas?


  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    Hi @RobotMan2006 That's not been reported thusfar.My first guess is to make sure you're selecting both the correct surface for dxf export.

    I did a small example, and I got the expected result when I right-clicked the face and chose "Export as DWG/DXF"

  • stuart_rampystuart_rampy Member Posts: 2 EDU
    So Im having some issues putting in a variable in tot the Text Field of the Script. it just keeps on giving the variable name not the variable value. Is there a way to fix this ( I see some discussion from back in January on this but I don't see how the commentators resolved their issues) 




  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    If you share a link to your doc in sure someone will jump in and fix it. I've used faces feature with configurations so I'm sure it's possible.

    How is#length declared? As text?
    OwS
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited November 2018
    @stuart_rampy 's request involves a change to the text feature itself, allowing an option to interpret the input as an expression (involving variables like #myLength) instead of literally as a string.

    Something like:
    
            annotation { "Name" : "Use expression" }
            definition.useExpression is boolean;
            
            if (definition.useExpression)
            {
                annotation { "Name" : "Text expression", "Default" : "#TextVariable" }
                isAnything(definition.textExpression);
            }
            else
            {
                annotation { "Name" : "Text" , "Default" : "Change Me" }
                definition.text is string;
            }
    ...
        }
        {
            if (definition.useExpression) {
                definition.text = toString(definition.textExpresion);
            }
    ......

    Then you could set the test expression in the feature dialog to something like #myText or roundToPrecision(#myLength / inch, 3) ~ " in"

    @dave_cowden does that sound like a reasonable change to make?

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    @kevin_o_toole_1 yep, that's reasonable, and would be a great feature for me to add. Thanks for the example code Kevin!

    I'll see if I can add this feature soon  
  • stuart_rampystuart_rampy Member Posts: 2 EDU
    @kevin_o_toole_1 , @dave_cowden 

    thank you this sounds great. 
Sign In or Register to comment.