Jump to content

Vectorscript Objects

Recommended Posts

How can I create a parametric object with Vectorscript?.
For example, I want to create a rectangle that has a certain figure inside but which can use that figure as a symbol and which can change the parameters in the object information palette.

I want to create this figure as a symbol and have parametric properties to change each point independently.




Link to comment

I would like to learn how to create a parametric object by script (I'm not sure if it can be done) because I want to learn how to create parametric objects first, whether using phyton or Vectorscript before learning Marionette

Link to comment

You’ll need to start by creating a parametric object in the plug-in editor in the tools menu.

You could create a rectangular object, that’s one of the options. In the same plug-in editor you can also add parameters and add the script. That can be Vectorscript or Python.

you can also import an external file into that script. That external file can then hold the main part of the script.

Link to comment

Vectorscript, which is itself based on an old language called Pascal, can be a bit obtuse (the biggest hurdle I had coming from Java and Python was figuring out how to properly use handles), but there are a lot of code examples that can be found on the online wiki as well as the offline Function Reference.  On a Windows machine, that function reference is stored in C:\Program Files\Vectorworks ####\VW Help\Script Reference\ScriptFunctionReference.html.  I assume it's stored in a similar manner within the application folder on a Mac.  While I'm working on scripts, I always have it open somewhere, usually on a second monitor.  It's faster to navigate than the online wiki, and you don't need a connection for it to work.


For Python, there are a ton of online resources to teach yourself the language, but the implementation in Vectorworks is a bit tricky.  You will still need to use the commands found in the Function Reference to interact with VW, but you will gain far greater control in terms of how you handle data.  I learned Python several years before it was available in Vectorworks, and by the time they implemented it, I was more comfortable with Vectorscript, so that's primarily what I work in.


If you do want to go through the process of learning Vectorscript, an excellent starting point would be the Vectorscript Language Guide, which used to be part of the main VW help but has since moved off to this separate document.  It's what I used to teach myself back in 2010, and it's pretty easy to follow as far as these things go.

Link to comment

But at least Vectorscript is not white space delimited where a single extra space can completely change how a program acts. 😉


Give me the extra typing of Begin/End any day over having to get spacing correct. I though I had seen the last of that when I finished my Fortran class in 1983.

  • Like 1
Link to comment

@Pat Stanford No kidding, Python can be a huge pain to debug because of the incredible freedom it gives you and it being a run-time language.  For all its rigid quirks and archaic rules, Vectorscript is at least pretty forgiving and easy to debug (as long as you don't cause a memory leak leaving out a parenthesis in a ForEachObject call...), especially after 2016 when they finally added in line numbers to the IDE.


@Arielus Putting "Vectorscript" into the search field in YouTube does yield some results, but there doesn't appear to be a full tutorial.  Coding in general is something that I think video tutorials are not super great at, as scripting is a written medium as opposed to a visual one.  If you are looking for a more visual focused method of object creation, I would suggest trying out Marionette, of which there are several training videos from Vectorworks (like this one here).  I find Marionette clunky and slow since I can type much faster than clicking and dragging variables around, and Marionette objects run slower than scripted plug-in objects (though this did start getting much better starting in VW2020).


I think jumping in to Vectorscript without any coding experience might be a bit daunting, especially because of its relative lack of "beginner friendly" documentation.  I would suggest looking into an online course for a more common language to learn the basics of coding such as C, C#, or Java.  Python is a tricky first language because of the way it "bends" a lot of the rules of programming.  It was designed as a language that could be picked up in a day with any experience in coding, but it could teach you some bad habits that would hamper you in working with other languages.

Link to comment

For a relatively high level explanation of Vectorscript, see this thread in the Resource Share - Vectorscript forum.


Resource Share is mostly information carried forward from the older version of the forum, but there are a lot of good scripts there.


I try to comment most of the scripts I post to make them understandable and as a learning tool. @Jesse Cogswell@michaelk and many others are all too willing to help with the learning process.


My personal opinion is that Marionette is the best tool to make a parameterized object in VW if you don't have scripting experience. and Vector(Python)script is best if you want to do data manipulation on existing objects. Marionette takes away all of the complexity of getting and using data entered in the OIP that ends up being a lot of the script in most Vectorscript Parameterized objects.


@Arielusfor yoru object above if you are always making a rectangle, you really only need three points. Bottom Left, Top Right, and the center point. I would probably start with a really simple version that is a fixed size rectangle and only work on the code to make the internal polygon. Once I got that working I would then go back and add the code to allow the change in the rectangle size.


Ask again when you need more help.

Link to comment

Perhaps you can look around some more. There is a lot of information available already. It's best for your object to make it with Marionette you can start to look at the Vectorworks YouTube page. Especially the playlist. 


Marionette Mondays playlist:



Marionette tutorials playlist: 



Then there is the Marionette galleryhttps://forum.vectorworks.net/index.php?/files/


And not to forget we have the Vectorworks University with loads of video's: https://university.vectorworks.net/course/index.php?mycourses=0&tagfilter[category]=35&tagfilter[type]=0&tagfilter[difficulty]=0&categorysort=default&mycourses=0&search=Marionette&langfilter[]=0#coursestab


I advise you to check these places first next time you looking for information.


Edited by MarcelP102
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...