Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I want to set FRAME variable to 0 in many drawings because someone left imageframe to 1 in them.
This should be simple, but there is a catch where Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable operated on current database. I followed what Gile mentioned here: Code
But am getting fatal errors on the second file every time. Here is my test code, any ideas?
[CommandMethod("TESTVARCHANGE")]
public void testVarChange() {
List<string> files = new List<string>();
files.Add(@"C:\Temp\Proxy Tests\SD-MWS4.dwg");
files.Add(@"C:\Temp\Proxy Tests\PRF-BORREGO-SD5.dwg");
files.Add(@"C:\Temp\Proxy Tests\ST-ADA.dwg");
Database db = AcAp.DocumentManager.MdiActiveDocument.Database;
foreach (string fullpath in files) {
if (File.Exists(fullpath)) {
using (Database tmpDb = new Database(false, true)) {
try {
tmpDb.ReadDwgFile(fullpath, FileOpenMode.OpenForReadAndAllShare, false, "");
HostApplicationServices.WorkingDatabase = tmpDb;
//set var
Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("FRAME", 0);
AcAp.SetSystemVariable("WIPEOUTFRAME", 1);
AcAp.SetSystemVariable("IMAGEFRAME", 1);
// Save always to current version
tmpDb.SaveAs(fullpath, DwgVersion.Current);
HostApplicationServices.WorkingDatabase = db;
}
catch (System.Exception ex) {
Debug.Print(ex.Message);
}
}
}
}
}
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Solved! Go to Solution.