MaxStudio Posted April 4, 2013 Share Posted April 4, 2013 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 Quote Link to comment
Vectorworks, Inc Employee klinzey Posted April 4, 2013 Vectorworks, Inc Employee Share Posted April 4, 2013 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. Quote Link to comment
MaxStudio Posted April 4, 2013 Author Share Posted April 4, 2013 thanks i'll give it a try Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 4, 2013 Vectorworks, Inc Employee Share Posted April 4, 2013 This might be a bit obvious, but also make sure to use the parameter type of "dimension". Quote Link to comment
Hippocode Posted April 5, 2013 Share Posted April 5, 2013 (edited) 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 April 5, 2013 by hippothamus 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.