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

##### Link to comment

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

Thanks for the reply. I figured as much.

Is there a way (simple) to use distance angle in python ?

##### 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()
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

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.

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

Reply to this topic...

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• KBASE
• #### MARIONETTE

×
• Create New...