- UID
- 695847
- 积分
- 700
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-8-14
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
# 枫叶版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) |
|