<?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: Create plane using cylindrical face inside an assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13651623#M25383</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16570444"&gt;@tim11_manhhieu&lt;/a&gt;.&amp;nbsp; Here is one possible example for creating a WorkAxis for a cylindrical part face in an assembly.&amp;nbsp; This assumes that you wanted the WorkAxis to be created within the active assembly, not within the part.&amp;nbsp; As stated above, we can only create work features in an assembly as 'fixed'.&amp;nbsp; But we can 'update' those fixed work features in an assembly by code, if needed.&amp;nbsp; I just tested this, and it worked just fine for me, so I hope it will work OK for you also, and is what you wanted.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oInvApp As Inventor.Application = ThisApplication
Dim oADoc As Inventor.AssemblyDocument = TryCast(oInvApp.ActiveDocument, Inventor.AssemblyDocument)
If oADoc Is Nothing Then Return
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oCylFace As Inventor.Face = oInvApp.CommandManager.Pick(SelectionFilterEnum.kPartFaceCylindricalFilter, "Pick Cylindrical Face")
If oCylFace Is Nothing Then Return
Dim oCyl As Inventor.Cylinder = oCylFace.Geometry
Dim oWAxes As Inventor.WorkAxes = oADef.WorkAxes
Dim oWAxis As Inventor.WorkAxis = oWAxes.AddFixed(oCyl.BasePoint, oCyl.AxisVector, False)
oADoc.Update2(True)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 May 2025 12:37:12 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2025-05-27T12:37:12Z</dc:date>
    <item>
      <title>Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860279#M25378</link>
      <description>&lt;P&gt;I am trying to create a plane using an axis of a curved face. The code works fine when I run it inside a part, but it crashes when I attempt to do it inside an assembly. My code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&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;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCurFace&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;kPartFaceCylindricalFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select the cylinder face"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPlanFace&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;kPartFacePlanarFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Select a face or plane paralell to the new plane"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAxis&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkAxis&lt;/SPAN&gt; = &lt;SPAN&gt;oDef&lt;/SPAN&gt;.&lt;SPAN&gt;WorkAxes&lt;/SPAN&gt;.&lt;SPAN&gt;AddByRevolvedFace&lt;/SPAN&gt;(&lt;SPAN&gt;oCurFace&lt;/SPAN&gt;)
&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;oDef.WorkPlanes.AddByLinePlaneAndAngle(oAxis, oPlanFace, 0)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code crashes in line 5 when I try to get the axis of the curved face. My assumption is that Inventor can't get the axis of the face since it is inside the part and not at the assembly level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have a solution for this?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 17:42:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860279#M25378</guid>
      <dc:creator>dialunau</dc:creator>
      <dc:date>2023-03-30T17:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860317#M25379</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9854368"&gt;@dialunau&lt;/a&gt;.&amp;nbsp; When you use the Pick command within an assembly, you should already be selecting the top level proxy of the geometry you select, so I don't think it is a context issue.&amp;nbsp; Can you create that WorkPlane using those same inputs, in that same order manually?&amp;nbsp; This might actually be a restricted method to use by code within an assembly, because the online help for that method does mention that.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=WorkPlanes_AddByLinePlaneAndAngle" target="_blank" rel="noopener"&gt;WorkPlanes.AddByLinePlaneAndAngle Method&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may have to use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=WorkPlanes_AddFixed" target="_blank" rel="noopener"&gt;WorkPlanes.AddFixed&lt;/A&gt; method instead, but that one requires different inputs.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 17:55:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860317#M25379</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-03-30T17:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860663#M25380</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I tried to create the plane manually using the same inputs, but Inventor doesn't recognize the axis of the curved face as a valid line for the plane creation, only geometry edges and sketched lines work for the plane creation features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a plane in the middle of the cylindrical face using its axis and a planar face, so I would rather not use the &lt;STRONG&gt;addfixed&lt;/STRONG&gt; method since it would require more defining the middle point of the curved surface, as well as defining the x and y axes for the planar face I pick.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 20:37:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11860663#M25380</guid>
      <dc:creator>dialunau</dc:creator>
      <dc:date>2023-03-30T20:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11861075#M25381</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9854368"&gt;@dialunau&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp; was saying that Inventor's API restricts plane creation inside Assemblies to only the .AddFixed Method.&amp;nbsp; None of the other methods will work inside an assembly by design.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can create the fixed plane with your two inputs pretty easily, but it will not act like a workplane added through the UI, will not adapt as components move. This could be faked with a more complex rule that "tags" the entities with attributes and setup a rule to run on some event trigger to update the fixed plane&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an easy way to get the fixed plane from your same inputs:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition

Dim oCurFace As Face = ThisApplication.CommandManager.Pick(kPartFaceCylindricalFilter, "Select the cylinder face")
Dim oPlanFace As Face = ThisApplication.CommandManager.Pick(kPartFacePlanarFilter, "Select a face or plane paralell to the new plane")

Dim oBasePoint As Point = oCurFace.Geometry.BasePoint
Dim Yaxis As UnitVector = oCurFace.Geometry.AxisVector
Dim Zaxis As UnitVector = oPlanFace.Geometry.Normal
Dim Xaxis As UnitVector = Zaxis.CrossProduct(Yaxis)

oDef.WorkPlanes.AddFixed(oBasePoint, Xaxis, Yaxis)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 00:40:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/11861075#M25381</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2023-03-31T00:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13650878#M25382</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;if I want to create an axis of a cylindrical surface of a part in an assembly environment, how do I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oCurFace As Face = ThisApplication.CommandManager.Pick(kPartFaceCylindricalFilter, "Select the cylinder face")

Dim oAxis As WorkAxis = oDef.WorkAxes.AddByRevolvedFace(oCurFace)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 May 2025 06:37:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13650878#M25382</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-05-27T06:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13651623#M25383</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16570444"&gt;@tim11_manhhieu&lt;/a&gt;.&amp;nbsp; Here is one possible example for creating a WorkAxis for a cylindrical part face in an assembly.&amp;nbsp; This assumes that you wanted the WorkAxis to be created within the active assembly, not within the part.&amp;nbsp; As stated above, we can only create work features in an assembly as 'fixed'.&amp;nbsp; But we can 'update' those fixed work features in an assembly by code, if needed.&amp;nbsp; I just tested this, and it worked just fine for me, so I hope it will work OK for you also, and is what you wanted.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oInvApp As Inventor.Application = ThisApplication
Dim oADoc As Inventor.AssemblyDocument = TryCast(oInvApp.ActiveDocument, Inventor.AssemblyDocument)
If oADoc Is Nothing Then Return
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oCylFace As Inventor.Face = oInvApp.CommandManager.Pick(SelectionFilterEnum.kPartFaceCylindricalFilter, "Pick Cylindrical Face")
If oCylFace Is Nothing Then Return
Dim oCyl As Inventor.Cylinder = oCylFace.Geometry
Dim oWAxes As Inventor.WorkAxes = oADef.WorkAxes
Dim oWAxis As Inventor.WorkAxis = oWAxes.AddFixed(oCyl.BasePoint, oCyl.AxisVector, False)
oADoc.Update2(True)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 12:37:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13651623#M25383</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-05-27T12:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13652575#M25384</link>
      <description>&lt;P&gt;Thank&amp;nbsp; you for your code.&lt;/P&gt;&lt;P&gt;I'm struggling with the AddByRevolvedFace method,&lt;/P&gt;&lt;P&gt;and if I use the AddFixed method, I don't know where to find the arguments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 00:53:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13652575#M25384</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-05-28T00:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13653818#M25385</link>
      <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=WorkAxes_AddByRevolvedFace" target="_blank" rel="noopener"&gt;WorkAxes.AddByRevolvedFace&lt;/A&gt;&amp;nbsp;method will only work when creating a WorkAxis in the context of a part, but will not work when creating one in the context of an assembly.&amp;nbsp; The online documentation for that method (and most other similar methods) tell us this.&amp;nbsp; So, when we are creating a WorkAxis in the context of an assembly, the only option we have is the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=WorkAxes_AddFixed" target="_blank" rel="noopener"&gt;WorkAxes.AddFixed&lt;/A&gt;&amp;nbsp;method.&amp;nbsp; The AddFixed method wants us to specify an &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-Point" target="_blank" rel="noopener"&gt;Inventor.Point&lt;/A&gt; type object, then an &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-UnitVector" target="_blank" rel="noopener"&gt;Inventor.UnitVector&lt;/A&gt; object.&amp;nbsp; When we have selected a face using the '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=CommandManager_Pick" target="_blank" rel="noopener"&gt;Pick&lt;/A&gt;' function and the '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=SelectionFilterEnum" target="_blank" rel="noopener"&gt;SelectionFilterEnum&lt;/A&gt;.kPartFaceCylindricalFilter' selection filter, and confirmed that we actually picked something, then we can be confident that the face we selected is cylindrical in shape.&amp;nbsp; Keep in mind that if we are using the Pick function while an assembly is the active document, the face will be a FaceProxy instead of a regular Face, but in this case, we actually want to be working with the proxy, so that the WorkAxis will be created in the correct location within the context of the assembly.&amp;nbsp; When we have a cylindrical face, then its '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Face_Geometry" target="_blank" rel="noopener"&gt;Geometry&lt;/A&gt;' property should return an &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-Cylinder" target="_blank" rel="noopener"&gt;Inventor.Cylinder&lt;/A&gt; type object.&amp;nbsp; But if not sure about that, you can always check the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Face_SurfaceType" target="_blank" rel="noopener"&gt;Face.SurfaceType&lt;/A&gt;&amp;nbsp;property's value, which will be a variation of the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=SurfaceTypeEnum" target="_blank" rel="noopener"&gt;SurfaceTypeEnum&lt;/A&gt;.&amp;nbsp; So, we can create a Cylinder Type variable, then set its value with that Face.Geometry property, then use that variable to access the properties of that Cylinder object.&amp;nbsp; The 3 main properties of a Cylinder are its &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Cylinder_BasePoint" target="_blank" rel="noopener"&gt;BasePoint&lt;/A&gt;&amp;nbsp;which has an Inventor.Point type value, its &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Cylinder_AxisVector" target="_blank" rel="noopener"&gt;AxisVector&lt;/A&gt;&amp;nbsp;which has a UnitVector type value, and its &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Cylinder_Radius" target="_blank" rel="noopener"&gt;Radius&lt;/A&gt;&amp;nbsp;which has a Double type value.&amp;nbsp; Two of those (BasePoint &amp;amp; AxisVector) we can use as inputs into that WorkAxes.AddFixed method.&amp;nbsp; Since the WorkAxis is being created as 'Fixed', it will not move or update if/when the component with the cylindrical face moves.&amp;nbsp; As mentioned before, we can later run a rule that will find that cylindrical face again, then find that existing fixed WorkAxis, get its 'definition', then attempt to change its location and direction to be the same as the cylindrical face, but we can not change how the WorkAxis is 'defined' to be truly 'associative' to that cylindrical face so that it will move with it.&amp;nbsp; I have attempted to use the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=WorkAxis_SetByRevolvedFace" target="_blank" rel="noopener"&gt;WorkAxis.SetByRevolvedFace&lt;/A&gt;&amp;nbsp;method on the pre-existing fixed WorkAxis before to associate it with a cylindrical face after the fact, but it would always throw an error instead of work, because it is in the context of an assembly.&amp;nbsp; If you do not want to use the center axis of a cylinder as the input for the AddFixed method, you can attempt to create the UnitVector from scratch instead, using the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=TransientGeometry_CreateUnitVector" target="_blank" rel="noopener"&gt;TransientGeometry.CreateUnitVector&lt;/A&gt;&amp;nbsp;method instead.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 12:43:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13653818#M25385</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-05-28T12:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create plane using cylindrical face inside an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13655060#M25386</link>
      <description>&lt;P&gt;Your explanations are always detailed and easy to understand.&lt;/P&gt;&lt;P&gt;Appreciate.&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2025 00:22:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-plane-using-cylindrical-face-inside-an-assembly/m-p/13655060#M25386</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-05-29T00:22:45Z</dc:date>
    </item>
  </channel>
</rss>

