I’m trying to create a script that will construct a table with a data reference to an excel. But calling Autodesk.AutoCAD.DatabaseServices.Table() or just table() fails. Calling the full path, it says it doesn’t know what Autodesk is; calling just Table, the warning says it has no public constructor. My guess is that the Table class is not exposed, but I wanted to ask to confirm here!
Typically the code error in these cases is at the imports.
No one can confirm until you post the formatted code (put three carrots in before you paste it or use the preformatted text option when pasting), and confirm which version of Dynamo for Civil 3D and which Python engine you have configured for use.
As a minimum, your code will need the following lines
import clr
clr.AddReference("AcDbMgd")
from Autodesk.AutoCAD.DatabaseServices import Table # or use * which imports all
Using Table() should create the table object or try Table.Table() - see API documentation here
Sorry for the delay! Everyone, I do have the correct references in. I am using Iron Python 2.7 2.5.0 (though the issue is the same seemingly with all python versions)
So far the issue has appeared to be none of these - here are my imports, the defaults when you create a python script node with one caveat
You’ll notice I have included this “as acDB“ call. For some reason, when I call just table(), it fails. if I write out the database path, it also fails. but writing “acDb.Table()“ succeeds. Idk why
Here’s another forum where I talk about the same problem:
Solved: Re: Python cannot call table constructor (Dynamo Node) - Autodesk Community
As for not using the built in nodes to accomplish the task, I need a solution that can do a batch run through an excel file sheets (new table for each sheet) and have them data linked. I probably do not know dynamo well enough but idk if there are nodes that can do this
This issue here is that you are loading in the Table Class from two namespaces
Autodesk.AutoCAD.DatabaseServices and Autodesk.Civil.DatabaseServices
See here and here
Python will overwrite the class definition from AutoCAD namespace with the Civil class (and any others with the same name) and this is why it is generally frowned upon to do asterisk imports - you have no idea what is being imported and type checking becomes extremely difficult if not impossible. If you imported the namespaces in a different order the opposite would be true
So how do you get around this?
- Only import namespaces (and classes) you are using
- Alias the AutoCAD
Tableclass withfrom Autodesk.AutoCAD.DatabaseServices import Table as AcadTableand use that to create the table
To this point, why do they start the initial python script with both of these fully imported? This is a completely blank new python node script - comes with both database libraries loaded. I did not intentionally place both libraries here. I am aware that you shouldn’t generally do the * import but hell it works, most of the time ![]()
I think this is a small oversight where they try to make things easy for the user to start coding, but ends up with these edge cases where things become a problem. I tested your solution, both IronPython & Cpython - yes when you have the civil Database library it fails
Yes ![]()
You can customize the starter template if you like. It’s in C:\ProgramData\Autodesk\C3D <version>\Dynamo. And if anyone has suggestions for a better/more effective template, we can always change it.



