<?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: Calling Functions from VBA or External rules in local iLogic Rule in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691438#M59493</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks a lot for the information.&lt;BR /&gt;I definitely have a lot to explore, as i am new to programming outside iLogic&lt;/P&gt;</description>
    <pubDate>Fri, 14 Aug 2020 12:26:51 GMT</pubDate>
    <dc:creator>s.riebl</dc:creator>
    <dc:date>2020-08-14T12:26:51Z</dc:date>
    <item>
      <title>Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691085#M59488</link>
      <description>&lt;P&gt;Hello guys,&lt;BR /&gt;&lt;BR /&gt;Im posting on behalf of my company here.&lt;BR /&gt;I am trying to create a library of Functions to add a part, delete a part and create iMates for added parts.&lt;BR /&gt;Right now i have a hard time to figure out the best way to do this.&lt;BR /&gt;External rules seem to be the ideal way, but i read that it has to be a straight vb file to be added in the local iLogic rule editor.&lt;BR /&gt;Would it be better if i add them to VBA macros and call the functions locally?&lt;BR /&gt;&lt;BR /&gt;I also could not find a proper code to call functions which has ThisApplication&amp;nbsp; and ThisDoc objects properly from external rules or VBA Macros.&lt;BR /&gt;&lt;BR /&gt;Any help would be appreciated.&lt;BR /&gt;Please look into into it if someone finds free time.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Vamsi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;These are the functions that i am trying to store externally and call them locally in required assemblies.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
	
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;ComponentName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
	&lt;SPAN&gt;oACD&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	&lt;SPAN&gt;oPath&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt;
	&lt;SPAN&gt;oFile&lt;/SPAN&gt; = &lt;SPAN&gt;ComponentName&lt;/SPAN&gt;
	&lt;SPAN&gt;oTG&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;
	&lt;SPAN&gt;oM&lt;/SPAN&gt; = &lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreateMatrixoM&lt;/SPAN&gt;.&lt;SPAN&gt;SetTranslation&lt;/SPAN&gt;(&lt;SPAN&gt;oTG&lt;/SPAN&gt;.&lt;SPAN&gt;CreateVector&lt;/SPAN&gt;(0, 0, 0))
	&lt;SPAN&gt;oOcc&lt;/SPAN&gt; = &lt;SPAN&gt;oACD&lt;/SPAN&gt;.&lt;SPAN&gt;Occurances&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oFile&lt;/SPAN&gt;, &lt;SPAN&gt;oM&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;

&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;Check&lt;/SPAN&gt;(&lt;SPAN&gt;ComponentName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
	&lt;SPAN&gt;oACD&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; = 1 &lt;SPAN&gt;To&lt;/SPAN&gt; 20
		&lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;entity&lt;/SPAN&gt; = &lt;SPAN&gt;oACD&lt;/SPAN&gt;.&lt;SPAN&gt;Occurances&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;ComponentName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;":"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;)
			&lt;SPAN&gt;entity&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
		&lt;SPAN&gt;Catch&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;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;

&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;DoiMates&lt;/SPAN&gt;(&lt;SPAN&gt;Component1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Component2&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;MateName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;)
	&lt;SPAN&gt;oACD&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	&lt;SPAN&gt;Comp1&lt;/SPAN&gt; = &lt;SPAN&gt;oACD&lt;/SPAN&gt;.&lt;SPAN&gt;Occurances&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;Component1&lt;/SPAN&gt;)
	&lt;SPAN&gt;Comp2&lt;/SPAN&gt; = &lt;SPAN&gt;oACD&lt;/SPAN&gt;.&lt;SPAN&gt;Occurances&lt;/SPAN&gt;.&lt;SPAN&gt;ItemByName&lt;/SPAN&gt;(&lt;SPAN&gt;Component2&lt;/SPAN&gt;)
	&lt;SPAN&gt;i&lt;/SPAN&gt; = 1
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;iMateDefinition&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;Comp1&lt;/SPAN&gt;.&lt;SPAN&gt;iMateDefinitions&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;iMateDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt; = &lt;SPAN&gt;MateName&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;iMate1&lt;/SPAN&gt; = &lt;SPAN&gt;Comp1&lt;/SPAN&gt;.&lt;SPAN&gt;iMateDefinitions&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;i&lt;/SPAN&gt;)
			&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt; + 1
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;i&lt;/SPAN&gt; = 1
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;iMateDefinition&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;Comp2&lt;/SPAN&gt;.&lt;SPAN&gt;iMateDefinitions&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;iMateDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt; = &lt;SPAN&gt;MateName&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;iMate1&lt;/SPAN&gt; = &lt;SPAN&gt;Comp2&lt;/SPAN&gt;.&lt;SPAN&gt;iMateDefinitions&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;i&lt;/SPAN&gt;)
			&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt; + 1
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;oiMateResults&lt;/SPAN&gt; = &lt;SPAN&gt;oACD&lt;/SPAN&gt;.&lt;SPAN&gt;iMateResults&lt;/SPAN&gt;.&lt;SPAN&gt;AddByTwoiMates&lt;/SPAN&gt;(&lt;SPAN&gt;iMate1&lt;/SPAN&gt;, &lt;SPAN&gt;iMate2&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 07:44:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691085#M59488</guid>
      <dc:creator>s.riebl</dc:creator>
      <dc:date>2020-08-14T07:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691237#M59489</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Any help here please?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 09:41:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691237#M59489</guid>
      <dc:creator>s.riebl</dc:creator>
      <dc:date>2020-08-14T09:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691337#M59490</link>
      <description>&lt;P&gt;Both ways have their pros &amp;amp; cons.&amp;nbsp; Going the VBA route, would be more intuitive for someone who is fairly new to programming for Inventor, because it's easier to create and call external Subs, Functions, Classes, and easier to use external references without having to add special code to retrieve the reference at the top of every Main code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used external Subs &amp;amp; Functions within iLogic too, and when going that route, there are several special things you have to do to make it work.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The external rule must have the "Straight VB Code" option turned on (within the iLogic Rule Editor's per/rule options)&lt;UL&gt;&lt;LI&gt;The rule using that externally referenced rule does not have to have the "Straight VB Code" option turned on.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;The code within that external rule must be enclosed within the "Class ThisRule" &amp;amp; "End Class".&lt;UL&gt;&lt;LI&gt;The rule using that externally referenced rule does not have to be enclosed within the "Class ThisRule" &amp;amp; "End Class"&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;The rule referencing that external rule must include a line of code at the top which works similar to AddReference, which looks something like the following:&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;AddVbFile "full path &amp;amp; file name of the external rule file to reference"&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, you can also run other local rules, external rules, or VBA macros from within an ilogic rule too, and you can pass data back and forth between those other rules/macros and the current rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I personally very much prefer writing code using vb.net &amp;amp; iLogic, rather than VBA, so I normally choose to go the iLogic route when possible.&amp;nbsp; The iLogic code (which uses vb.net) can often be used with, very minimal changes, within Inventor Add-in's too.&amp;nbsp; Both coding formats descended from visual basic, so there are a lot of similarities.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:10:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691337#M59490</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-14T11:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691346#M59491</link>
      <description>&lt;P&gt;You can do like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Extract and save attached .iLogicVB-file anywhere.&lt;/P&gt;&lt;P&gt;If you want to call functions from it, add it at the top of your iLogic rule:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;AddVbFile&lt;/SPAN&gt; &lt;SPAN style="color: #008080;"&gt;"C:\Yourpath\SpecialFunctions.iLogicVB"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Then the first line of your rule should be this, to set ThisDoc and ThisApplication in the SpecialFunctions Module:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #800000;"&gt;SpecialFunctions&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;GetAppAndDoc&lt;/SPAN&gt;(&lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;, &lt;SPAN style="color: #800080;"&gt;ThisApplication&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;Then you're good to go. Just call the functions with SpecialFunctions.FunctionName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SpecialFunctions.PNG" style="width: 871px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/807265i4D05A4D9DCF6E9FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="SpecialFunctions.PNG" alt="SpecialFunctions.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 11:18:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691346#M59491</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-08-14T11:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691396#M59492</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2521219"&gt;@s.riebl&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Yes. You can include several Subs, Functions, Classes, etc within one external rule file if you like, as long as it's done right.&amp;nbsp; I guess I didn't mention that.&amp;nbsp; Another positive point for the vb.net &amp;amp; iLogic side. &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;&amp;nbsp; Good point Joel.&amp;nbsp; Also, I noticed you're using "Public Module" instead of just "Class ThisRule".&amp;nbsp; I am intrigued.&amp;nbsp; I would like to know more about this technique, and what difference it makes. &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:03:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691396#M59492</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-14T12:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691438#M59493</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks a lot for the information.&lt;BR /&gt;I definitely have a lot to explore, as i am new to programming outside iLogic&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:26:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691438#M59493</guid>
      <dc:creator>s.riebl</dc:creator>
      <dc:date>2020-08-14T12:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691446#M59494</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use a moule (Which is basically just a collection of subs/functions) I can use the functions without creating an instance of it in the code first - as I'd have to do with a class.&lt;/P&gt;&lt;P&gt;Changing it to a class would require a row in the iLogic rule such as:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;oSpecialFunctions&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;SpecialFunctions&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;And then I'd have to use oSpecialFunctions to call anything in the iLogicVB-file.&lt;/P&gt;&lt;P&gt;It's just an unnessecary extra step and also It would have to keep this object (oSpecialFunctions) in memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both ways works though &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:28:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691446#M59494</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-08-14T12:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691474#M59495</link>
      <description>&lt;P&gt;Hi Jhoel!&lt;BR /&gt;&lt;BR /&gt;Thats a lot for the solution.&lt;BR /&gt;But i still managed to get an error which says:&lt;BR /&gt;Member not found.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error2.JPG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/807290i2DDEB59541BDA9DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Error2.JPG" alt="Error2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.JPG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/807291i03F2A1A1EEC4998B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Error.JPG" alt="Error.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; This is how i executed the commands from you.&lt;BR /&gt;Sorry for german dialog boxes though&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rule.JPG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/807289i72E1D2EE44CFEB38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rule.JPG" alt="Rule.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;Any insights about why i still get this error?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:36:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691474#M59495</guid>
      <dc:creator>s.riebl</dc:creator>
      <dc:date>2020-08-14T12:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691482#M59496</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2521219"&gt;@s.riebl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe it's just the Add-function that fails.&lt;/P&gt;&lt;P&gt;Is the assembly you're running the rule in saved?&lt;/P&gt;&lt;P&gt;Does the file "End_Unten_Rivet.iam" exist in the same folder as the assembly you're running the rule in?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:45:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691482#M59496</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2020-08-14T12:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691487#M59497</link>
      <description>&lt;P&gt;Hi Jhoel,&lt;BR /&gt;&lt;BR /&gt;Yes i tried with other function too,&lt;BR /&gt;they didnt seem to be working.&lt;BR /&gt;I made a quick restart of Inventor.&lt;BR /&gt;&lt;BR /&gt;Now it seems to work fine.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 12:48:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691487#M59497</guid>
      <dc:creator>s.riebl</dc:creator>
      <dc:date>2020-08-14T12:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691640#M59498</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI&lt;/P&gt;&lt;P&gt;When I use "Class ThisRule" and "End Class" around the code of my external iLogic rule that I want to reference within another rule, I'm not having to create an instance of anything before I use the Sub or Function from that reference within another rule.&amp;nbsp; All I have to do is have that AddVBFile line at the top (in the header), then just using that Sub or Fuction is automatically recognized and works.&amp;nbsp; And I don't have to call anything by ModuleName.SubName(), just SubName().&amp;nbsp; I believe this is because ThisRule is always implied within all iLogic rules, without having to specify or call it out.&amp;nbsp; This is why you can use "iLogicVb" and "InventorVb" to access the Automation object (and others) without using like this: ThisRule.iLogicVb or ThisRule.InventorVb.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-32B66838-22E4-4A0A-B5BB-862350C76B36" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-32B66838-22E4-4A0A-B5BB-862350C76B36&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 13:54:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/9691640#M59498</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-08-14T13:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/12946965#M59499</link>
      <description>&lt;P&gt;Hey there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I followed the steps mentioned above. But it doesn't work for me.&lt;BR /&gt;&lt;BR /&gt;Here's what I want to achieve. Could you please help me with it?&lt;BR /&gt;&lt;BR /&gt;Here's my main rule:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim partName As String = "redChain1"
Dim searchDescription As String = "Red Chain - " &amp;amp; 600 * nSections
Dim searchFolders As String() = {"$/Designs/User/Standard Red Chain Conveyor/Parts/Red Chains"}
Dim result As String = searchDownloadAndReplace(partName, searchDescription, searchFolders)
MessageBox.Show(result, "Title")&lt;/LI-CODE&gt;&lt;P&gt;'nSections' is a parameter that I will be receiving from the user input form on the assembly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;And here's the public function I want to define as an external rule:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Function searchDownloadAndReplace(partName As String, searchDescription As String, searchFolders As String()) As String
    ' Build one to many name/value pairs of Property/Value as search criteria
    Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) ' Add UDP.DisplayName, Value Pairs
    mSearchParams.Add("Description", searchDescription) ' Applies to file 001002.ipt
    ' ...add as many as required to enable a unique search result

    ' Returns full file name in local working folder (download enforces override, if local file exists)
    Dim mVaultFile As String = iLogicVault.GetFileBySearchCriteria(mSearchParams, True, False, searchFolders)
    
    If mVaultFile Is Nothing Then
        Logger.Error("Vault file search: File not found - Please double check that file can be found with search criteria applied.")
        Return "File not found"
    Else
        Logger.Info("File " &amp;amp; mVaultFile &amp;amp; " found by search and downloaded to local workspace.")
        Component.Replace(partName, mVaultFile, True)
        Return mVaultFile
    End If
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:36:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/12946965#M59499</guid>
      <dc:creator>prudhvi_galiFSSED</dc:creator>
      <dc:date>2024-08-08T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Functions from VBA or External rules in local iLogic Rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/12946977#M59500</link>
      <description>&lt;P&gt;Hey there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I followed the steps mentioned above. But it doesn't work for me.&lt;BR /&gt;&lt;BR /&gt;Here's what I want to achieve. Could you please help me with it?&lt;BR /&gt;&lt;BR /&gt;Here's my main rule:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim partName As String = "redChain1"
Dim searchDescription As String = "Red Chain - " &amp;amp; 600 * nSections
Dim searchFolders As String() = {"$/Designs/User/Standard Red Chain Conveyor/Parts/Red Chains"}
Dim result As String = searchDownloadAndReplace(partName, searchDescription, searchFolders)
MessageBox.Show(result, "Title")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'nSections' is a parameter that I will be receiving from the user input form on the assembly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;And here's the public function I want to define as an external rule:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Function searchDownloadAndReplace(partName As String, searchDescription As String, searchFolders As String()) As String
    ' Build one to many name/value pairs of Property/Value as search criteria
    Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) ' Add UDP.DisplayName, Value Pairs
    mSearchParams.Add("Description", searchDescription) ' Applies to file 001002.ipt
    ' ...add as many as required to enable a unique search result

    ' Returns full file name in local working folder (download enforces override, if local file exists)
    Dim mVaultFile As String = iLogicVault.GetFileBySearchCriteria(mSearchParams, True, False, searchFolders)
    
    If mVaultFile Is Nothing Then
        Logger.Error("Vault file search: File not found - Please double check that file can be found with search criteria applied.")
        Return "File not found"
    Else
        Logger.Info("File " &amp;amp; mVaultFile &amp;amp; " found by search and downloaded to local workspace.")
        Component.Replace(partName, mVaultFile, True)
        Return mVaultFile
    End If
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:41:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/calling-functions-from-vba-or-external-rules-in-local-ilogic/m-p/12946977#M59500</guid>
      <dc:creator>prudhvi_galiFSSED</dc:creator>
      <dc:date>2024-08-08T13:41:55Z</dc:date>
    </item>
  </channel>
</rss>

