Answers for "Cget subassembly civid3d"

0

Cget subassembly civid3d

import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

def get_subassembly_info(subassembly):

	if not subassembly:
		return
	
	adoc = Application.DocumentManager.MdiActiveDocument
	output = []
	
	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
	            oid = subassembly.InternalObjectId
	            aeccSubassembly = t.GetObject(oid, OpenMode.ForRead)
	            aeccGenerator = aeccSubassembly.GeometryGenerator
	            output.append(aeccGenerator.MacroOrClassName)
	            output.append(aeccGenerator.ProjectOrAssemblyName)
	            t.Commit()
	            pass
	return output

OUT = get_subassembly_info(IN[0])
Posted by: Guest on October-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language