I’m having trouble with getting geometries created in Dynamo through Python scripts to show up in Civil3D. I’ve created points through a python script which show up in Dynamo, however doesn’t seem to appear in Civil3D.
Image showing Python script.
Here’s the complete python script used to generate the points:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
list = IN
rec_list = list[0]
rectangle_list = []
for rectangle in rec_list:
corner_list = []
rectangle_list.append(corner_list)
for corner in rectangle:
corner_list.append(Point.ByCoordinates(corner[0],corner[1],corner[2]))
OUT = rectangle_list
I assume you want them to be points or geometry in Civil 3d, so if you close dynamo and save the dwg file they would still be there.
If this is the case then you need to create Autocad/civil 3d Points/geometry instead of Dynamo versions which is what the Protogeometry is. There is a difference, i am sure there is some examples on this forum for how to create civils objects within Python.
For a generic catch what we can, look into the Object.ByGeometry node.
Sadly with DWGs we often has to specify which object type we want the DWG to have, in which case you need to think though the object type and use a constructor for that object. So if you wanted to build a PolyLine2D of the objects you have in Dynamo, look for that class in your library (unless it is a Civil 3D only thing you will find it in the AutoCAD section of your library), and place one of the constructors there (the items with a green or the adjacent line). The specific inputs for the selected node may require you pull data from the current Dynamo object (i.e. points from the curve), but this should get you started.
Thank you! So in other words, there’s another version of this which I should use? If I understood correctly.
clr.AddReference('ProtoGeometry')
I would suggest you have a read of the following and try to fully understand differences etc
Python and Civil 3D | Dynamo
Cheers, I’ve come across this already but I didn’t quite understand it to be honest. I’ll give it some more time this time around.
Cheers I’ll have a look around