Drawing a ray or line from a vector
-
I am currently retrieving a vector from sketchup and I am trying to draw a line from that retrieved vector. Is there a way to do this?
-
http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities.php#add_cline
This will give you a construction line defined by a point and a vector. If you want to draw a line segment aka edge you could get the second end point by applying a scaled transformation to your initial point.
-
A vector defines a 'direction', which essentially is not determined in its location in space.
To define an 'edge' you need a start point - let's call it 'point1'...
Then set your vector's length using:
vector.length=length
and find 'point2' for the end point:
point2=point1.offset(vector)
Now you have two points representing the start/end-points of a potential new edge.
Use
Sketchup.active_model.active_entities.add_line(point1, point2)
or
Sketchup.active_model.active_entities.add_edges([point1, point2])Don't confuse edge & line - confusing the API does when adding one edge it calls it a 'line'!
Actually a 'line' is a special geometrical construct of [point, vector], which us infinitely long passing through the point, along the vector. Lines can intersect etc...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement