Jump to content

vs.AngleVar()


ahedley

Recommended Posts

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.

Link to comment

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

 

Link to comment

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

 

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...