<?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 Find All Constraints For Specified Component - iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8383739#M91056</link>
    <description>&lt;P&gt;I thought this would be straight forward. I would like to suppress&amp;nbsp; a specific component in iLogic, then suppress any associated constraints. Then I would like to do the inverse, un-suppress the part and all associated constraints. However, what I have read so far is that the constraints are actually above the component in hierarchical terms. I have not found an easy way to select the constraints used on the part I want to suppress unless I specify them directly, which will increase the amount of code more than I would like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There was an article that I looked at,&amp;nbsp;&lt;A title="Inventor 2017 - iLogic: Suppress Component &amp;amp; Constraints" href="https://www.cadlinecommunity.co.uk/hc/en-us/articles/214079065-Inventor-2017-iLogic-Suppress-Component-Constraints-" target="_blank"&gt;Inventor 2017 - iLogic: Suppress Component &amp;amp; Constraints&lt;/A&gt;, that has some potential. The only problem is the need to cycle through all the constraints in the file and compare the suppression state. This might increase the time to cycle through the code more than I like. If anyone has another suggestion, I am open to other solutions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 06 Nov 2018 17:51:06 GMT</pubDate>
    <dc:creator>insomnix</dc:creator>
    <dc:date>2018-11-06T17:51:06Z</dc:date>
    <item>
      <title>Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8383739#M91056</link>
      <description>&lt;P&gt;I thought this would be straight forward. I would like to suppress&amp;nbsp; a specific component in iLogic, then suppress any associated constraints. Then I would like to do the inverse, un-suppress the part and all associated constraints. However, what I have read so far is that the constraints are actually above the component in hierarchical terms. I have not found an easy way to select the constraints used on the part I want to suppress unless I specify them directly, which will increase the amount of code more than I would like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There was an article that I looked at,&amp;nbsp;&lt;A title="Inventor 2017 - iLogic: Suppress Component &amp;amp; Constraints" href="https://www.cadlinecommunity.co.uk/hc/en-us/articles/214079065-Inventor-2017-iLogic-Suppress-Component-Constraints-" target="_blank"&gt;Inventor 2017 - iLogic: Suppress Component &amp;amp; Constraints&lt;/A&gt;, that has some potential. The only problem is the need to cycle through all the constraints in the file and compare the suppression state. This might increase the time to cycle through the code more than I like. If anyone has another suggestion, I am open to other solutions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 17:51:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8383739#M91056</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2018-11-06T17:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8384024#M91069</link>
      <description>&lt;P&gt;I found a solution.&lt;/P&gt;&lt;PRE&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oConstrs As AssemblyConstraints = oAsmDef.Constraints

For Each oConstr As AssemblyConstraint In oConstrs
    If oConstr.OccurrenceOne.Suppressed = True Or oConstr.OccurrenceOne.Suppressed = True Then
        oConstr.Suppressed = True
    Else
        oConstr.Suppressed = False
    End If
Next&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 19:17:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8384024#M91069</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2018-11-06T19:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8384286#M91075</link>
      <description>&lt;P&gt;Minor error in the code in previous post. Tried to edit, but could not find an edit button for the post, so here is the correction.&lt;/P&gt;&lt;PRE&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oConstrs As AssemblyConstraints = oAsmDef.Constraints

For Each oConstr As AssemblyConstraint In oConstrs
    If oConstr.OccurrenceOne.Suppressed = True Or oConstr.&lt;STRONG&gt;OccurrenceTwo&lt;/STRONG&gt;.Suppressed = True Then
        oConstr.Suppressed = True
    Else
        oConstr.Suppressed = False
    End If
Next&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 21:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/8384286#M91075</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2018-11-06T21:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/9077424#M102053</link>
      <description>&lt;P&gt;Since my original post and solution, I found an instance where the code did not function as expected. It took some time to figure out why it kept giving me the error "Object reference not set to an instance of an object." This error occurs when one or both items being constrained is a plane. It would probably error on a point or axis as well.&lt;/P&gt;&lt;P&gt;My first thought was to verify the object type, but the errors continued. That is when it occurred to me to verify that the object occurrence had a value. The code below is the result. Because of the way this is written, it will never change the suppression on a constraint of two planes. If anyone has a better function, please share.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oConstrs As AssemblyConstraints = oAsmDef.Constraints

For Each oConstr As AssemblyConstraint In oConstrs		
	If Not IsNothing(oConstr.OccurrenceOne) And Not IsNothing(oConstr.OccurrenceTwo) Then
    	    If oConstr.OccurrenceOne.Suppressed = True Or oConstr.OccurrenceTwo.Suppressed = True Then
	        oConstr.Suppressed = True
	    Else
	        oConstr.Suppressed = False
	    End If
	ElseIf Not IsNothing(oConstr.OccurrenceOne) And IsNothing(oConstr.OccurrenceTwo) Then
	    If oConstr.OccurrenceOne.Suppressed = True Then
	        oConstr.Suppressed = True
	    Else
	        oConstr.Suppressed = False
	    End If
	ElseIf IsNothing(oConstr.OccurrenceOne) And Not IsNothing(oConstr.OccurrenceTwo) Then
	    If oConstr.OccurrenceTwo.Suppressed = True Then
	        oConstr.Suppressed = True
	    Else
	        oConstr.Suppressed = False
	    End If
	End If
Next&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Oct 2019 21:34:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/9077424#M102053</guid>
      <dc:creator>insomnix</dc:creator>
      <dc:date>2019-10-09T21:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/9528763#M111070</link>
      <description>&lt;P&gt;Great! This code will help me so much.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 08:21:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/9528763#M111070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-20T08:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Find All Constraints For Specified Component - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/10268332#M123752</link>
      <description>&lt;P&gt;Hi insomnix,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realise this is an old post, but thought I'd post here before starting a new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used Inventor for a while, but am new to ilogic and would like to find a neat way of suppressing/unsuppressing the constraints specific to a particular component within my assembly if it is supressed/unsupressed. Below is the code in which I control the suppression state of the related constraints explicitly. There aren't that many constraints so I can punch out the code for teh whole assembly relatively easily, but it would be great if there was a short-ish piece of code that could cycle through and do the job so that if the constraints are changed in the future or names of constraints edited then the iLogic rule wouldn't need to be updated with the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked through your code, but with my limited experience didn't understand how I would use it in my rule below specific to the component "FLANGE_TOP_#3:1" for example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;TF_LENGTH_3&lt;/SPAN&gt; = 0 &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"FLANGE_TOP_#3:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flush:FRONT_TF3"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:TF3_WEB"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:END_TF2_TF3"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:END_TF3_TF4"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
		
&lt;SPAN&gt;ElseIf&lt;/SPAN&gt; &lt;SPAN&gt;TF_LENGTH_3&lt;/SPAN&gt; &amp;gt; 0 &lt;SPAN&gt;And&lt;/SPAN&gt; &lt;SPAN&gt;TF_LENGTH_4&lt;/SPAN&gt; = 0 &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"FLANGE_TOP_#3:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flush:FRONT_TF3"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:TF3_WEB"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:END_TF2_TF3"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Constraint&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Mate:END_TF3_TF4"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;BR /&gt;End If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inventor 2021&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 10:13:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/find-all-constraints-for-specified-component-ilogic/m-p/10268332#M123752</guid>
      <dc:creator>rogerJDLE5</dc:creator>
      <dc:date>2021-04-26T10:13:56Z</dc:date>
    </item>
  </channel>
</rss>

