Jump to content
Developer Wiki and Function Reference Links ×

Create Classes


Recommended Posts

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.




Link to comment

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.

Link to comment

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.


Link to comment
  • Marionette Maven


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.


Link to comment

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.

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.

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...