<?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: Problem with unspecified error while creating drawing files. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020303#M179422</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16196360"&gt;@SMillsYS3X2&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is it closing the file that the rule is run from? If so that will cause an error, as iLogic is document based and needs to keep the "calling" document open.&lt;BR /&gt;&lt;BR /&gt;I have also run into issue with a routine that hits read only files on the save and can not save them, which causes them not to close.&lt;BR /&gt;&lt;BR /&gt;You might resolve these situations with something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;

	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;

	&lt;SPAN&gt;Dim&lt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&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
		&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;ex&lt;/SPAN&gt;.&lt;SPAN&gt;Message&lt;/SPAN&gt;)
		&lt;SPAN&gt;'	MsgBox(ex.Message)&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I also sometimes use something like this at the beginning of a routine to close all but the active file :&lt;/P&gt;
&lt;PRE&gt;	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;IsNot&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;)   &lt;SPAN&gt;' False = do NOT save		&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;

	&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;ControlDefinitions&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"iLogic.FreeILogicMemory"&lt;/SPAN&gt;).&lt;SPAN&gt;Execute&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Hope that helps,&amp;nbsp;&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Feb 2026 22:33:12 GMT</pubDate>
    <dc:creator>Curtis_W</dc:creator>
    <dc:date>2026-02-16T22:33:12Z</dc:date>
    <item>
      <title>Problem with unspecified error while creating drawing files.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020255#M179420</link>
      <description>&lt;P&gt;I have a code that is making several drawing files while it runs, and I am having a problem with it erroring and not actually saving them. It doesn't happen all the time, but I think it has something to do with inventor keeping a file active in the background even after a rule has run. That is to say, it's keeping the rights to it so the file manager can't overwrite or delete it, and so causing this error when it tries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to clear/close all background files that Inventor has at that moment without stopping and re-starting Inventor and closing active and open files? Or some way of checking that before trying to write-over a locked file?&lt;BR /&gt;&lt;BR /&gt;Image of the error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SMillsYS3X2_0-1771277392091.png" style="width: 200px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1619171i42769ADAE223253F/image-size/small?v=v2&amp;amp;px=200" role="button" title="SMillsYS3X2_0-1771277392091.png" alt="SMillsYS3X2_0-1771277392091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2026 21:36:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020255#M179420</guid>
      <dc:creator>SMillsYS3X2</dc:creator>
      <dc:date>2026-02-16T21:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with unspecified error while creating drawing files.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020303#M179422</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16196360"&gt;@SMillsYS3X2&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is it closing the file that the rule is run from? If so that will cause an error, as iLogic is document based and needs to keep the "calling" document open.&lt;BR /&gt;&lt;BR /&gt;I have also run into issue with a routine that hits read only files on the save and can not save them, which causes them not to close.&lt;BR /&gt;&lt;BR /&gt;You might resolve these situations with something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;

	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;

	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;fileInfo&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;FileInfo&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;fileInfo&lt;/SPAN&gt;.&lt;SPAN&gt;IsReadOnly&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;fileInfo&lt;/SPAN&gt;.&lt;SPAN&gt;IsReadOnly&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;

	&lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
	&lt;SPAN&gt;Catch&lt;/SPAN&gt; &lt;SPAN&gt;ex&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
		&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;ex&lt;/SPAN&gt;.&lt;SPAN&gt;Message&lt;/SPAN&gt;)
		&lt;SPAN&gt;'	MsgBox(ex.Message)&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;


	&lt;SPAN&gt;Try&lt;/SPAN&gt;
		&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;
	&lt;SPAN&gt;Catch&lt;/SPAN&gt; &lt;SPAN&gt;ex&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Exception&lt;/SPAN&gt;
		&lt;SPAN&gt;Logger&lt;/SPAN&gt;.&lt;SPAN&gt;Info&lt;/SPAN&gt;(&lt;SPAN&gt;ex&lt;/SPAN&gt;.&lt;SPAN&gt;Message&lt;/SPAN&gt;)
		&lt;SPAN&gt;'	MsgBox(ex.Message)&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I also sometimes use something like this at the beginning of a routine to close all but the active file :&lt;/P&gt;
&lt;PRE&gt;	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;IsNot&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;)   &lt;SPAN&gt;' False = do NOT save		&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;

	&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;ControlDefinitions&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"iLogic.FreeILogicMemory"&lt;/SPAN&gt;).&lt;SPAN&gt;Execute&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Hope that helps,&amp;nbsp;&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2026 22:33:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020303#M179422</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2026-02-16T22:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with unspecified error while creating drawing files.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020333#M179424</link>
      <description>&lt;P&gt;I think the second part is what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First part of the code creates, then opens several files in the background with (segments of the code);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oDWGList As New List(Of DrawingDocument)&lt;BR /&gt;oDWGList.Add(ThisApplication.Documents.Open(oPath,False))&lt;BR /&gt;For Each oDWG In oDWGList&lt;BR /&gt;&amp;nbsp; &amp;nbsp;oDWG.Save&lt;BR /&gt;&amp;nbsp; &amp;nbsp;oDWG.Close&lt;BR /&gt;Next&lt;BR /&gt;&lt;BR /&gt;But sometimes it errors, and leave some of these documents open in the background. That is why I think it sometimes errors on the second run.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2026 23:07:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14020333#M179424</guid>
      <dc:creator>SMillsYS3X2</dc:creator>
      <dc:date>2026-02-16T23:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with unspecified error while creating drawing files.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14021117#M179437</link>
      <description>&lt;P&gt;Another factor in this case could be that you are storing the Documents within a List, and not removing them from that List when you are done with them.&amp;nbsp; Maybe try including a line like:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oDWGList.Remove(oDWG)&lt;/LI-CODE&gt;
&lt;P&gt;within that loop, but just before calling the oDWG.Close method.&amp;nbsp; Maybe you could also use the built-in method&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2026/ENU/?guid=Documents_CloseAll" target="_blank" rel="noopener"&gt;Documents.CloseAll&lt;/A&gt;.&amp;nbsp; That method has an Optional Boolean type input parameter which we can use to specify that we only want it to clear out all unreferenced documents too, which I often use when batch processing a lot of files, to help clear out the documents from Inventor's memory.&amp;nbsp; Just a couple more tips that may help in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Feb 2026 13:30:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/problem-with-unspecified-error-while-creating-drawing-files/m-p/14021117#M179437</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2026-02-17T13:30:39Z</dc:date>
    </item>
  </channel>
</rss>

