<?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: iLogic and the Save Command in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008900#M71548</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="#" data-login="Owner2229" data-uid="3072914" target="_blank"&gt;@Owner2229&lt;/A&gt;,&amp;nbsp;&lt;A href="#" data-login="steveh" data-uid="45931" target="_blank"&gt;@steveh&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I may add my $0.02 on this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect the reason the built-in iLogic save command is failing is because it is interfering with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-EA8B86BC-CAF4-4A0C-BE79-FFF2483DCD50" target="_blank"&gt;DocumentEvents.OnSave Event&lt;/A&gt;&amp;nbsp;that the Vault addin is intercepting/capturing in order to then display its own file naming dialogue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried running the rule (for arguments' sake) with the vault addin disabled?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I bet your original rule would run just fine in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you run the&amp;nbsp;&lt;STRONG&gt;ThisApplication.CommandManager.StartCommand(CommandIDEnum.kFileSaveCommand&lt;/STRONG&gt;) command, (even though you are running it from iLogic) you are overriding the iLogic .save() method using the built-in API command &amp;amp; then Inventor's events fire normally and everything is fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could absolutely see this in action if you ran the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/working-with-the-event-watcher/m-p/5420696#M52900" target="_blank"&gt;Event Watcher tool&lt;/A&gt;&amp;nbsp;(with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ApplicationEvents.SaveDocument &amp;amp; UserInputEvents.OnActivateCommand checkboxes selected)&amp;nbsp;at the same time as running this rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this error make it a bug? A small one, yes; I don't have knowledge of how many customers are using both iLogic and Vault (paid for) versions with file naming enabled but I am surprised this hasn't raised its head before now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(At my previous company we used Vault Professional with file numbering enabled and although I used iLogic rules to help with mundane tasks I can't recall ever having iLogic save anything in the way your screencast shows. Maybe I found this error and decided the easiest option was to just save manually once the rule completed...)&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 11:31:52 GMT</pubDate>
    <dc:creator>AlexFielder</dc:creator>
    <dc:date>2017-04-11T11:31:52Z</dc:date>
    <item>
      <title>iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7006835#M71514</link>
      <description>&lt;P&gt;Gang...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Getting an error when attempting to use the Save command (ThisDoc.Save)....The screencast video illustrates what I am attempting to do and the error I am seeing...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/community/screencast/0271b42f-a46a-42b1-b60c-0ee2b14795e6" target="_blank"&gt;https://knowledge.autodesk.com/community/screencast/0271b42f-a46a-42b1-b60c-0ee2b14795e6&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve H.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 14:29:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7006835#M71514</guid>
      <dc:creator>steveh3</dc:creator>
      <dc:date>2017-04-10T14:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7007110#M71518</link>
      <description>&lt;P&gt;Hey, I believe there's an issue in the "Document.Save" command, as I believe it's supposed to pop up the regular "Save dialog" if it's a new document.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/116141"&gt;@ekinsb&lt;/a&gt;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;&amp;nbsp;Can any of you guys please confirm if this is a bug or the command serves only to save already saved documents. I've&amp;nbsp;tested it on 2016, Build 138 and I'll try it on 2017 tomorrow at work. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It did the same to me (showed the same error).&lt;/P&gt;
&lt;P&gt;However, you can try this command instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ThisApplication.CommandManager.StartCommand(CommandIDEnum.kFileSaveCommand)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the second page of the error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)
   at Inventor._DocumentClass.Save()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 16:21:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7007110#M71518</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-04-10T16:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008537#M71534</link>
      <description>&lt;P&gt;Also tested on the below, with the same result.&lt;/P&gt;
&lt;PRE&gt;Inventor 2017 64-bit SP1, Build 196, Date Wed 07/13/2016&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2017 08:26:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008537#M71534</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-04-11T08:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008862#M71547</link>
      <description>&lt;P&gt;Thanks Mike...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appears your recommendation did the trick...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ThisApplication.CommandManager.StartCommand(Comman&lt;WBR /&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;dIDEnum.kFileSaveCommand&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Appreciate the help!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Steve H.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 11:08:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008862#M71547</guid>
      <dc:creator>steveh3</dc:creator>
      <dc:date>2017-04-11T11:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008900#M71548</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="#" data-login="Owner2229" data-uid="3072914" target="_blank"&gt;@Owner2229&lt;/A&gt;,&amp;nbsp;&lt;A href="#" data-login="steveh" data-uid="45931" target="_blank"&gt;@steveh&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I may add my $0.02 on this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect the reason the built-in iLogic save command is failing is because it is interfering with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-EA8B86BC-CAF4-4A0C-BE79-FFF2483DCD50" target="_blank"&gt;DocumentEvents.OnSave Event&lt;/A&gt;&amp;nbsp;that the Vault addin is intercepting/capturing in order to then display its own file naming dialogue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried running the rule (for arguments' sake) with the vault addin disabled?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I bet your original rule would run just fine in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you run the&amp;nbsp;&lt;STRONG&gt;ThisApplication.CommandManager.StartCommand(CommandIDEnum.kFileSaveCommand&lt;/STRONG&gt;) command, (even though you are running it from iLogic) you are overriding the iLogic .save() method using the built-in API command &amp;amp; then Inventor's events fire normally and everything is fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could absolutely see this in action if you ran the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/working-with-the-event-watcher/m-p/5420696#M52900" target="_blank"&gt;Event Watcher tool&lt;/A&gt;&amp;nbsp;(with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ApplicationEvents.SaveDocument &amp;amp; UserInputEvents.OnActivateCommand checkboxes selected)&amp;nbsp;at the same time as running this rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this error make it a bug? A small one, yes; I don't have knowledge of how many customers are using both iLogic and Vault (paid for) versions with file naming enabled but I am surprised this hasn't raised its head before now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(At my previous company we used Vault Professional with file numbering enabled and although I used iLogic rules to help with mundane tasks I can't recall ever having iLogic save anything in the way your screencast shows. Maybe I found this error and decided the easiest option was to just save manually once the rule completed...)&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 11:31:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008900#M71548</guid>
      <dc:creator>AlexFielder</dc:creator>
      <dc:date>2017-04-11T11:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008987#M71552</link>
      <description>&lt;P&gt;I don't think the Vault is causing the issue (at least not in my case) since I'm not using Vault on either of the tested machines and I made sure none of my AddIns were messing with any of the save-events&amp;nbsp;while testing it.&lt;/P&gt;
&lt;P&gt;So, all it had to do was pop-up the standard New-Save dialog.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 12:11:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7008987#M71552</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-04-11T12:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic and the Save Command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7009055#M71558</link>
      <description>&lt;P&gt;Hmmm, you're correct; Vault isn't the cause here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is happening is that the file is attempting to save without having a filename to save to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firing the built-in command forces Inventor to check if the file has been saved and (because it hasn't as its a new file) the correct prompts appear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess a way around this in future is to either use the non-iLogic version as suggested already or check for whether the activedocument has a fullfilename; normally a clear sign it has in fact been saved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TL;DR: Not a bug, but a limitation of the document.save() command inside iLogic.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 12:33:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-and-the-save-command/m-p/7009055#M71558</guid>
      <dc:creator>AlexFielder</dc:creator>
      <dc:date>2017-04-11T12:33:53Z</dc:date>
    </item>
  </channel>
</rss>

