Jump to content

Converting two points to a vector


Nik

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
Link to comment

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

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