Error Message: Unable to add line to document

hi
Why do I give this error when I want to draw a line between two points?3a.py|attachment (379 Bytes)

Hi @arefeepaydar ,
rs.AddLine() takes Guid as arguments, which means you don’t have to coerce.

in Your case
line = rs.AddLine(pt1,move)

1 Like

tanks
But the code gave an error again:((((

import rhinoscriptsyntax as rs

pt1=rs.GetPoint("Pick a point")
#create a vector
vec=rs.coerce3dvector([10,0,0])
#add the vector to the point to create a new point
pt2=pt1+vec
# create a line between the original and the new point
line_id=rs.AddLine(pt1,pt2)

You can also do it like this:

import rhinoscriptsyntax as rs

pt1=rs.GetPoint("Pick a point")
#create a vector
vec=rs.coerce3dvector([10,0,0])
#add the vector to the point and create a line directly
line_id=rs.AddLine(pt1,pt1+vec)
1 Like

Hi
Thank you so much:))))