Replies: 3 comments 6 replies
-
It does evaluate the field; it just does not update the graphic. You can check the value before and after evaluation In AutoCAD, I would walk up the ownership and call recordGraphicsModified, however, it seems that ZwCAD has a bug, so your forced to regen from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax, command
import operator
def get_all_field_ids(db: Db.Database):
fieldSet = set()
nod = Db.Dictionary(db.namedObjectsDictionaryId())
fieldListId = nod.getAt("ACAD_FIELDLIST")
fieldList = Db.Core.entGet(fieldListId)
for code, id in fieldList:
if code != Db.DxfCode.kDxfSoftPointerId:
continue
if not id.isDerivedFrom(Db.Field.desc()):
continue
fieldSet.add(id)
return fieldSet
def update_parent_entity(id: Db.ObjectId):
if id.isDerivedFrom(Db.Entity.desc()):
ent = Db.Entity(id, Db.OpenMode.kForWrite)
ent.recordGraphicsModified()
ent.close()
return
dbo = Db.DbObject(id)
ownerId = dbo.ownerId()
dbo.close()
update_parent_entity(ownerId)
@command
def doit():
db = Db.curDb()
for id in get_all_field_ids(db):
field = Db.Field(id, Db.OpenMode.kForWrite)
field.evaluate(Db.FieldEvalContext.kDemand)
#print(field.getValue())
update_parent_entity(field.ownerId())
@command
def doitZw():
db = Db.curDb()
for id in get_all_field_ids(db):
field = Db.Field(id, Db.OpenMode.kForWrite)
field.evaluate(Db.FieldEvalContext.kDemand)
#print(field.getValue())
Ed.Core.regen() |
Beta Was this translation helpful? Give feedback.
-
I added these in Core, so when it's fixed, it should be fast Db.Core.evaluateFields() #all ids, kDemand
Db.Core.evaluateFields( ids, context) |
Beta Was this translation helpful? Give feedback.
-
ID SUP-80017 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How to update all fields in model? i tried this but it doesn't work:
Beta Was this translation helpful? Give feedback.
All reactions