Dynamo API method to wrap InternalDBObject

Has anyone come across the method in the Dynamo API that wraps the InternalDBObjects from the current document (.dwg)? I understand how to unwrap proxies in Dynamo using Python but was hoping to do the opposite.

@Alex.ColeAAFHE what do you mean exactly? You want to return the proxy?

I’m using Python to select objects by opening a transaction and calling the GetObject method. From here I’d like to wrap the object from .dwg into a proxy. ie convert a Alignment from C3D .net api to a an Alignment in Dynamo

OK, you can try with Object.InternalMakeObject(DBObject entity, bool isControlledByDynamo)
This is the method on the base class, perhaps you can use also the ones inherited by the subclasses for a proper casting to different types.

Object is Autodesk.AutoCAD.DynamoNodes.Object

Awesome - I will give that a try :grinning:! Is there some documentation for that method somewhere?


so I’m able to create the Autodesk.AutoCAD.DynamoNodes.Object - how do I cast it?

@Alex.ColeAAFHE first, in Python you don’t cast, second use SelectionByQuery.GetObjectByObjectHandle(string handle)

is SelectionByQuery in the AutoCAD .net api? or is that from Dynamo API?

Dynamo for AutoCAD

Thanks for your help it works!


Hi Alex, could you show me or send me your python script? I’m getting the output: “Autodesk.Civil.DynamoNodes.CivilObject” and I want a “Autodesk.Civil.DynamoNodes.PipeNetworks.PipeNetwork”.
I saw that you managed to change a CivilObject to an Alignment.

That pipe network class comes from the Civil 3D Toolkit, so you’ll need to add a reference to that.


Thank you very much!
I am trying to understand the API and use Python Script because sometimes some nodes are given the same input type name but if I pass the same object to these nodes some will work and some will not and it makes me confused. So as a solution I thought about using only the Civil3D root objects but they also don’t work with nodes because I can only use them in the format “Autodesk.Civil.DatabaseServices” or “Autodesk.Civil.DynamoNodes” (as Civil Object)

If you’re going to access the members in the API, then you need to use the objects from the DatabaseServices class. But if you’re using the Dynamo nodes, then everything should inherit from the CivilObject class. I’m not sure exactly how Paolo set everything up in the Civil 3D Toolkit, but I would expect that most things inherit from CivilObject (at least for C3D objects, not AutoCAD).

1 Like