<?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 How to Create Workplane At UCS Origin? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7884221#M82549</link>
    <description>&lt;P&gt;&lt;U&gt;Simplified Situation:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I have an assembly (assyDoc) which contains a UCS in 3D Space, not aligned relative to the origin at all. I would like to create a workplane, such as via &lt;EM&gt;AddByPlaneAndPoint,&amp;nbsp;&lt;/EM&gt;using an Assembly Origin Plane and the UCS Center Point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;What I've Tried:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I've tried using the UCS.origin, which returns a workpoint, but that errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var wp1 = workPlanes.AddByPlaneAndPoint(assyYZPlane, UCS.Origin);&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I&amp;nbsp;thought maybe the UCS origin and Center Point were not the same thing, so I tried creating a Pt using the 3 UCS planes first, but that also errors:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;var centerPt = workPoints.AddByThreePlanes(UCS.XYPlane, UCS.XZPlane, UCS.YZPlane);&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;It feels to me like I'm missing a proxy aspect the way that it wont create work features in the assembly using the UCS items, however, you can only create proxies (as far as i am aware) using componentOccurrences, which the UCS in the assembly is not. Maybe there is something i am missing that the UCS planes are not really at the same level in the assembly as I am thinking they are, but I see no other way of utilizing them or creating proxies of them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for any help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Nathan&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Mar 2018 13:52:09 GMT</pubDate>
    <dc:creator>NSBowser</dc:creator>
    <dc:date>2018-03-26T13:52:09Z</dc:date>
    <item>
      <title>How to Create Workplane At UCS Origin?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7884221#M82549</link>
      <description>&lt;P&gt;&lt;U&gt;Simplified Situation:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I have an assembly (assyDoc) which contains a UCS in 3D Space, not aligned relative to the origin at all. I would like to create a workplane, such as via &lt;EM&gt;AddByPlaneAndPoint,&amp;nbsp;&lt;/EM&gt;using an Assembly Origin Plane and the UCS Center Point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;What I've Tried:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I've tried using the UCS.origin, which returns a workpoint, but that errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var wp1 = workPlanes.AddByPlaneAndPoint(assyYZPlane, UCS.Origin);&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I&amp;nbsp;thought maybe the UCS origin and Center Point were not the same thing, so I tried creating a Pt using the 3 UCS planes first, but that also errors:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;var centerPt = workPoints.AddByThreePlanes(UCS.XYPlane, UCS.XZPlane, UCS.YZPlane);&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;It feels to me like I'm missing a proxy aspect the way that it wont create work features in the assembly using the UCS items, however, you can only create proxies (as far as i am aware) using componentOccurrences, which the UCS in the assembly is not. Maybe there is something i am missing that the UCS planes are not really at the same level in the assembly as I am thinking they are, but I see no other way of utilizing them or creating proxies of them.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for any help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Nathan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 13:52:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7884221#M82549</guid>
      <dc:creator>NSBowser</dc:creator>
      <dc:date>2018-03-26T13:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Workplane At UCS Origin?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7885603#M82573</link>
      <description>&lt;P&gt;If I remember correctly, not all plane creation method works.&amp;nbsp; Some wrok in part and some work in assembly.&amp;nbsp; Also what need to be passed are pretty specific type.&amp;nbsp; This took some trial and error so it may not be to best solution.&lt;/P&gt;&lt;P&gt;This is what I use to create point and planes on COG, VS VB.net Inventor addin:&lt;/P&gt;&lt;PRE&gt;    Private Sub COGUpdate()
      Dim oWorkPoint As WorkPoint
      Dim oWorkPlane As WorkPlane
      Dim vX, vY, vZ As UnitVector
      Dim oFixedDef As FixedWorkPointDef
      Dim oAssPtDef As AssemblyWorkPointDef
      Dim PointExist As Boolean = False
      Dim COGXYExist As Boolean = False
      Dim COGXZExist As Boolean = False
      Dim COGYZExist As Boolean = False
      Dim oDoc As Document = m_inventorApplication.ActiveDocument
      Dim oCenterOfMass As Point = oDoc.ComponentDefinition.MassProperties.CenterOfMass

      For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
        If oWorkPoint.Name = "COG" Then
          PointExist = True
          If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
            oAssPtDef = oWorkPoint.Definition
            oAssPtDef.Point = oCenterOfMass
          ElseIf oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
            oFixedDef = oWorkPoint.Definition
            oFixedDef.Point = oCenterOfMass
          End If
          oDoc.Update()
          Exit For
        End If
      Next

      If Not PointExist Then
        oWorkPoint = oDoc.ComponentDefinition.WorkPoints.AddFixed(oCenterOfMass)
        oWorkPoint.Name = "COG"
      End If

      vX = m_inventorApplication.TransientGeometry.CreateUnitVector(1, 0, 0)
      vY = m_inventorApplication.TransientGeometry.CreateUnitVector(0, 1, 0)
      vZ = m_inventorApplication.TransientGeometry.CreateUnitVector(0, 0, 1)

      For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
        Select Case oWorkPlane.Name
          Case "COG XY"
            oWorkPlane.SetFixed(oWorkPoint.Point, vX, vY)
            COGXYExist = True
            'oWorkPlane.Delete()
          Case "COG XZ"
            oWorkPlane.SetFixed(oWorkPoint.Point, vX, vZ)
            COGXZExist = True
            'oWorkPlane.Delete()
          Case "COG YZ"
            oWorkPlane.SetFixed(oWorkPoint.Point, vY, vZ)
            COGYZExist = True
          Case Else
            Exit Select
            'oWorkPlane.Delete()
        End Select
      Next

      If Not COGXYExist Then
        oWorkPlane = oDoc.ComponentDefinition.WorkPlanes.AddFixed(oWorkPoint.Point, vX, vY)
        oWorkPlane.Name = "COG XY"
      End If
      If Not COGXYExist Then
        oWorkPlane = oDoc.ComponentDefinition.WorkPlanes.AddFixed(oWorkPoint.Point, vX, vZ)
        oWorkPlane.Name = "COG XZ"
      End If
      If Not COGYZExist Then
        oWorkPlane = oDoc.ComponentDefinition.WorkPlanes.AddFixed(oWorkPoint.Point, vY, vZ)
        oWorkPlane.Name = "COG YZ"
      End If

      oDoc.Update()

    End Sub&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 20:43:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7885603#M82573</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2018-03-26T20:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Workplane At UCS Origin?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7900807#M82813</link>
      <description>&lt;P&gt;Thanks, I see now that MOST work plane (and other work feature) creation methods do not work in an assembly. Since we are pretty much left with fixed, I ended up&amp;nbsp;using your approach. Here's the portions that worked for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; UnitVector xUV = transGeo.CreateUnitVector(1, 0, 0);
 UnitVector yUV = transGeo.CreateUnitVector(0, 1, 0);
 UnitVector zUV = transGeo.CreateUnitVector(0, 0, 1);&lt;BR /&gt;
 xPlane = workPlanes.AddFixed(centerPt.Point, yUV, zUV);&lt;BR /&gt; zPlane = workPlanes.AddFixed(centerPt.Point, xUV, yUV);&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Apr 2018 12:22:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-create-workplane-at-ucs-origin/m-p/7900807#M82813</guid>
      <dc:creator>NSBowser</dc:creator>
      <dc:date>2018-04-02T12:22:12Z</dc:date>
    </item>
  </channel>
</rss>

