The Hamma Posted May 30, 2019 Share Posted May 30, 2019 I have attached a file with two scripts in progress. It is a script that I was developing to replace circles with hexagons. The first version doesn't work as expected. It creates the hexagons but they are 1/25.40157 sized and location from the origin. I modified the script to multiply the X,Y coordinates by 24.40157 and the size. This places the hexagons in their proper location and size. It seems that the script is converting the units to mm from inches. If I set the drawing units to mm the first script works Script Error.vwx Quote Link to comment
Julian Carr Posted May 30, 2019 Share Posted May 30, 2019 You must specify units when nominating a size in a script, so this line: RegularPolygon(Px,Py,12,6,1); should be something like: RegularPolygon(Px,Py,12",6,1); or RegularPolygon(Px,Py,12mm,6,1); Quote Link to comment
JBenghiat Posted May 30, 2019 Share Posted May 30, 2019 The native units for VW is in mm, and some functions will only return mm. (1" ~= 25.4mm). In VS, you can specify units when assigning values to reals, e.g. w := 6"; Otherwise, VW can be inconsistent. Quote Link to comment
The Hamma Posted May 31, 2019 Author Share Posted May 31, 2019 Yes, I did try adding the unit to the script but that does not work either. The size and the location of the created polygon are still 1/25.4 scaled. Quote Link to comment
The Hamma Posted May 31, 2019 Author Share Posted May 31, 2019 This modification corrects the issue but it seems to me that if the points are read from HCenter as inches then they should be passed to RegularPolygon as inches. HCenter(h,Px,Py); RegularPolygon((Px*25.4),(Py*25.4),(9*25.4),6,1); Quote Link to comment
MullinRJ Posted May 31, 2019 Share Posted May 31, 2019 6 hours ago, The Hamma said: This modification corrects the issue but it seems to me that if the points are read from HCenter as inches then they should be passed to RegularPolygon as inches. @The Hamma , That would make perfect sense, but RegularPolygon() is one of those procedures that always takes its input as mm, and not document units. So, YES, you have to scale the inputs to be mm before calling RegularPolygon(). Unfortunately, the documentation does not reflect that. Welcome to the quirky world of VS programming. : ) Raymond Quote Link to comment
J. Miller Posted March 27, 2020 Share Posted March 27, 2020 This is kooky. I wonder why it only accepts input as mm. It completely ignores any measurement designation ( ", ', mm, m). The documentation requires updating for sure. Jeff Miller 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.