<?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: How to select components by using part name in Ilogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922660#M99870</link>
    <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try below iLogic code.&lt;/P&gt;
&lt;PRE&gt;Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oAxis1 As WorkAxis
Dim oAxis2 As WorkAxis
Dim oproxyAxis2 As WorkAxisProxy
Dim oAConstraint As AngleConstraint
Dim comps As New List(Of ComponentOccurrence)
For Each comp As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences
oFilename = comp.Definition.Document.displayname
If InStr(oFilename, "VLV_MAN") &amp;lt;&amp;gt; 0 Or InStr(oFilename, "VLV_HYD") &amp;lt;&amp;gt; 0 Then
comps.Add(comp)
End If
Next
' If there are selected components we can do something
For Each comp In comps
On Error Resume Next

	Dim oAngle As Boolean
    oAngle = False
    
    Dim oConstraint As AssemblyConstraint
    For Each oConstraint In comp.Constraints
        If oConstraint.Type = kAngleConstraintObject Then
            oAngle = True
        End If
    Next
    
    If oAngle = False Then
        oAxis1 = oAsmCompDef.WorkAxes.Item ("Y Axis")
		oAxis2 = comp.Definition.WorkAxes("Y Axis")
		comp.CreateGeometryProxy(oAxis2, oproxyAxis2)
		oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)
		'78594 refers to the undirected angle constraint solution type. 78593 refers to
		'directed (which is default), and 78595 is the referenced vector solution

		If oAConstraint.HealthStatus = oAConstraint.HealthStatus.kInconsistentHealth Then
			oAConstraint.Delete
			oAxis1 = oAsmCompDef.WorkAxes.Item("Z Axis")
			oAxis2 = comp.Definition.WorkAxes("Y Axis")
			comp.CreateGeometryProxy(oAxis2, oproxyAxis2)
			oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)
			'78594 refers to the undirected angle constraint solution type. 78593 refers to
			'directed (which is default), and 78595 is the referenced vector solution
		End If
    End If

Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2019 11:59:48 GMT</pubDate>
    <dc:creator>chandra.shekar.g</dc:creator>
    <dc:date>2019-07-22T11:59:48Z</dc:date>
    <item>
      <title>How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916513#M99766</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on one Layout assembly, This assembly having different type of gate valves mentioned below as well as some other components also.&lt;/P&gt;&lt;P&gt;I want to select only the Gate valves by using the Part name.&amp;nbsp; Please give your suggestions.&lt;/P&gt;&lt;P&gt;Gate valve Part names:&lt;/P&gt;&lt;P&gt;VLV_MAN_3-5.iam&lt;/P&gt;&lt;P&gt;VLV_HYD_3-5.ipt&lt;/P&gt;&lt;P&gt;VLV_HYD_3-10.iam&lt;/P&gt;&lt;P&gt;Above the part names of Gate valves, So I want to select the components which part names start with "VLV_MAN"&amp;amp;"VLV_HYD"&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Manoj Sampath&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 09:51:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916513#M99766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-18T09:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916606#M99768</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best thing is to probably loop through all occurences in the assembly and then check if the name matches to one of your predefined names.&lt;/P&gt;&lt;P&gt;Then create an object collection which will hold all those items.&lt;/P&gt;&lt;P&gt;After that you can use the SelectMultiple in SelectSet to select them.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 10:35:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916606#M99768</guid>
      <dc:creator>Majjek</dc:creator>
      <dc:date>2019-07-18T10:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916762#M99774</link>
      <description>&lt;P&gt;Hi, try the following code, I think it could work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;AssyDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;AssyDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN&gt;oFilename&lt;/SPAN&gt; = &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;displayname&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;oFilename&lt;/SPAN&gt;, &lt;SPAN&gt;"VLV_MAN"&lt;/SPAN&gt;) &amp;lt;&amp;gt; 0 &lt;SPAN&gt;Then&lt;/SPAN&gt; 
		&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;DoSelect&lt;/SPAN&gt;(&lt;SPAN&gt;oOcc&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;oFilename&lt;/SPAN&gt;, &lt;SPAN&gt;"VLV_HYD"&lt;/SPAN&gt;) &amp;lt;&amp;gt; 0 &lt;SPAN&gt;Then&lt;/SPAN&gt; 
		&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;DoSelect&lt;/SPAN&gt;(&lt;SPAN&gt;oOcc&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I hope this helps with your problem. regards&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 11:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8916762#M99774</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2019-07-18T11:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8917084#M99782</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The Loop Code is working fine to select the components.&lt;/P&gt;&lt;P&gt;I need to constraint these selected gate valves with respect to Assembly "Y Axis"&lt;/P&gt;&lt;P&gt;So I have created below Loop code by using your suggested Code, But I'm getting error while run the rule.&lt;/P&gt;&lt;P&gt;Can you please help to find the error in below code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument&lt;BR /&gt;Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition&lt;/P&gt;&lt;P&gt;Dim oAxis1 As WorkAxis&lt;BR /&gt;Dim oAxis2 As WorkAxis&lt;BR /&gt;Dim oproxyAxis1 As WorkAxisProxy&lt;BR /&gt;Dim oAConstraint As AngleConstraint&lt;/P&gt;&lt;P&gt;Dim comps As ObjectCollection&lt;BR /&gt;Dim comp As ComponentOccurrence&lt;/P&gt;&lt;P&gt;comps = ThisApplication.TransientObjects.CreateObjectCollection&lt;BR /&gt;comp = oAsmCompDef.Occurrences&lt;BR /&gt;oFilename = comp.Definition.Document.displayname&lt;BR /&gt;If InStr(oFilename, "VLV_MAN") &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;ThisApplication.CommandManager.DoSelect(comp)&lt;BR /&gt;End If&lt;BR /&gt;If InStr(oFilename, "VLV_HYD") &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;ThisApplication.CommandManager.DoSelect(comp)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;comps.Add(comp)&lt;/P&gt;&lt;P&gt;' If there are selected components we can do something&lt;BR /&gt;For Each comp In comps&lt;BR /&gt;oAxis1 = oAsmCompDef.WorkAxes.Item ("Y Axis")&lt;BR /&gt;oAxis2 = comp.Definition.WorkAxes("Y Axis")&lt;/P&gt;&lt;P&gt;comp.CreateGeometryProxy(oAxis2, oproxyAxis2)&lt;/P&gt;&lt;P&gt;oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)&lt;BR /&gt;'78594 refers to the undirected angle constraint solution type. 78593 refers to&lt;BR /&gt;'directed (which is default), and 78595 is the referenced vector solution&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Manoj Sampath&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 13:57:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8917084#M99782</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-18T13:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8917220#M99787</link>
      <description>&lt;P&gt;try the following code, I think it could work, I have placed the instruction on error resume next in the last for-next in case errors are generated in this sector, should control this sector of code then, if the previous block works. regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsm&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAxis1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkAxis&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAxis2&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkAxis&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oproxyAxis1&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkAxisProxy&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAConstraint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AngleConstraint&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;comps&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ObjectCollection&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateObjectCollection&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;comp&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt;  &lt;SPAN&gt;oAsm&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN&gt;oFilename&lt;/SPAN&gt; = &lt;SPAN&gt;comp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;displayname&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;oFilename&lt;/SPAN&gt;, &lt;SPAN&gt;"VLV_MAN"&lt;/SPAN&gt;) &amp;lt;&amp;gt; 0 &lt;SPAN&gt;Or&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;oFilename&lt;/SPAN&gt;, &lt;SPAN&gt;"VLV_HYD"&lt;/SPAN&gt;) &amp;lt;&amp;gt; 0  &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;comps&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;comp&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;' If there are selected components we can do something&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;comp&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;comps&lt;/SPAN&gt;
	&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;Resume&lt;/SPAN&gt; &lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;oAxis1&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;WorkAxes&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt; (&lt;SPAN&gt;"Y Axis"&lt;/SPAN&gt;)
	&lt;SPAN&gt;oAxis2&lt;/SPAN&gt; = &lt;SPAN&gt;comp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;WorkAxes&lt;/SPAN&gt;(&lt;SPAN&gt;"Y Axis"&lt;/SPAN&gt;)

	&lt;SPAN&gt;comp&lt;/SPAN&gt;.&lt;SPAN&gt;CreateGeometryProxy&lt;/SPAN&gt;(&lt;SPAN&gt;oAxis2&lt;/SPAN&gt;, &lt;SPAN&gt;oproxyAxis2&lt;/SPAN&gt;)

	&lt;SPAN&gt;oAConstraint&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Constraints&lt;/SPAN&gt;.&lt;SPAN&gt;AddAngleConstraint&lt;/SPAN&gt;(&lt;SPAN&gt;oproxyAxis2&lt;/SPAN&gt;, &lt;SPAN&gt;oAxis1&lt;/SPAN&gt;, 0, 78593)
	&lt;SPAN&gt;'78594 refers to the undirected angle constraint solution type. 78593 refers to&lt;/SPAN&gt;
	&lt;SPAN&gt;'directed (which is default), and 78595 is the referenced vector solution&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 14:38:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8917220#M99787</guid>
      <dc:creator>Sergio.D.Suárez</dc:creator>
      <dc:date>2019-07-18T14:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8918584#M99810</link>
      <description>&lt;P&gt;Hi Sergio,&lt;BR /&gt;&lt;BR /&gt;I have tried the code, Now the error message box is not coming but Angle constraints are not get creating.&lt;BR /&gt;The object collection function codes are fine (I have tried that code separately), I thing "&amp;nbsp;CreateGeometryProxy(oAxis2, oproxyAxis2)" function is not working for "comp".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Previously I have used below function to select the components by using Pick command and the Angle constraint function worked fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 25.71px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px; word-wrap: break-word;"&gt;comps = ThisApplication.TransientObjects.CreateObjectCollection&lt;BR /&gt;While True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 25.71px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px; word-wrap: break-word;"&gt;compOcc = ThisApplication.CommandManager.Pick(&lt;BR /&gt;SelectionFilterEnum.kAssemblyOccurrenceFilter,&lt;BR /&gt;"Select a component")&lt;BR /&gt;' If nothing gets selected then we're done&lt;BR /&gt;If IsNothing(compOcc) Then Exit While&lt;BR /&gt;comps.Add(compOcc)&lt;BR /&gt;End While&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f5f5; color: #3e3e3e; font-family: Menlo,Monaco,Consolas,'Courier New',monospace; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 25.71px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-break: break-all; word-spacing: 0px; word-wrap: break-word;"&gt;But Angle constraint function not working for below "comp" function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim comps As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection&lt;/P&gt;&lt;P&gt;For Each comp As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences&lt;BR /&gt;oFilename = comp.Definition.Document.displayname&lt;BR /&gt;If InStr(oFilename, "VLV_MAN") "Create&amp;lt;&amp;gt; 0 Or InStr(oFilename, "VLV_HYD") &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;comps.Add(comp)&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please give me your suggestion for this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Manoj Sampath&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 05:41:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8918584#M99810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-19T05:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8921013#M99851</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;Can you please check the loop code I have shared and give your idea&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Manoj Sampath&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jul 2019 16:52:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8921013#M99851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-20T16:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922397#M99861</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a little confusion about requirement. Are you trying to constrain selected occurrences or all occurrences of assembly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please re post non confidential source code that need to work on?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 09:11:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922397#M99861</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-07-22T09:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922426#M99862</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;I wanted to constraint selected occurrences not all occurrences.&lt;/P&gt;&lt;P&gt;After I got few reply for my post I have done little changes to my Loop code and it is working fine now.&lt;/P&gt;&lt;P&gt;But If run the code again it is creating Angle constraints again,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to include the condition " If the component already have angle constraint, new Angle constraint shouldn't create", Can you please help how add this condition on below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument&lt;BR /&gt;Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition&lt;BR /&gt;Dim oAxis1 As WorkAxis&lt;BR /&gt;Dim oAxis2 As WorkAxis&lt;BR /&gt;Dim oproxyAxis2 As WorkAxisProxy&lt;BR /&gt;Dim oAConstraint As AngleConstraint&lt;BR /&gt;Dim comps As New List(Of ComponentOccurrence)&lt;BR /&gt;For Each comp As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences&lt;BR /&gt;oFilename = comp.Definition.Document.displayname&lt;BR /&gt;If InStr(oFilename, "VLV_MAN") &amp;lt;&amp;gt; 0 Or InStr(oFilename, "VLV_HYD") &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;comps.Add(comp)&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;' If there are selected components we can do something&lt;BR /&gt;For Each comp In comps&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;oAxis1 = oAsmCompDef.WorkAxes.Item ("Y Axis")&lt;BR /&gt;oAxis2 = comp.Definition.WorkAxes("Y Axis")&lt;BR /&gt;comp.CreateGeometryProxy(oAxis2, oproxyAxis2)&lt;BR /&gt;oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)&lt;BR /&gt;'78594 refers to the undirected angle constraint solution type. 78593 refers to&lt;BR /&gt;'directed (which is default), and 78595 is the referenced vector solution&lt;/P&gt;&lt;P&gt;If oAConstraint.HealthStatus = oAConstraint.HealthStatus.kInconsistentHealth Then&lt;BR /&gt;oAConstraint.Delete&lt;BR /&gt;oAxis1 = oAsmCompDef.WorkAxes.Item("Z Axis")&lt;BR /&gt;oAxis2 = comp.Definition.WorkAxes("Y Axis")&lt;BR /&gt;comp.CreateGeometryProxy(oAxis2, oproxyAxis2)&lt;BR /&gt;oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)&lt;BR /&gt;'78594 refers to the undirected angle constraint solution type. 78593 refers to&lt;BR /&gt;'directed (which is default), and 78595 is the referenced vector solution&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Manoj Sampath&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 09:27:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922426#M99862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-22T09:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922616#M99867</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For every occurrence, only one angle constraint is used?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 11:36:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922616#M99867</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-07-22T11:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922629#M99868</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;Yes. While I run the code Angle constraint will create for components which have display name as " VLV_MAN" or "VLV_HYD".&amp;nbsp; I need function code for " If already that component having Angle constraint, Another one shouldn't not create".&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Manoj Sampath&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 11:44:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922629#M99868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-22T11:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to select components by using part name in Ilogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922660#M99870</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try below iLogic code.&lt;/P&gt;
&lt;PRE&gt;Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oAxis1 As WorkAxis
Dim oAxis2 As WorkAxis
Dim oproxyAxis2 As WorkAxisProxy
Dim oAConstraint As AngleConstraint
Dim comps As New List(Of ComponentOccurrence)
For Each comp As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences
oFilename = comp.Definition.Document.displayname
If InStr(oFilename, "VLV_MAN") &amp;lt;&amp;gt; 0 Or InStr(oFilename, "VLV_HYD") &amp;lt;&amp;gt; 0 Then
comps.Add(comp)
End If
Next
' If there are selected components we can do something
For Each comp In comps
On Error Resume Next

	Dim oAngle As Boolean
    oAngle = False
    
    Dim oConstraint As AssemblyConstraint
    For Each oConstraint In comp.Constraints
        If oConstraint.Type = kAngleConstraintObject Then
            oAngle = True
        End If
    Next
    
    If oAngle = False Then
        oAxis1 = oAsmCompDef.WorkAxes.Item ("Y Axis")
		oAxis2 = comp.Definition.WorkAxes("Y Axis")
		comp.CreateGeometryProxy(oAxis2, oproxyAxis2)
		oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)
		'78594 refers to the undirected angle constraint solution type. 78593 refers to
		'directed (which is default), and 78595 is the referenced vector solution

		If oAConstraint.HealthStatus = oAConstraint.HealthStatus.kInconsistentHealth Then
			oAConstraint.Delete
			oAxis1 = oAsmCompDef.WorkAxes.Item("Z Axis")
			oAxis2 = comp.Definition.WorkAxes("Y Axis")
			comp.CreateGeometryProxy(oAxis2, oproxyAxis2)
			oAConstraint = oAsmCompDef.Constraints.AddAngleConstraint(oproxyAxis2, oAxis1, 0, 78593)
			'78594 refers to the undirected angle constraint solution type. 78593 refers to
			'directed (which is default), and 78595 is the referenced vector solution
		End If
    End If

Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 11:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-select-components-by-using-part-name-in-ilogic/m-p/8922660#M99870</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-07-22T11:59:48Z</dc:date>
    </item>
  </channel>
</rss>

