ahedley 0 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 Share this post Link to post
twk 236 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 Share this post Link to post
ahedley 0 Posted September 22, 2016 Thanks for the reply. I figured as much. Is there a way (simple) to use distance angle in python ? Quote Share this post Link to post
MullinRJ 211 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 Share this post Link to post
Dieter @ DWorks 24 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 Share this post Link to post
ahedley 0 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 Share this post Link to post