Running Python Code in an external IDE to interact with Civil3D

Hi all! This is very closely related to this post : Interacting with Civil3D in an external IDE
From what I’ve gathered, the pyrevit API works great as there is a run command allowing users to open Revit and run code from inside the Revit environment, and I am looking for the same sort of solution for Civil3D.

I’ve had success with using CADPythonShell and using IronPython from within the Civil3D environment. The challenge is being able to run code externally and automatically. I have resorted to using pyautocad and pythonnet in order to interface with AutoCAD (Civil3D) from the windows command line, not using Dynamo at all. There are many limitations that exist here, mostly due to the fact that there is no “real” access to the underlying database of CAD. There is also no access to the Civil namespaces and for some reason in certain cases, no access to the properties for objects (example is, I can’t extract the obj.WallThickness for Structures, it just throws an error). Is there any update to the request of running python externally? What is the cleanest way to interact with multiple drawings automatically and running python scripts to extract information?

1 Like