Bring code block line to autocad model

A query how I can bring this line to autocad model using code

image

p1=Point.ByCoordinates(0,0,0);
p2=Point.ByCoordinates(5,5,0);
L= DesignScript.Line.ByStartPointEndPoint(p1,p2);

PYAUTOCAD

#LINE
from pyautocad import Autocad, APoint
acad = Autocad()
p0 = APoint(0,0)
p1 = APoint(1,1)
Linea1 = acad.model.AddLine(p0,p1)
acad.app.ZoomExtents()

Try Autodesk.AutoCAD.DynamoNodes.ObjectByGeometry with inputs for the line and then the model space block.

Also FYI you can always create the sequence of nodes that you need first, then select them all and right-click somewhere in the background preview and select “Node to Code”. That will convert everything into the equivalent lines of DesignScript within a code block.

4 Likes

@mzjensen Great!!
you are a genius, thanks for the answer so done, these little details help a lot.

1 Like