Jump to content
Developer Wiki and Function Reference Links Read more... ×
willofmaine

Prefix & Suffix for Marionette Text

Recommended Posts

Is it possible to add prefixes and/or suffixes to the text (numeric values) displayed with a Marionette object?  Attached is my "Attic Ventilation Calculator," which basically lets you draw the plan shape of a ventilated attic and then, based on the NFA of ridge and soffit vents, calculates how many linear feet of each of those is required.  Rather than just displaying 100.00, 2.67 and 5.33, I'd like to make it display something like this:

 

Attic Area: 100.00 SF

Minimum Ridge Vent: 2.67 LF

Minimum Soffit Vent: 5.33 LF

 

Thanks!

 

 

03-Attic Ventilation Calculator-02.vwx

Share this post


Link to post

Only if you convert the Number to Text and concatenate it all together.

 

The Text node lets you add a prefix and suffix to a string. It will also take a Real value (number) as the string input and give you what you are looking for.

Share this post


Link to post

or you can use the data part of the OIP. A long time ago (April 2016) with Marissa's help I made this script. Now not only the names appear but I can use the figures in the data base. The post was name 'Data base and OIP'

rail script.vwx

Share this post


Link to post

@Pat Stanford- I couldn't get what you're suggesting to work; I need to play with it more, which I want to do because I'd like to get a better understanding of the whole lists and concatenating thing...

 

@the frog- I don't fully understand your script yet, however, I did see something in it that actually let me accomplish one possibility I'd considered for labeling the numbers in the Marionette object with separate, fixed-text prefixes: evidently, a "Pass" node can be used to combine two otherwise unrelated networks as a single network!(?).  See attached.  So, thanks for that!

04-Attic Ventilation Calculator-03.vwx

Share this post


Link to post

Sorry to take so long to reply. Our youth soccer program is kicking off and just about imploded on Thursday. I have been head down to try and keep 900 kids happy and playing ever since.

 

The Text node seems to automatically convert a number (real) to text and concatenate a prefix and a suffix.

 

Almost too easy.

Screen Shot 2017-09-04 at 12.09.42 PM.png

Share this post


Link to post
On 9/5/2017 at 10:11 AM, willofmaine said:

Yes, very easy.  So how come it won't work in a larger network?  The prefix displayed with a Marionette object seems nonsensical.

 

To explain what is happening in the video, when you use the Text node, you are converting the number and strings of the prefix and suffix to a Vectorworks text object. If you debug the network, you would see that the info going from that list would consist of a Vectorworks handle, and two numbers. What is being printed by the Print List node is the unique name of the handle, not the strings that make up the text object. For this example, I would use a list node to list your prefix, number value, and suffix, then send that through a Str node to create a single string, then add it to the list that you send to the print list node.

 

I hope that helps!

 

Edited by sbarrett

Share this post


Link to post

Hi Sarah, thanks for your response & explanation.  I guess I really need to get a handle on, well, handles, strings and names.  In Pat's example, the Text node appears to spit out the Prefix, Number, and Suffix as expected.  But in my network I guess it instead spits out the Handle for the Prefix, but then the Number and Suffix as expected?  I attempted to do what you suggested, but I'm not quite getting it.  What is the "Str" node?  Thanks!

Share this post


Link to post

@willofmaine

 

I'm going to offer an easier way to solve this without having to mess up your existing network too much - after your "Text" node, use the "Get String" node.

getstring.PNG

I'll also try to explain better what's going on with your current network.

Your text node is creating a Vectorworks text object, which is not a String type variable, which is what you really want. The Get String node that I am proposing will take the String variable that exists inside of that text object and pull it out just so you get the characters that make up that Text Object. The text object that you created gives a 'handle' (or a unique identifier for an object in your document) rather than the string because we use that handle to edit that specific object (for example, move, resize, change the text inside, etc.) Hopefully that makes at least a little bit of sense, but if it doesn't I'd be more than happy to get further into it (maybe even with a graphical demonstration ;) )

Share this post


Link to post

With Marissa's example, I believe you would have to attach a Delete node as well as the Get String node to the Text node. The reason is that both the Text node and the Print List node are create Text Objects and you only need the one being created by the Print List node.

Share this post


Link to post

Ah... okay.  So a text object is distinctly different from the text that it contains (i.e., its "string" of characters).  And the List node can't make any more sense out of a text object than it could make out of, say, a rectangle or a square (though it does "try," and at least pulls the text object's handle, which is a string...).  I think I've got it!

 

So I updated my network accordingly, and it seemed to work, even without the Delete node suggested by Sarah (maybe the duplicated text objects just stacked on top of each other?).  But when I added the Get String node (in my "Convert Text to String" wrapper) to the other two text objects, I ran into some odd behavior: when wrapping the network, it included unexpected inputs, and the Marionette object created with it didn't work as expected (no prefix or suffix for the second and third text objects).  So, I went ahead and added the Delete nodes (included in the attached file), but still had the same problem.  I have since concluded that the first time the network is copied and wrapped, things go awry, but the second time it's copied and wrapped, all works as expected (even without the Delete nodes).  Is this not a bug?... See attached movie.

 

Progress!  (Bugs (or not) aside...).  So Thank You!

 

 

11-First_Wrap_Fails-06.vwx

12-First_Wrap_Fails-11.mov

Share this post


Link to post

It looks like the first time you selected the network, a few of the string nodes didn't get selected with it, and the inputs that SHOULD have been connected to are the ones that showed up on the outside of the wrapper. I haven't been able to replicate that however.

 

Your next step could be to start experimenting with the Set Text Properties and Set Character Properties nodes to position and format the text within the box.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×