<?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 Create Work Plane Proxy Given an origin plane in a part? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5570693#M55107</link>
    <description>&lt;P&gt;I figured it out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCylOrigPlane1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the origin plane of the cylinder")
oCylOrigPlane2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the a co-planar origin plane of the rod")

Dim oCompDef1 As ComponentDefinition = oCylOrigPlane1.Parent()
Dim oCompDef2 As ComponentDefinition = oCylOrigPlane2.Parent()

Dim oCompOcc1 As ComponentOccurrence = oAsmCompDef.Occurrences.AllReferencedOccurrences(oCompDef1).Item(1)
Dim oCompOcc2 As ComponentOccurrence = oAsmCompDef.Occurrences.AllReferencedOccurrences(oCompDef2).Item(1)

oCompOcc1.CreateGeometryProxy(oCylOrigPlane1, oAsmPlane1)
oCompOcc2.CreateGeometryProxy(oCylOrigPlane2, oAsmPlane2)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to be a workaround seeing as the intention is that there will ever only be one occurrence of each part in the assembly.&lt;/P&gt;</description>
    <pubDate>Sat, 04 Apr 2015 00:34:37 GMT</pubDate>
    <dc:creator>MechMachineMan</dc:creator>
    <dc:date>2015-04-04T00:34:37Z</dc:date>
    <item>
      <title>How to Create Work Plane Proxy Given an origin plane in a part?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5570652#M55106</link>
      <description>&lt;P&gt;As the title says, I'm trying to get the work plane proxy for use in an assembly - I'm trying to create an assembly mate constraint for two origin planes from within parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCylOrigPlane1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the origin plane of the cylinder")
oCylOrigPlane2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the a co-planar origin plane of the rod")
&lt;BR /&gt;
oCylOrigPlane1.Parent.CreateGeometryProxy(oCylOrigPlane1, oAsmPlane1)
oCylOrigPlane2.Parent.CreateGeometryProxy(oCylOrigPlane2, oAsmPlane2)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I cannot figure out how to get the ComponentOccurence that contains the selected workplane though &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@F462EEC827775DA92CB03B7FC147D389/emoticons/1f61e.png" alt=":disappointed_face:" title=":disappointed_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2015 23:28:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5570652#M55106</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2015-04-03T23:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Work Plane Proxy Given an origin plane in a part?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5570693#M55107</link>
      <description>&lt;P&gt;I figured it out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oCylOrigPlane1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the origin plane of the cylinder")
oCylOrigPlane2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkPlaneFilter, "Select the a co-planar origin plane of the rod")

Dim oCompDef1 As ComponentDefinition = oCylOrigPlane1.Parent()
Dim oCompDef2 As ComponentDefinition = oCylOrigPlane2.Parent()

Dim oCompOcc1 As ComponentOccurrence = oAsmCompDef.Occurrences.AllReferencedOccurrences(oCompDef1).Item(1)
Dim oCompOcc2 As ComponentOccurrence = oAsmCompDef.Occurrences.AllReferencedOccurrences(oCompDef2).Item(1)

oCompOcc1.CreateGeometryProxy(oCylOrigPlane1, oAsmPlane1)
oCompOcc2.CreateGeometryProxy(oCylOrigPlane2, oAsmPlane2)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to be a workaround seeing as the intention is that there will ever only be one occurrence of each part in the assembly.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2015 00:34:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5570693#M55107</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2015-04-04T00:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Work Plane Proxy Given an origin plane in a part?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571570#M55111</link>
      <description>&lt;P&gt;It's not clear what exactly you're workflow is but here are a couple of things that will hopefully help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you select something in an assembly you're getting the proxy for that object so the entities you're getting back from the Pick method can immediately be used to create a constraint because they're already a proxy in the context of the top-level assembly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, there are cases where you do need to create a proxy. &amp;nbsp;This is when&amp;nbsp;you have a reference to an entity in the context of the part or subassembly but then need a reference with respect to the top-level assembly. &amp;nbsp;For example, in your program it would probably more convenient to ask the user to select the cylinder part and then select the rod part, instead of having to select specific work planes. &amp;nbsp;In this case you have the occurrence but need to go into the part to get the correct plane (this assumes they've been named) and then create proxies of the planes to be able to use them in the context of the assembly. &amp;nbsp;Here's some&amp;nbsp;VBA code that demonstrates the entire process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub ConnectParts()
    ' Select the cylinder and rod occurrences.
    Dim cylPart As ComponentOccurrence
    Set cylPart = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select the cylinder part.")
    
    Dim rodPart As ComponentOccurrence
    Set rodPart = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select the rod part.")
    
    ' Find the origin work plane in the cylinder part.
    ' This leaves the context of the assembly because the
    ' component definitition returned is the same as if you
    ' opened the part by itself.
    Dim partDef As PartComponentDefinition
    Set partDef = cylPart.Definition
    Dim cylinderPlane As WorkPlane
    Set cylinderPlane = partDef.WorkPlanes.Item("OriginPlane")
    
    ' Find the origin plane in the rod part.
    Set partDef = rodPart.Definition
    Dim rodPlane As WorkPlane
    Set rodPlane = partDef.WorkPlanes.Item("OriginPlane")

    ' Create proxies for the two work planes.
    Dim cylPlaneProxy As WorkPlaneProxy
    Call cylPart.CreateGeometryProxy(cylinderPlane, cylPlaneProxy)
    Dim rodPlaneProxy As WorkPlaneProxy
    Call rodPart.CreateGeometryProxy(rodPlane, rodPlaneProxy)
    
    ' Create a mate constraint in the assembly.
    Dim asmDef As AssemblyComponentDefinition
    Set asmDef = ThisApplication.ActiveDocument.ComponentDefinition
    Call asmDef.Constraints.AddMateConstraint(cylPlaneProxy, rodPlaneProxy, 0)
End Sub
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2015 21:04:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571570#M55111</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2015-04-05T21:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Work Plane Proxy Given an origin plane in a part?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571591#M55114</link>
      <description>This wouldn't work as I need to select work planes to set the orientation&lt;BR /&gt;of the rod within the cylinder.&lt;BR /&gt;&lt;BR /&gt;I don't understand what you are saying; using the pick method was not&lt;BR /&gt;giving me the proxy as the program wasn't allowing me to use that plane in&lt;BR /&gt;a mate constraint right away.</description>
      <pubDate>Sun, 05 Apr 2015 21:29:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571591#M55114</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2015-04-05T21:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Work Plane Proxy Given an origin plane in a part?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571592#M55115</link>
      <description>However, thanks for the input! I will have to go back and double check this&lt;BR /&gt;to make sure I wasn't getting the error from elsewhere.</description>
      <pubDate>Sun, 05 Apr 2015 21:31:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-work-plane-proxy-given-an-origin-plane-in-a-part/m-p/5571592#M55115</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2015-04-05T21:31:23Z</dc:date>
    </item>
  </channel>
</rss>

