<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Changing variables on side databases....getting repeatable crashes in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12691742#M4606</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This seems to be due to the fact you set the FRAME system variable and then, the IMAGEFRAME and WIPEOUTFRAME.&lt;/P&gt;&lt;P&gt;Removing (or commenting) this line seems to fix the issue.&lt;/P&gt;&lt;PRE&gt;Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("FRAME", 0);&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Good pickup Gilles !&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-29BD70BB-07BF-41A2-8C2F-AD41C9402486" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-29BD70BB-07BF-41A2-8C2F-AD41C9402486&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN class=""&gt;Note:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;You cannot set FRAME to a value of 3 manually. The setting for FRAME is restored to 3 only when one of the other object-specific frame settings is changed to a value that is different from the others.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Sat, 06 Apr 2024 22:07:18 GMT</pubDate>
    <dc:creator>kerry_w_brown</dc:creator>
    <dc:date>2024-04-06T22:07:18Z</dc:date>
    <item>
      <title>Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12690611#M4602</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I want to set FRAME variable to 0 in many drawings because someone left imageframe to 1 in them.&lt;/P&gt;&lt;P&gt;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: &lt;A href="https://forums.autodesk.com/t5/net/change-system-variable-wipeoutframe/m-p/11889681#M76636" target="_blank" rel="noopener"&gt;Code&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But am getting fatal errors on the second file every time. Here is my test code, any ideas?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;[CommandMethod("TESTVARCHANGE")]
public void testVarChange() {
	List&amp;lt;string&amp;gt; files = new List&amp;lt;string&amp;gt;();
	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);
				}
			}
		}
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2024 01:12:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12690611#M4602</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2024-04-06T01:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12690759#M4604</link>
      <description>&lt;P&gt;edit crashes for me too..&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2024 04:10:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12690759#M4604</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2024-04-06T04:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12691463#M4605</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;This seems to be due to the fact you set the FRAME system variable and then, the IMAGEFRAME and WIPEOUTFRAME.&lt;/P&gt;
&lt;P&gt;Removing (or commenting) this line seems to fix the issue.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-general" tabindex="0"&gt;&lt;CODE&gt;Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("FRAME", 0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Apr 2024 16:26:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12691463#M4605</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-04-06T16:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12691742#M4606</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This seems to be due to the fact you set the FRAME system variable and then, the IMAGEFRAME and WIPEOUTFRAME.&lt;/P&gt;&lt;P&gt;Removing (or commenting) this line seems to fix the issue.&lt;/P&gt;&lt;PRE&gt;Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("FRAME", 0);&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Good pickup Gilles !&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-29BD70BB-07BF-41A2-8C2F-AD41C9402486" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-29BD70BB-07BF-41A2-8C2F-AD41C9402486&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN class=""&gt;Note:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;You cannot set FRAME to a value of 3 manually. The setting for FRAME is restored to 3 only when one of the other object-specific frame settings is changed to a value that is different from the others.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sat, 06 Apr 2024 22:07:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12691742#M4606</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2024-04-06T22:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12692802#M4607</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I happen to have stumbled upon an odd case with frames and thought it was my database setting technique?&lt;/P&gt;&lt;P&gt;wow. I tested and you are right.&lt;/P&gt;&lt;P&gt;I saw in help about setting to 3. In my sample I just was trying a few different variables just to make sure I could do more than 1 at a time.&lt;/P&gt;&lt;P&gt;thanks as always, how you are not a 13 rank I'll never know...&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2024 20:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12692802#M4607</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2024-04-07T20:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Changing variables on side databases....getting repeatable crashes</title>
      <link>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12699823#M4608</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wrong that the issue was only with FRAME var.&lt;/P&gt;&lt;P&gt;As I test more, I am seeing that even changing just WIPEOUTFRAME or IMAGEFRAME var to 1 or 0 will cause the crashes.&lt;/P&gt;&lt;P&gt;If the settings is already the same as what you are changing to, no crashes. That is what fooled me.&lt;/P&gt;&lt;P&gt;The best way to get the crashes reliably is change the setting back and forth right in a row, like:&lt;/P&gt;&lt;P&gt;AcAp.SetSystemVariable("WIPEOUTFRAME", 0);&lt;/P&gt;&lt;P&gt;AcAp.SetSystemVariable("WIPEOUTFRAME", 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On my tests, the first drawing seemed to tolerate that but second one crashed every time.&lt;/P&gt;&lt;P&gt;Note that if I am just changing things like LTSCALE, DIMSCALE there are never crashes.&lt;/P&gt;&lt;P&gt;So something about WIPEOUTFRAME and IMAGEFRAME, possibly XCLIPFRAME and others, are sensitive.&lt;/P&gt;&lt;P&gt;I noticed somewhere along the way I picked up code to change IMAGEFRAME in dictionary:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static void SetImageFrame(AcDb.Database db, Transaction tr, int value) {
	DBDictionary theNOD = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
	RasterVariables rasterVars;

	string kImageVars = "ACAD_IMAGE_VARS";
	if (theNOD.Contains(kImageVars)) {
		ObjectId rastVarsId = theNOD.GetAt(kImageVars);
		rasterVars = (RasterVariables)tr.GetObject(rastVarsId, OpenMode.ForWrite);
	}
	//or create it
	else {
		rasterVars = new AcDb.RasterVariables();
		theNOD.UpgradeOpen();
		theNOD.SetAt(kImageVars, rasterVars);
		tr.AddNewlyCreatedDBObject(rasterVars, true);
	}
	if (value == 0)
		rasterVars.ImageFrame = FrameSetting.ImageFrameOff;
	else if (value == 1)
		rasterVars.ImageFrame = FrameSetting.ImageFrameAbove;
	else if (value == 2)
		rasterVars.ImageFrame = FrameSetting.ImageFrameOnNoPlot;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That never crashes.&lt;/P&gt;&lt;P&gt;This must be some kind of bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 16:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/changing-variables-on-side-databases-getting-repeatable-crashes/m-p/12699823#M4608</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2024-04-10T16:19:17Z</dc:date>
    </item>
  </channel>
</rss>

