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

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