Jump to content
Nomi

Can't get vs.TrueTypeToPoly(text) to work

Recommended Posts

Hi all,

 

Coding question for those who write their own nodes. Every time I try to run a node with the (a,b) = vs.TrueTypeToPoly(text) the program crashes - has anyone run into this/has any suggestions? I've attached a simple sample node that creates text and then uses the above command to turn it into poly lines. It doesn't crash if I don't try to assign the output to the tuple (a,b), but also doesn't convert the text.

 

Thanks,

 

Naomi

text test.vwx

Share this post


Link to post

TrueTypeToPoly take a handle pointing to the text name a block of text as a parameter.

 

This seems to run:

 

(a,b) = vs.TrueTypeToPoly(vs.FSActLayer())

 

This creates a group containing the polygonized text. You probably need a vs.Redraw or RedrawAll to get the display right.

 

Be careful about passing a nil handle. When I did it crashed VW to the finder.

 

HTH

Share this post


Link to post

Aha, didn't know there were different ways to grab the handle for the created text. The node would run once but crash on the second time for some reason with

(a,b) = vs.TrueTypeToPoly(vs.FSActLayer()). Did some playing, this combination seems to be the winner:

 

text = vs.CreateText('hello')   

(a,b) = vs.TrueTypeToPoly(vs.LNewObj() )

self.Params.out.value = b

 

Thanks!

 

Naomi

 

 

Share this post


Link to post

Great!

 

There are lots of different ways to get handles to objects and if you are going to do much scripting, handles are one of the most important aspects of PythonScript (VectorScript) to wrap your head around.

 

Ask again if you need more help.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...