Author Topic: Modify variable with external database  (Read 1311 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 184
Modify variable with external database
« 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 !

n.yuan

  • Bull Frog
  • Posts: 348
Re: Modify variable with external database
« Reply #1 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.


latour_g

  • Newt
  • Posts: 184
Re: Modify variable with external database
« Reply #2 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 !