📜  Cget 子程序集 civid3d - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:23.253000             🧑  作者: Mango

代码示例1
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])