<?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 Pick function to select faces in a part file in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5977432#M60729</link>
    <description>&lt;P&gt;Not sure if the Part environment is different, but this is what I use for assemblies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities,"Select the face")&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I'm on the hunt for a kParallelPlaneFilter if anyone happens to know the syntax for that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2016 13:08:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-01-07T13:08:11Z</dc:date>
    <item>
      <title>iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5764231#M57911</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a part file, I am trying to control and switch the color of certain faces through a view representation.&amp;nbsp; I&amp;nbsp;made a manual process for this and&amp;nbsp;now trying to create a rule in iLogic to automate this procedure.&amp;nbsp; See&amp;nbsp;pdf for the step-by-step.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I believe&amp;nbsp;I need the&amp;nbsp;pick(k...filter) function in order for this work but I cannot figure how to&amp;nbsp;write the function to&amp;nbsp;select faces on a part file.&amp;nbsp; I have only seen this command&amp;nbsp;be&amp;nbsp;applied&amp;nbsp;in assembly files for part instances.&amp;nbsp; I&amp;nbsp;managed to put this together so far.&amp;nbsp; Can someone explain how to use this function to select multi faces&amp;nbsp;and change the color of&amp;nbsp;those faces in a part file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oPartDoc As PartDocument&lt;BR /&gt;oPartDoc = ThisApplication.ActiveDocument&lt;BR /&gt;Dim oPartDef As PartComponentDefinition&lt;BR /&gt;oPartDef = oPartDoc.ComponentDefinition&lt;BR /&gt;Dim oFeature As PartFeature&lt;BR /&gt;&amp;nbsp;&amp;nbsp; For Each oFeature In oPartDoc.ComponentDefinition.Features&lt;BR /&gt;&amp;nbsp; Feature.Color(oFeature.Name)="As Part"&lt;BR /&gt;&amp;nbsp;Next&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'Step 2 : part i cannot figure out.&amp;nbsp; It will be something like:&lt;/P&gt;&lt;P&gt;' This.Application.CommandManager.Pick ( k...Filter, "Select the face")&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oPartDef.RepresentationsManager.DesignViewRepresentations.Add("Red Surfaces")&lt;/P&gt;&lt;P&gt;Dim oColor As RenderStyle&lt;BR /&gt;oColor = oPartDoc.RenderStyles.Item("4-Red")&lt;BR /&gt;oPartDoc.ActiveRenderStyle = oColor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 14:59:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5764231#M57911</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-10T14:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5977432#M60729</link>
      <description>&lt;P&gt;Not sure if the Part environment is different, but this is what I use for assemblies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities,"Select the face")&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I'm on the hunt for a kParallelPlaneFilter if anyone happens to know the syntax for that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 13:08:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5977432#M60729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-07T13:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5977560#M60731</link>
      <description>&lt;P&gt;I am still fiddling with mine.&amp;nbsp; It looks like kAllPlanarEntities will highlight a face but it crashes when I attempt to apply a color to the face so I am not sure yet it is the command or if something else is wrong with my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe try kWorkPlaneFilter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not know about this tool at the time of my original post but&amp;nbsp;enter the&amp;nbsp;VBA editor in Inventor&amp;nbsp;(you can find it under tools or type in the search bar)&amp;nbsp;.&amp;nbsp; Then press F2 and type&amp;nbsp;kfilter into the search bar.&amp;nbsp; If I had to guess the kSketchBlockFilter member is the most relevant but it looks like kWorkPlaneFilter exist in all the members.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 14:09:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5977560#M60731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-07T14:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5978964#M60748</link>
      <description>&lt;P&gt;Here's a small iLogic Rule that will change the color of Faces as you select them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SyntaxEditor Code Snippet&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Public&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFace&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt;

&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Copy the asset from the library to this document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;localAsset&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Asset&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;&lt;SPAN&gt;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t;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kAllPlanarEntities&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Pick a feature&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;oFace&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; 
        &lt;SPAN&gt;oFace&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Appearance&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;localAsset&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Loop&lt;/SPAN&gt; &lt;SPAN&gt;While&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;oFace&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt;

&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jan 2016 05:22:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5978964#M60748</guid>
      <dc:creator>rjay75</dc:creator>
      <dc:date>2016-01-08T05:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5980195#M60782</link>
      <description>&lt;P&gt;Thank you, this code will work for my purposes&amp;nbsp;but I noticed a couple of things that maybe of&amp;nbsp;value&amp;nbsp;to point out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; As the name would suggest, &lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kAllPlanarEntities will only work flat planes.&amp;nbsp; I ended up switching it to SelectionFilterEnum&lt;SPAN&gt;.&lt;/SPAN&gt;kPartFaceFilter in order to be able to also select curved surfaces.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp; For an asset, .&lt;SPAN&gt;CopyTo will fail if it&amp;nbsp;you copy to a&amp;nbsp;location that&amp;nbsp;already&amp;nbsp;exist.&amp;nbsp; In other words,&amp;nbsp;you can only run this rule only&amp;nbsp;once with a&amp;nbsp;particular apperance asset.&amp;nbsp; I have not implemented it yet&amp;nbsp;but&amp;nbsp;looking at the help page on asset objects,&amp;nbsp;I think&amp;nbsp;would need&amp;nbsp;to have a delete asset method prior to the&amp;nbsp;CopyTo and use the IsUsed&amp;nbsp;property as a condition to&amp;nbsp;make sure&amp;nbsp;it&amp;nbsp;exist.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sorry if this is off topic but originally I&amp;nbsp;planned to set the appearance&amp;nbsp;to "As Feature", "As Body, etc.&amp;nbsp;&amp;nbsp;These options exist when when you right-click and go to properties but they do not exist in the Appearance Browser.&amp;nbsp;&amp;nbsp;I also confirmed that I cannot&amp;nbsp;CopyTo As Body.&amp;nbsp;&amp;nbsp;It is&amp;nbsp;like "As Feature" and "As Body"&amp;nbsp;are sometimes grouped with appearance assets but at the same time they do not seem to be treated as appearance assets because it is not something that will be in the library and they do not work in the code.&amp;nbsp;&amp;nbsp;Are they Appearance Assets?&amp;nbsp; If not, what are they and what&amp;nbsp;member are they associated with?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2016 19:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/5980195#M60782</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-08T19:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Pick function to select faces in a part file</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/8552293#M93657</link>
      <description>&lt;P&gt;I like the code.&lt;/P&gt;
&lt;P&gt;Also, I like to expand the idea for components in an assembly document: i.e. to keep selecting some components until done.&lt;/P&gt;
&lt;P&gt;When the rule is done, selected parts must be available (as selected using Ctrl+V) for further processing.&lt;/P&gt;
&lt;P&gt;I appreciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LAF-0001.png" style="width: 781px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/595808i5BD3BCA6E28C1739/image-size/large?v=v2&amp;amp;px=999" role="button" title="LAF-0001.png" alt="LAF-0001.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 08:05:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-pick-function-to-select-faces-in-a-part-file/m-p/8552293#M93657</guid>
      <dc:creator>RoyWickrama_RWEI</dc:creator>
      <dc:date>2019-01-27T08:05:06Z</dc:date>
    </item>
  </channel>
</rss>

