Danielm103 Posted May 1 Posted May 1 did not want to infect the lisp thread  from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax import traceback def exploder(btrid: Db.ObjectId): btr = Db.BlockTableRecord(btrid, Db.OpenMode.kForWrite) for _id in btr.objectIds(): dbent = Db.Entity(_id, Db.OpenMode.kForWrite) try: btr.appendAcDbEntities(dbent.explode()) dbent.erase() except: pass # eNotApplicable for explode def purge(db: Db.Database, ids): for _id in db.purge(ids): dbo = Db.DbObject(_id, Db.OpenMode.kForWrite) dbo.erase() def setProps(db: Db.Database, btrids: list[Db.ObjectId]): for btrid in btrids: btr = Db.BlockTableRecord(btrid) for _id in btr.objectIds(): dbent = Db.Entity(_id, Db.OpenMode.kForWrite) dbent.setColorIndex(0) dbent.setLinetype("Continuous") if _id.isDerivedFrom(Db.Text.desc()): dbt = Db.Text.cast(dbent) dbt.setTextStyle(db.textstyle()) if _id.isDerivedFrom(Db.MText.desc()): dbmt = Db.MText.cast(dbent) dbmt.setTextStyle(db.textstyle()) @Ap.Command() def doit(): try: btrids = [] db = Db.curDb() bt = Db.BlockTable(db.blockTableId()) for _name, _id in bt.toDict().items(): btrids.append(_id) if "*" in _name: continue exploder(_id) setProps(db, btrids) purge(db, btrids) db.saveAs("E:\\temp\\mrclean.dwg") except Exception as err: traceback.print_exception(err)  mrclean.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.