Jump to content
Developer Wiki and Function Reference Links ×

Universal units?


Recommended Posts

When I change the units in my drawings my plugin object changes size. I realize this is because I never specified the units in my script. how do I declare a variable as inches or feet?

my width and height are:

width:=4;

height:=6;

when my document is set to 'feet and inches' it draws it correctly; a rectangle that is 4" x 6"

but when I change my units to 'feet' it draws a rectangle that is 4' x 6'

how do I write the script so the rectangle remains 4" x 6" even when my units is changed to feet?

width:=4";

or

width:=4in;

Thanks in advance

Derek

Link to comment
Vectorscript understands standard unit marks.

width:=4"; {4 inches}

width:=4'; {4 Feet}

width:=4mm

width:=4m

If you just say width:=4 then it is 4 document units.

This might be a bit obvious, but also make sure to use the parameter type of "dimension".

Make sure to do both. If the type is set to dimensions, you can set 4 and 6 as values in your pio tab. If your units change, those 4 and 6 will change to match the new dimension but will keep the same width and height. You can also set the unit mark visable in the document unit settings.

Its like going from 1cm to 10mm.

As described above you can also force a dimension in code, by saying width:=4mm. This will force the length into 4mm, nomatter what your unit setting is, vectorworks will convert it the same way as described above.

Declare the script parameter as a REAL, since 10cm => 0.1m otherwise vw will return 0.

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