tomcee Posted November 29, 2022 Share Posted November 29, 2022 Hi Attached is a script to recreate our company name and logo that is font size controllable and font independent. End goal is this to be an object node. The script works until I wrap the script then only the converted text objects are output and not the geometry. I think it has something to do with the "Convert To Poly Group" node as when I exclude this from the script the text and geometry work in the wrapper. Anyone have an idea what might be going on? Simplified version of script attached. Thanks! Logo In Marionette v02.vwx Quote Link to comment
Pat Stanford Posted November 29, 2022 Share Posted November 29, 2022 The size calculations are note able to calculate based on the text converted to polygon group. Move the BoundingBox, Height and Width node inputs to the Set Char Properties node instead of after the Convert to Poly Group node. Quote Link to comment
tomcee Posted November 29, 2022 Author Share Posted November 29, 2022 Thanks Pat. Any idea why it doesn't work in a wrapper? Unfortunately the text box doesn't give me the alignment I need however I did find a work around: by grouping the "Convert To Poly Group" output it now wraps and works as expected. Logo In Marionette v03.vwx 1 Quote Link to comment
Pat Stanford Posted November 29, 2022 Share Posted November 29, 2022 In Vectorworks scripts, there are a number of things that don't actually exist until the script finishes. Apparently the conversion of the text to poly lines is one of those things. Since the converted poly lines don't exist, the height and width of the rectangle are zero when inside the wrapper. My guess is that by putting them into a group it "forces" the calculations of the size to be completed immediately instead of waiting until the rest of the script runs. But that if purely a guess on my part. I just know that it can be very difficult to create a new object in a script and then do anything to that object in the same script because the values that you want to calculate with don't exist yet. Glad you found a work around. 1 Quote Link to comment
DomC Posted November 29, 2022 Share Posted November 29, 2022 (edited) This kind of behavior is quite common. Often we need a "ResetObject" or a "ResetBBox" after some commands. I would not say this is a Bug or an error because it can be smart to not reset and recalculate everything in every single Node/Step of a script to keep it fast. The "GroupNode" resets the BBox. Also the Geometry-Grouping of Marionette Network resets the BBox of the PolyGroup by accident. You can reproduce the same behavior with a Script. h = vs.FSActLayer() num, polyGroup = vs.TrueTypeToPoly(h) bbox = vs.GetBBox(polyGroup) vs.AlrtDialog(str(bbox)) vs.ResetBBox(polyGroup) bbox = vs.GetBBox(polyGroup) vs.AlrtDialog(str(bbox)) The vs.TrueTypeToPoly() returns a group with zero size Bounding Box. We have to first reset the bbox to get the bbox size correctly. Or in the Script: Unfortunately, resetBBox (also ResetObject which is also a common needed Node) are not part of the standard Node-Content. Edited November 29, 2022 by DomC type errors 3 Quote Link to comment
SedlmeierGuenther Posted July 22 Share Posted July 22 Hey DomC, how do I get the Node ResetBBox Greetings Günther SEdlmeier Quote Link to comment
Letti R Posted July 22 Share Posted July 22 (edited) Hello, to get the "vs.ResetBBox(h)" function within a Marionette node you can write the node with a bit of Python code by replacing the code in any node with the code below. @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( 'vs.ResetBBox(h)' ) this.SetDescription( 'vs.ResetBBox(h)' ) #Input Ports x = Marionette.PortIn( vs.Handle(0), 'h' ) x.SetDescription( "input" ) #OIP Controls #Output Ports y = Marionette.PortOut('h') y.SetDescription( "output" ) #BEHAVIOR #this.SetListAbsorb() def RunNode(self): #inputs x = self.Params.x.value #script vs.ResetBBox(x) #outputs self.Params.y.value = x Another way would be to create your own "node" by using the "function" node within a wrapper. Therefore you have to write the Python function "vs.ResetBBox(x)" into the OIP of the "function" node and wrap a small Marionette that looks like this: You can now use this wrapper like @DomC uses the "ResetBBox" node in his Marionette. Regards, Letti Edited July 22 by Letti R 1 Quote Link to comment
DomC Posted July 23 Share Posted July 23 Agree with Letti I would vote for the smart solution using the function node without wrapping. Quote Link to comment
Recommended Posts
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.