ChadL Posted October 10, 2017 Share Posted October 10, 2017 I'm not a scripter, and in my limited research I was not able to successfully do this. I want to create a tool (marionette node, vectorscript, anything) that when I run it it will create a series of classes in the active document. I know what I want all those classes to be, just don't know how to make this script. Thanks, Quote Link to comment
Pat Stanford Posted October 10, 2017 Share Posted October 10, 2017 You don't need a script, you just need a resource. Create a file with all of the classes you want. Create one object in each class. This could be something big or even just a locus. It actually does not matter if you have more than one object in each class, just that there is at least one in each class. Select all of the object and Create Symbol. Name it something like "Create Class Set 1" Store the symbol in your symbol library. When you want the classes imported into the file, just go to the library and import the symbol. Any classes that do not already exist in the file will be created. Of course if you want to learn scripting this could be scripted, but if you just want the end result, this will be much faster than debugging a script. If you do want to learn scripting just say so and we will give you a starting point. Quote Link to comment
ChadL Posted October 10, 2017 Author Share Posted October 10, 2017 HI Pat, thanks for the reply. I have done the resource before, I was using this as a project to start learning scripting. Thanks, Quote Link to comment
Pat Stanford Posted October 10, 2017 Share Posted October 10, 2017 OK. Here is the outline that you need to do this in Vectorscript. Just add NameClass lines as necessary. Ask again if you need more help. Procedure Create_My_Classes; Begin NameClass('MyFirstClass'); End; Run(Create_My_Classes); Quote Link to comment
Pat Stanford Posted October 10, 2017 Share Posted October 10, 2017 And here is a way to do it in Marionette. By wiring each String node to the Dummy End node, you make the whole thing into a single Network that can be run at once. You could Wrap the entire network into a single Node and then save that as a symbol (with Convert to Group checked so it comes back into the drawing as a node that can be run). The class names are typed into the Resouce Browsers for each String node. Quote Link to comment
ChadL Posted October 10, 2017 Author Share Posted October 10, 2017 Thanks, I will play with this. Quote Link to comment
Marionette Maven Marissa Farrell Posted October 11, 2017 Marionette Maven Share Posted October 11, 2017 @ChadL It looks like @Pat Stanford's post doesn't include the Marionette file, so I'm attaching my example here. For each class you want to add to your document, you would define the name in the OIP when a String node is selected. There are many other ways to define the list of names for your classes, but this is the most native. It's also possible to read them from a text file, or you could prompt the user for the names. In 2018 Marionette can create Menu Commands, which I think would also be useful; say you knew you would be using these classes in various projects but didn't want to create a template file. You could store this Marionette Network as a Marionette Menu Command and access it in whichever document you want to add the classes to. Please let me know if you have any questions. Marionette_CreateClasses.vwx Quote Link to comment
Pat Stanford Posted October 11, 2017 Share Posted October 11, 2017 There was a screen shot attached when I posted it :-( Here it is now. @Marissa Farrell solution is much more elegant, but I think both ways show useful information about using Marionette. Quote Link to comment
ChadL Posted October 11, 2017 Author Share Posted October 11, 2017 Thanks, this is super helpful. I played around with this for about 30 minutes yesterday, making me excited again to try to learn marionette. Quote Link to comment
ChadL Posted October 16, 2017 Author Share Posted October 16, 2017 Okay, I've been playing with this and I like it. However, now that I got a taste, I want to go deeper. I have been struggling to create a class and assign it line colors and fill colors without having an object to pull that info from. I think the problem is in how I am compiling my RGB values. Right now I have 3 int nodes with my RGB value, then I've tried using a series node, or an ordered list. Nothing I've done so far sets a color. Quote Link to comment
Marionette Maven Marissa Farrell Posted October 16, 2017 Marionette Maven Share Posted October 16, 2017 A little trick, use the Vec 3D or 3D Vector node for your RGB values. EDIT: Vector, not Point. Quote Link to comment
ChadL Posted October 16, 2017 Author Share Posted October 16, 2017 (edited) I've tried that too. I have 3 int nodes feeding a 3d point node, feeding a set pen color node. AAhhhhh, that is probably the problem, i used 255 Edited October 16, 2017 by ChadL Quote Link to comment
Marionette Maven Marissa Farrell Posted October 16, 2017 Marionette Maven Share Posted October 16, 2017 ALSO. Instead of 0-255, the range is 0-65535. Quote Link to comment
ChadL Posted October 16, 2017 Author Share Posted October 16, 2017 Here is what I currently have. the only Int with a value higher than 0 is the bottom one, which is set to 65535 Quote Link to comment
Marionette Maven Marissa Farrell Posted October 16, 2017 Marionette Maven Share Posted October 16, 2017 With the Set Pen Color node selected, make sure Foreground is selected in the OIP. Quote Link to comment
ChadL Posted October 16, 2017 Author Share Posted October 16, 2017 That did it, Thanks! Quote Link to comment
Vectorworks, Inc Employee SBarrettWalker Posted October 20, 2017 Vectorworks, Inc Employee Share Posted October 20, 2017 If it helps, Here is a color input node that allows you to get rob values based on the fill of the node. I have attached it in Vectorworks 2017 and 2018. 2018: ColorInputNode.vwx 2017: ColorInputNode2017.vwx 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.