Jump to content
Developer Wiki and Function Reference Links ×

Convert REAL to inches in Vectorscript


Recommended Posts

I am writing a small script to create Shell Solid for a selected object. The current Document Settings units is in decimal inch. 

 

In the below script, I want to create a shell solid at 2" thickness. However, after running the script, the shell object thickness is at .079". Is there a way to convert REAL number to the correct unit in inches?

 

h = vs.FSActLayer()
vs.CreateShell(h, 2)

 

Thanks

Screenshot 2024-02-14 075939.png

Screenshot 2024-02-14 075930.png

Link to comment

Just flagging that this is in the VectorScript forum, but your code is in Python. This is one of the few things that VS does more easily: you can just specify units, i.e. CreateShell(h, 2”). 
 

In Python you have to do unit conversions. vs.ValidNumStr is the most robust
https://developer.vectorworks.net/index.php?title=VS:ValidNumStr

 

Just to throw a wrench in things, I believe some functions always take millimeters, and this may be one of them. Best practice there is to retrieve the units per inch preference, and convert input numbers into millimeters. 

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