Jump to content
Nik

Converting two points to a vector

Recommended Posts

Having trouble getting vectorscript functions that require a vector as parameter to work properly. In the snippet of code below, I think that ang should equal 45°.  But the dialog tells me -90° and then I get the error shown in the attached file:

pt= [1,1]
ang = vs.Vec2Ang(pt)
vs.AlrtDialog(ang)

Screen Shot 2016-10-07 at 08.20.12.png

Edited by Nik

Share this post


Link to post

From the developer.Vectorworks.net: If Vect is {0,0,0}, Vec2Ang returns -90.  Your vector input is incorrect, so you are getting the default return value.

 

Vectors represent three dimensional space, so require three points.  If you are dealing with a plane, just use 0 as the z coordinate.

 

Also, vectors are represented by a tupple, not an array.  So what you want is:

pt = (1, 1, 0)

-Josh

Share this post


Link to post

Awesome! Making the switch from vectorscript to python is a bit of a challenge!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×