I have a question that I am doing wrong in the python code to be able to create a line, I know there are nodes for this I am just trying to understand a little python and I would like to know what the error is
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
def create_line(start_point, end_point):
civil_doc = CivilApplication.ActiveDocument
with civil_doc.LockDocument():
with civil_doc.StartTransaction():
ms = civil_doc.GetDocument().Database.ModelSpace
start = AeccPoint3d(start_point.X, start_point.Y, start_point.Z)
end = AeccPoint3d(end_point.X, end_point.Y, end_point.Z)
line = AeccLine(start, end)
ms.AppendEntity(line)
civil_doc.GetDocument().TransactionManager.QueueForGraphicsFlush()
return line
# Puntos de inicio y fin de la línea
start_point = Point.ByCoordinates(0, 0, 0)
end_point = Point.ByCoordinates(10, 10, 0)
# Crear la línea en Civil 3D
created_line = create_line(start_point, end_point)
# Salida de la línea creada
OUT = created_line