<?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 Script to check if part in drawing has external rule in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533420#M66500</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe not a neat solution but If you try to run the external rule, an error will occur, if you capture the error, you can proceed with&lt;/P&gt;
&lt;P&gt;the rest of your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;RunExternalRule&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;c:\test.vb&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;The external rule cannot be found&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2016 10:52:47 GMT</pubDate>
    <dc:creator>frederic.vandenplas</dc:creator>
    <dc:date>2016-08-31T10:52:47Z</dc:date>
    <item>
      <title>iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6531762#M66486</link>
      <description>&lt;P&gt;I have an iLogic script in my drawing that was checking for a local iLogic rule inside of the part and it would do something if the rule was not found. I have since moved the part iLogic rule to be external and that check no longer works. I've come across a post with info from the dev team that there is no api to look for external rules. So I figure there should be some work around possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking about checking for triggers since the part still has those even with the rule being external. I've looked through the iLogic injector &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/725444"&gt;@MegaJerk﻿&lt;/a&gt; made and found a thread of his and both reference .PropertySets.Item("iLogicEventsRules"). I've dug around in a file that has ilogic triggers and I can't see or access that property set at all. When I try to run thisapplication.activedocument.PropertySets.Item("iLogicEventsRules") I get an activex can't create object error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some trick to accessing the iLogic trigger information?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 17:22:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6531762#M66486</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2016-08-30T17:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533420#M66500</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe not a neat solution but If you try to run the external rule, an error will occur, if you capture the error, you can proceed with&lt;/P&gt;
&lt;P&gt;the rest of your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;RunExternalRule&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;c:\test.vb&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;The external rule cannot be found&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 10:52:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533420#M66500</guid>
      <dc:creator>frederic.vandenplas</dc:creator>
      <dc:date>2016-08-31T10:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533833#M66511</link>
      <description>&lt;P&gt;As described&amp;nbsp;&lt;A title="Hidden EventTrigger Property" href="https://forums.autodesk.com/t5/inventor-customization/adding-an-ilogic-rule-to-an-event-trigger-with-vba/m-p/4343787#M45310" target="_blank"&gt;here&lt;/A&gt;, depending on when a given file was created (or at least which version of Inventor it was created with) the PropertySet for Event Triggers might be hidden.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Instead of using the PropertySet name "iLogicEventsRules" or "_iLogicEventsRules", search for the GUID "{2C540830-0723-455E-A8E2-891722EB4C3E}"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that this gets you started in the right direction.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;----&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 13:47:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533833#M66511</guid>
      <dc:creator>MegaJerk</dc:creator>
      <dc:date>2016-08-31T13:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533853#M66512</link>
      <description>&lt;P&gt;That seems to find the external rule whether or not the part in the drawing is using it or not. So that will not work for what I'm doing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to explicitly check if the part inside a drawing has an active external rule, not if an external rule exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only method I know will work would be to have a one line internal rule that calls an external rule. That way I can use some code that lists internal rules in a component to see if it exists in a part. The reason I'm reluctant to do that is all the parts created with the external rule already won't be updated properly.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 13:52:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533853#M66512</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2016-08-31T13:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533975#M66514</link>
      <description>&lt;P&gt;Thanks for that info MegaJerk, that is exactly what I needed. Below is the code I came up with to check if a part/assembly inside of a drawing has an external rule setup to trigger.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
	docFile = ThisDoc.ModelDocument
Else
	Return
End If

'Check if part has iLogic rule named Material, if not this will update Matrl iProp even if Matrl already exists
Dim MatFound = False
Dim iLogicE As propertyset
iLogicE = docFile.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}")

For i As Integer = 1 To ilogicE.count
	If (InStr(ilogicE.item(i).Value,"Material_Part")) Or (InStr(iLogicE.item(i).Value,"Material_Assembly")) Then MatFound = True
Next&lt;BR /&gt;&lt;BR /&gt;MsgBox("Does part/assembly have a matching external iLogic rule. " &amp;amp; MatFound) &lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Aug 2016 14:25:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6533975#M66514</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2016-08-31T14:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Script to check if part in drawing has external rule</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6534867#M66522</link>
      <description>&lt;P&gt;I really dislike the short edit allotted on this forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Updated code. Added the try/catch since I just found out parts that have never had iLogic rules apparently do not have that property set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
	docFile = ThisDoc.ModelDocument
Else
	Return
End If

'Check if part has external iLogic rule named Material_Part or Material_Assembly
Dim iLogicFound = False
Dim iLogicE As propertyset

Try
	iLogicE = docFile.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}")
	For i As Integer = 1 To ilogicE.count
		If (InStr(ilogicE.item(i).Value,"Material_Part")) Or (InStr(iLogicE.item(i).Value,"Material_Assembly")) Then iLogicFound = True
	Next
Catch
	'No iLogic I guess
End Try&lt;BR /&gt;&lt;BR /&gt;MsgBox("Does part/assembly have a matching external iLogic rule. " &amp;amp; iLogicFound)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2016 18:25:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-script-to-check-if-part-in-drawing-has-external-rule/m-p/6534867#M66522</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2016-08-31T18:25:22Z</dc:date>
    </item>
  </channel>
</rss>

