[pycad]抛砖、续貂之cad零基础二开自用:组改色
# 枫叶版pycad 感谢飞狐,山人,枫叶,闻人南的示例
#让pycad不放弃每一个打螺丝人
@Command()
def changeColor22(doc): #group组改色:根据组名改色
groupName = '-GR1'
db = doc.Database
with dbtrans(doc) as tr:
dict_ids = db.GroupDictionaryId
group_dicts = list(tr.getobject(dict_ids, acdb.OpenMode.ForWrite))
for group_dict in group_dicts:
if (group_dict.Key == groupName ):
group = group_dict.Value.GetObject(acdb.OpenMode.ForWrite)
ids3 = group.GetAllEntityIds()
for objid in ids3:
obj = tr.getobject(objid, acdb.OpenMode.ForWrite)
obj.ColorIndex = 3
页:
[1]