Add using_scope

Well, that’s just exactly what I needed! My humble personage bows before your grandeur, I withdraw my request

import traceback
from pyrx import Ap, Db, Ap

def using_scope(f):
    f()

@Ap.Command()
def doit2():
    try:
        db = Db.Database(False, True)
        db.readDwgFile("E:\\temp\\Floor Plan Sample1.dwg")
        db.closeInput(True)

        @using_scope
        def _():
            ms = db.modelSpace()
            ents = [Db.Entity(id) for id in ms.objectIds(Db.Entity.desc())]
            types = [ent.isA().dxfName() for ent in ents]
            print(len(types))
    except Exception as err:
        traceback.print_exception(err)
Command: DOIT2
4422
4 Likes