<?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: Remove part visibility in asm by custom property in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587255#M128332</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8010298"&gt;@mike.krudt&lt;/a&gt;.&amp;nbsp; I would need to know your total intentions for this rule, so that when I assemble everything together, it will work the way you want, without potential problems.&lt;/P&gt;
&lt;P&gt;Do you intend to only check one thing about each component, then depending on that one thing, turn Visibility of that component on or off?&lt;/P&gt;
&lt;P&gt;Or do you intend to check several things about each component, then if all checks turn out a certain way, then decide to turn visibility on or off?&amp;nbsp; If you want to check multiple things about each component, then those checks may need to be formatted a certain way to make it work better.&lt;/P&gt;
&lt;P&gt;Do you want/need to do any thing else to these components, as a result of these checks, besides turning their visibility on or off?&lt;/P&gt;
&lt;P&gt;If you let us know your overall goals in detail, then our proposed solutions might be more complete and useful to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assembled the codes from above into one as you asked for here, just looping through every part type component in all levels of the assembly, checking the value of it's custom iProperty "type", then if it is "CNC machined", it will ensure Visibility is on.&amp;nbsp; Then I also included the code to check the component's material, then also deal with it's visibility, but I left that part of the code commented out for now.&amp;nbsp; Since I don't really know the full extent of your intentions or plan, I'm not sure what all may need to be checked or what you need done when specific values are found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
For Each oLeafOcc As ComponentOccurrence In oADef.Occurrences.AllLeafOccurrences
	If iProperties.Value(oLeafOcc.Name, "Custom", "type") = "CNC machined" Then
		oLeafOcc.Visible = True
	ElseIf iProperties.Value(oLeafOcc.Name, "Custom", "type") = "laser" Then
		oLeafOcc.Visible = False
	End If
	'If iProperties.MaterialOfComponent(oLeafOcc.Name) = "Steel" Then
	'	oLeafOcc.Visible = False
	'End If
Next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, keep in mind that if any of those parts don't already have that custom property set-up within them, this rule might throw an error, because it will be trying to check the value of a property that doesn't exist.&amp;nbsp; This can be avoided with the use of error handling code, if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank" rel="noopener"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank" rel="noopener"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Aug 2021 12:17:54 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2021-08-31T12:17:54Z</dc:date>
    <item>
      <title>Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586928#M128316</link>
      <description>&lt;PRE&gt;&lt;FONT face="times new roman,times"&gt;&lt;SPAN class="Y2IQFc"&gt;Hi,
I'm trying to create an Ilogic code that removes visibility on all parts in my assembly that have a custom property

example:
I have a custom property called "type" that allows me to select the method of manufacture on all parts. (CNC, welding, laser, etc.)
Now I want to hide all parts with "laser" in this property. But how will the Ilogic code look like?

Another one:
Can I do the same as above just by hiding all the parts with a meterial, for example steel?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Aug 2021 09:28:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586928#M128316</guid>
      <dc:creator>mike.krudt</dc:creator>
      <dc:date>2021-08-31T09:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586972#M128317</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8010298"&gt;@mike.krudt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your "type" = "laser" below rule would work fine, you may replace the strings as per your need for further requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&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;oAsmCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;, &lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"type"&lt;/SPAN&gt;) = &lt;SPAN&gt;"laser"&lt;/SPAN&gt;
&lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;

&lt;SPAN&gt;Else&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;</description>
      <pubDate>Tue, 31 Aug 2021 09:51:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586972#M128317</guid>
      <dc:creator>bhavik4244</dc:creator>
      <dc:date>2021-08-31T09:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586992#M128319</link>
      <description>&lt;P&gt;Thanks that worked! &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And what if i want to hide all with the material "Steel"? &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 10:00:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10586992#M128319</guid>
      <dc:creator>mike.krudt</dc:creator>
      <dc:date>2021-08-31T10:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587003#M128320</link>
      <description>&lt;P&gt;And what if i want to look down in sub assemblies?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 10:03:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587003#M128320</guid>
      <dc:creator>mike.krudt</dc:creator>
      <dc:date>2021-08-31T10:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587062#M128323</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8010298"&gt;@mike.krudt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can try this one for Material,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&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;oAsmCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;


&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;MaterialOfComponent&lt;/SPAN&gt;(&lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;) = &lt;SPAN&gt;"Steel"&lt;/SPAN&gt;
  
		  &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
 &lt;SPAN&gt;Else&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;&lt;/P&gt;&lt;P&gt;To looping thru all occurance, it's bit gerneric but you can modify it for your need,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmDoc&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;oAsmDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmDef&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrencesEnumerator&lt;/SPAN&gt;
&lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;AllLeafOccurrences&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&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;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt;
&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;'add previous rules&lt;/SPAN&gt;

&lt;SPAN&gt;Next&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Aug 2021 10:32:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587062#M128323</guid>
      <dc:creator>bhavik4244</dc:creator>
      <dc:date>2021-08-31T10:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587153#M128327</link>
      <description>&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;I'm not strong at Ilogic, so maybe you can help put these together.

I have this now:&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&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;oAsmCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;iProperties&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;, &lt;SPAN&gt;"Custom"&lt;/SPAN&gt;, &lt;SPAN&gt;"Type"&lt;/SPAN&gt;) = &lt;SPAN&gt;"CNC machined"&lt;/SPAN&gt;
&lt;SPAN&gt;oOccurrence&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;

&lt;SPAN&gt;Else&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Now it needs to look through all the Sub assemblies
with this code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmDoc&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;oAsmDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmDef&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrencesEnumerator&lt;/SPAN&gt;
&lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;AllLeafOccurrences&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&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;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oLeafOccs&lt;/SPAN&gt;
   &lt;SPAN&gt;'add previous rules&lt;/SPAN&gt;

&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;What will the whole code look like?&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 11:27:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587153#M128327</guid>
      <dc:creator>mike.krudt</dc:creator>
      <dc:date>2021-08-31T11:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587255#M128332</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8010298"&gt;@mike.krudt&lt;/a&gt;.&amp;nbsp; I would need to know your total intentions for this rule, so that when I assemble everything together, it will work the way you want, without potential problems.&lt;/P&gt;
&lt;P&gt;Do you intend to only check one thing about each component, then depending on that one thing, turn Visibility of that component on or off?&lt;/P&gt;
&lt;P&gt;Or do you intend to check several things about each component, then if all checks turn out a certain way, then decide to turn visibility on or off?&amp;nbsp; If you want to check multiple things about each component, then those checks may need to be formatted a certain way to make it work better.&lt;/P&gt;
&lt;P&gt;Do you want/need to do any thing else to these components, as a result of these checks, besides turning their visibility on or off?&lt;/P&gt;
&lt;P&gt;If you let us know your overall goals in detail, then our proposed solutions might be more complete and useful to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assembled the codes from above into one as you asked for here, just looping through every part type component in all levels of the assembly, checking the value of it's custom iProperty "type", then if it is "CNC machined", it will ensure Visibility is on.&amp;nbsp; Then I also included the code to check the component's material, then also deal with it's visibility, but I left that part of the code commented out for now.&amp;nbsp; Since I don't really know the full extent of your intentions or plan, I'm not sure what all may need to be checked or what you need done when specific values are found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
For Each oLeafOcc As ComponentOccurrence In oADef.Occurrences.AllLeafOccurrences
	If iProperties.Value(oLeafOcc.Name, "Custom", "type") = "CNC machined" Then
		oLeafOcc.Visible = True
	ElseIf iProperties.Value(oLeafOcc.Name, "Custom", "type") = "laser" Then
		oLeafOcc.Visible = False
	End If
	'If iProperties.MaterialOfComponent(oLeafOcc.Name) = "Steel" Then
	'	oLeafOcc.Visible = False
	'End If
Next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, keep in mind that if any of those parts don't already have that custom property set-up within them, this rule might throw an error, because it will be trying to check the value of a property that doesn't exist.&amp;nbsp; This can be avoided with the use of error handling code, if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank" rel="noopener"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank" rel="noopener"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 12:17:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587255#M128332</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-08-31T12:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587341#M128336</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;/P&gt;&lt;P&gt;The code did exacly what i want &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The intension is to create view rep. on my assembly.&lt;/P&gt;&lt;P&gt;I have a very big assembly with a lot of different parts. In this assembly i want to create different view rep, that i can use in my idw.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefor i needed to turn off visibility of some parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side quistion:&lt;/P&gt;&lt;P&gt;Is it possible to do this on parts that contains somthing in their part number?&lt;/P&gt;&lt;P&gt;For example do I have a lot of washers, bolts, nuts etc. that I also want to hide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;They do not have any custom prop that I can sort by, but they all contain "DIN 933" in their part number. Can i turn of visibility of all parts containing "DIN 933" &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 12:49:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587341#M128336</guid>
      <dc:creator>mike.krudt</dc:creator>
      <dc:date>2021-08-31T12:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Remove part visibility in asm by custom property</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587506#M128340</link>
      <description>&lt;P&gt;OK.&amp;nbsp; I understand better now.&lt;/P&gt;
&lt;P&gt;Dealing with representations within an assembly, can get tricky.&amp;nbsp; Especially if trying to handle it all by code and trying to maintain the 'Associative' setting of component view representations at deeper levels.&amp;nbsp; Keep in mind that if any sub-assemblies are associatively set to a certain view representation, it might not like it when this code attempts to turn off visibility of a component within that sub-assembly.&amp;nbsp; You may need to set sub-assemblies to certain view representations too, in order to achieve your goals.&amp;nbsp; Just something to think about.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, you can check the component's Part Number for that text.&amp;nbsp; Here is an updated rule that retrieves the Part Number from each component.&amp;nbsp; Then checks to make sure it isn't blank/empty, then checks to see if it contains the specified data.&amp;nbsp; If it passes both checks it will turn visibility of that component off.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
For Each oLeafOcc As ComponentOccurrence In oADef.Occurrences.AllLeafOccurrences
	If iProperties.Value(oLeafOcc.Name, "Custom", "type") = "CNC machined" Then
		oLeafOcc.Visible = True
	ElseIf iProperties.Value(oLeafOcc.Name, "Custom", "type") = "laser" Then
		oLeafOcc.Visible = False
	End If
	'If iProperties.MaterialOfComponent(oLeafOcc.Name) = "Steel" Then
	'	oLeafOcc.Visible = False
	'End If
	Dim oPN As String = iProperties.Value(oLeafOcc.Name, "Project", "Part Number")
	If String.IsNullOrEmpty(oPN) = False AndAlso oPN.Contains("DIN 933") Then
		oLeafOcc.Visible = False
	End If
Next&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 13:43:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/remove-part-visibility-in-asm-by-custom-property/m-p/10587506#M128340</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-08-31T13:43:36Z</dc:date>
    </item>
  </channel>
</rss>

