Jump to content
ahedley

vs.AngleVar()

Recommended Posts

Has anybody tried to use vs.AngleVar(). I tried to convert the example from the function reference into python to no avail.

Share this post


Link to post

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.

Share this post


Link to post

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

 

Share this post


Link to post

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

 

Share this post


Link to post

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.

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...