Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created July 5, 2020 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/df56a6b4e3d1c6a5fe27a6bf2f4372fa to your computer and use it in GitHub Desktop.
Save chuongmep/df56a6b4e3d1c6a5fe27a6bf2f4372fa to your computer and use it in GitHub Desktop.
output = []
adoc = Application.DocumentManager.MdiActiveDocument
ed = adoc.Editor
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
for objectid in btr:
obj1 = t.GetObject(objectid, OpenMode.ForRead)
if obj1.Layer == "Layer1":
output.append(obj1)
else:
pass
OUT = output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment