I have an issue where i am selecting an object using the SelectAutoCadObjects_Data node from data shapes to select a poly line which results in an output of a _COMOBJECT rather than a dynamo object.
This is the pthon code used.
import clr
# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('acmgd')
clr.AddReference('acdbmgd')
clr.AddReference('accoremgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('Civil3DNodes')
clr.AddReference('AutoCADNodes')
# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
#Import References from dynamo
from Autodesk.AutoCAD.DynamoNodes import SelectionByQuery
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
def Get_Civil_Object(COMObject):
if not isinstance(COMObject,list):
COMObject = [COMObject]
output,handle = [],[]
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
for c in COMObject:
handle.append(str(c.Handle))
t.Commit()
for h in handle:
output.append(SelectionByQuery.GetObjectByObjectHandle(h))
return output
OUT = Get_Civil_Object(IN[0])