Replies: 4 comments 7 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() |
6 replies
|
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) |
0 replies
|
ID SUP-80017 |
0 replies
|
Is there anything known about this? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
All reactions