DeleteRows in Table

One quick correction: it’s a property, not a method. I’m being pedantic, but the terms do matter in this case. With that said, the InternalDBObject and InternalObjectId properties are not properties of AutoCAD objects, but rather the Dynamo objects that encapsulate them. You won’t find anything related to Dynamo in the AutoCAD or Civil .NET API docs. For that matter, there is basically no developer documentation for the Civil 3D implementation of Dynamo. That doesn’t mean that it’s a total black box, however. You can still browse the DLLs and look at all the members to start understanding the class hierarchy. I use Visual Studio for all of that. So to the last part of your question, you wouldn’t know that it exists without (a) someone telling you, (b) digging through the DLLs to find it, or (c) using the Python dir() function.

The first answer should clarify some of this. It has “internal” in the name because the Dynamo wrapper class encapsulates the internal AutoCAD object, so it’s just a convention to put “internal” in the property name so it’s descriptive. And then the answer to the question above is no, it would actually be somewhat counterproductive to cast a derived class (e.g. Table) to a base class (e.g. DBObject) because then you would not be able to access any of the members specific to the derived class.

You can only use the UpgradeOpen() and DowngradeOpen() methods to change the open mode of an object that has previously been opened. So if it applies, then it’s just a little cleaner to write. If all you have is an Object ID, then you need to use Transaction.GetObject in order to retrieve the object from the database. And to be completely correct, the use of DowngradeOpen() is technically not needed in this case because the object’s open state will be cleaned up when the transaction is disposed. I just wrote it out of habit.

No, db.Table will throw an exception because a Database object has no property called “Table”. The correct way to write what you’re trying to say is…

Table.Property

or…

Table.Method()

where Table is an instance of a Table object.


A few more notes. If you’re planning to start digging more into this, I highly recommend using a real IDE such as PyCharm or Visual Studio for development and transitioning away from using the Python node in Dynamo. It’s going to be a lot easier to learn by taking advantage of tools for code completion, object browsing, refactoring, etc. Code Completion/IntelliSense alone will save you hours of time trying to figure out which members are valid for a given object. Some might argue otherwise, but that’s my recommendation.

3 Likes