Jump to content
Developer Wiki and Function Reference Links ×

Marionette object as resource & other questions


Recommended Posts

Hi everybody,

 

I'm trying to create a custom lighting position label using marionette. I have a label that I have been using, but it's just a group of objects that I have to edit when I want to change the text. My goal with the scripting was to create an object that would scale by itself based upon the length of the entered text. I also wanted to be able to select from a dropdown menu where on the object an arrow would appear. Finally, I want this to be insertable as a type of plugin object or something similar. At this point I have achieved the first goal, but not the second or third.

 

I have two questions:

 

  1. How can I get the dropdown menu behavior? I want to have one script that I can change options on rather than five different styles that I have to choose from.
  2. How can I turn this script into a resource that I can insert into a drawing from the resource browser rather than having to copy and paste a marionette object multiple times.

 

I have attached a file with what I have created so far. It also has some of my original labels in it as visual reference, and my attempt at a combined object. Thanks for any help!

Position_Label.vwx

Link to comment
  • Vectorworks, Inc Employee

Hello @Mandolomo-

 

I see that you are using an educational version of Vectorworks but it is v 2016. I would recommend upgrading to 2017, because Marionette is much easier to use - mainly because there is now a search function in the Resource Manager which allows you to search for nodes by name, as well as the nodes are in page units, so you can scale your drawing and the nodes will remain page size.

 

I would recommend using the Get Rectangle Node in the Objects-Rectangles category to get you a position on your object. Even if you object is not a rectangle, it will give you the bounding box of the object so it will still work

 

I have attached a doc that has a Popup node that you can edit. Just double click on the node and read the grayed out lines inside for instructions.  Popup.vwx

Link to comment

Hi@sbarrett,

 

Thanks for the popup node. I'm having trouble getting the dropdown list to change in the OIP. I can edit the node, but the changes don't seem to affect anything being displayed. I'm also not sure how to incorporate the popup node into this network for the functionality I'm looking for.

 

How do you suggest that I incorporate the Get Rectangle Node into my script?

 

Is there a solution to my insertion question? Thanks for your help!

Link to comment
  • Vectorworks, Inc Employee

I reworked your network a bit - instead of creating the rectangles and arcs and then moving them based on the position of the text, I used Get Rectangle nodes to get the different control points of the text box and had those points be the starting points of the rectangles and arcs. I wrote a custom node that draws a rectangle from a width and height and center point. I then added the pop up node - basically whatever list you give it, the output is the index value of that list. So if its the first item in the list, the output is 0, the second item, the output is 1, etc. You can then use the Get Item node with a list of values (corresponding to the list in the Popup node) and then feed the Popup node to the Index input of the Get Item node. I set up the network so you can use the popup to choose left, top, right, or bottom for the arrow positions.

 

If you want to make it a resource, all you have to do is select the Marionette object, go to Modify - Create Symbol... and make sure that Convert to Plug-In Object is checked. Then it will be available in your resource browser just like any other object.

 

Position_Label_Combined.vwx

  • Like 1
Link to comment

Thank you so much for this! I didn't know about the filter nodes. They make a lot of sense for what I was trying to do. This method of arranging the objects also makes way more sense than trying to create mulitple objects and the deleting duplicates at the end of the network. As far as the resource issue, I was missing the Convert to Plug-In Object step.

 

I've changed some small things with the network to match my needs a little better, and I only have one last question. I want to adjust the text justification based on which arrow style is selected. I know how to link the popup node to the Horizontal Justification input of the text properties, but I'm having trouble with getting it to do anything. It seems as though changing the justH value (even manually) doesn't actually do anything to the text. Am I missing something obvious?

Position_Label_Combined.vwx

Link to comment

@MandolomoWelcome to the wonderful world of Marionette. It is great to see how others are using Marionette and how they manipulate the nodes to meet their needs.

Keep posting here as Sarah and Marissa are so knowledgeable and extremely helpful and you will learn heaps from them. Looking forward to more to view and follow.:) 

Link to comment
  • Vectorworks, Inc Employee

@Mandolomo  I don't know if changing the text's justification will help much because the network is set up so that the text box is only as big as the text inside. Changing the horizontal alignment will change the position of the entire text box - if you make the text box bigger then the justification will change the way you want it to.

Link to comment

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.

×
×
  • Create New...