TheSwamp

Code Red => .NET => Topic started by: latour_g on June 09, 2021, 05:30:03 PM

Title: Modify variable with external database
Post by: latour_g on June 09, 2021, 05:30:03 PM
Hi,

How would you change variable FIELDEVAL on this database ?

Code - C#: [Select]
  1.                 Database db = new Database(false, true);
  2.  
  3.                 string fileName = "C:\bogue\genevieve\Details.dwg";
  4.  
  5.                 using (db)
  6.                 {
  7.                     db.ReadDwgFile(fileName, FileShare.ReadWrite, false, "");
  8.  
  9.                     // This doesn't change value in the database :  
  10.                     // AcadApp.SetSystemVariable("FIELDEVAL", 32);
  11.  
  12.                    // This doesn't exist :
  13.                    // db.FieldEval = 32;
  14.                 }
  15.  

Thank you !
Title: Re: Modify variable with external database
Post by: n.yuan on June 11, 2021, 10:26:31 AM
While I am not 100% certain (don't have time to give it a try), you may want to try this:

Autodesk.AutoCAD.DatabaseService.FieldEngine.EvaluationOption=value ;  //bitwise value of 0, 1, 2, 4, 8, 16, or a sum of of the values

EvaluationOption is a static property.

Title: Re: Modify variable with external database
Post by: latour_g on June 14, 2021, 09:39:15 AM
Maybe I was doing something wrong but I didn't find FieldEngine in Database. 
But by adding HostApplicationServices.WorkingDatabase = db, I realize that AcadApp.SetSystemVariable("FIELDEVAL", 31) works fine.

Thank you !