Jump to content

How to use Parameter/Strings in the Script?


Recommended Posts

The defined params are stored in the ParamRecord which has the name off the ParamObjectType.

 

First you need to get the param rec name, thats saver than hardcoding it:

 

http://developer.vectorworks.net/index.php/VS:GetParametricRecord

 

Put the handle in this function:

 

http://developer.vectorworks.net/index.php/VS:GetName

 

At the end you pass the paramObject, the name off the param record and the Fieldname into this function:

 

http://developer.vectorworks.net/index.php/VS:GetRField

 

 

  • Like 2
Link to comment

I don't know about PythonScript, but is straight Vectorscript it is much easier.

 

Anything that is defined as part of the parameter record can be accessed as a variable in Vectorscript by prepending it with a letter "p".

 

So a Parameter of Length_1 would be used as a variable in the script at pLength_1.

 

Two tricks to this:

1. The parameter variables are only read at the beginning of the script execution and only written at the end, so you can't use them internally as loop counters or use it to access a change made earlier in the script. If you need that copy the data to a script (instead of parameter) variable, use that during the execution and then save back to the parameter variable at the end of the execution.

2. It means you don't want to start your variables in a PIO with the letter p as they will be assumed to be parameter variables.

  • Like 2
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...