Page 1 of 1

Recalculate fields after changing source object value

Posted: Fri Feb 19, 2016 6:08 am
by AngelKostadinov
Hello guys!

I'm using Teigha .NET SWIG libraries to edit drawings and recently stuck with a problem...
I have a question related to fields and more precisely, how to update (evaluate) fields manually (with .net api) across the whole drawing.

Consider following use-case:
- There are 2 block references appended to model space;
- Each reference points to different block record;
- Each block reference 'has' a single attribute reference within;
- 1st attribute reference has "foo" as a string value;
- 2nd attribute reference has a field, pointing to 1st attribute text value;
- Opening this drawing in AutoCAD, it displays the 2 block references with "foo" text on both;
- In AutoCAD, If we change the source value ot "bar" and trigger some action that makes AutoCAD to evaluate fields, then "bar" appears on the 2nd place; As such action we could consider saving, plotting, regeneration and etc..

Here is my problem:
I'm opening the drawing with Teigha libraries, changing the "source" text value and extracting a PDF file from it. After Opening the result PDF file, I see that field is not evaluated and 2nd attribute contains the old value of "foo" instead of "bar". So, what action should I take in order to make fields to recompute?

Am I supposed to iterate through all db objects and to search for OdDbField and to call evaluate() method?