- 积分
- 632
- 明经币
- 个
- 注册时间
- 2011-11-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
# 枫叶版pycad 感谢飞狐,山人,枫叶,闻人南的示例
#让pycad不放弃每一个打螺丝人
@Command()
def changeColor25(doc): #普通简单块改色
with dbtrans(doc) as tr:
ss = ssget_x(filters=(0, 'insert') )
if not ss.ok:
return
idSS = tuple(ss)
iSet1 = set()
for Entobjid in idSS:
btref = tr.getobject(Entobjid, acdb.OpenMode.ForWrite)
btrecid = btref.BlockTableRecord
iSet1.add(btrecid)
btrecs = [tr.getobject(tabid, acdb.OpenMode.ForWrite) for tabid in iSet1 ]
for btrec in btrecs:
for Entobjid in btrec:
ent = tr.getobject(Entobjid, acdb.OpenMode.ForWrite)
ent.ColorIndex = 0
blockidSS = btrec.GetBlockReferenceIds(True, False)
for blockid in blockidSS:
blockref = tr.getobject(blockid, acdb.OpenMode.ForWrite)
blockref.ColorIndex = 3
tr.flush(blockref) |
|