ahedley Posted September 22, 2016 Share Posted September 22, 2016 Has anybody tried to use vs.AngleVar(). I tried to convert the example from the function reference into python to no avail. Quote Link to comment
twk Posted September 22, 2016 Share Posted September 22, 2016 Probably won't work with Python. From the Description on the DevWiki http://developer.vectorworks.net/index.php/VS:AngleVar Quote Description Sets the angle designation method in VectorScript. When called, VectorScript will treat language symbols which can be interpreted as direction angles (e.g., N, S, NW, SE) as variables rather than angles. "Sets the angle designation method in 'Vectorscript'.." I believe that explains it. Looks like this function is Vectorscript specific. Funny that it has a equivalent Python function. Quote Link to comment
ahedley Posted September 22, 2016 Author Share Posted September 22, 2016 Thanks for the reply. I figured as much. Is there a way (simple) to use distance angle in python ? Quote Link to comment
MullinRJ Posted September 23, 2016 Share Posted September 23, 2016 Define "simple". Try this in place of vs.LineTo() when you want to enter distance and angle. def LineToAng(D, A): # works like LineTo() with a distance and an angle (in degrees) as input X, Y = vs.PenLoc() A = vs.Deg2Rad(A) vs.LineTo(X+D*vs.Cos(A), Y+D*vs.Sin(A)) Use it without the "vs." prefix like this: vs.MoveTo(0, 1) LineToAng(3, 30) # from current point draw a Line 3 units long at 30° HTH, Raymond Quote Link to comment
Dieter @ DWorks Posted September 23, 2016 Share Posted September 23, 2016 You could use http://developer.vectorworks.net/index.php/VS:ValidAngStr, which converst a string into a float angle. The same goes for distances in python, you can't use string, but they can be converted. I put this into dlibrary, so we can use strings like '5m', have a look, you should do something similar for angles: https://bitbucket.org/dieterdworks/vw-dlibrary/src/ac2110e58529cb69cede4a04a94219fc38634fd0/dlibrary/document.py?at=master&fileviewer=file-view-default Quote Link to comment
ahedley Posted September 23, 2016 Author Share Posted September 23, 2016 Raymond thanks I've done a lot of those sin , cos gizmos over the years to appreciate their simplicity Thanks Dieter for your solution I'll try both and see what I come up with. 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.