<?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: Adjusting Camera View to Workplane in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7356082#M98339</link>
    <description>&lt;P&gt;Hello Martin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at how the workplane is created,&lt;/P&gt;
&lt;P&gt;You used&amp;nbsp; two Ases, The S.Axis and the Work.Axis1.&lt;/P&gt;
&lt;P&gt;If you look at the square that represents the workplane it is aligned with the Work.Axis1.&lt;/P&gt;
&lt;P&gt;you Up vector is the direction of that Work.Axis1...&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2017 19:36:57 GMT</pubDate>
    <dc:creator>HermJan.Otterman</dc:creator>
    <dc:date>2017-09-05T19:36:57Z</dc:date>
    <item>
      <title>Adjusting Camera View to Workplane</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7352166#M98338</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i read a lot of stuff concerning Views, Camera and so on and tried much more.....&lt;/P&gt;&lt;P&gt;I want to use or rebuild&amp;nbsp;the implemented feature in Inventor "Adjusting View to a Workplane" with vb.net. It's enclosed in the ViewCube&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="3DCS_2017.09.04_09h57m29s_001_.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/397262i30DBEFE4CDD12C00/image-size/large?v=v2&amp;amp;px=999" role="button" title="3DCS_2017.09.04_09h57m29s_001_.jpg" alt="3DCS_2017.09.04_09h57m29s_001_.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One part works in my code: Setting the Camera Eye in the right Position to the normal auf the workplane.&lt;/P&gt;&lt;P&gt;The second part, rotating like the inventor feature does, don't works. I have no idea how to create the right UpVector concerning to the workplane.&lt;/P&gt;&lt;P&gt;I recognized also that the original feature as different behavior dependent on how the actual camera view is positioned to the screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;The Workplane comes from the selected Plane&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Sub Adjust_Camera(oWorkPlane As WorkPlane)
            Dim oTG As TransientGeometry = InventorApp.TransientGeometry
            Dim oView As View = InventorApp.ActiveView
            Dim oCamera As Camera = oView.Camera
            'Vektor der Normalen
            Dim oNormalEye As Inventor.Vector = oWorkPlane.Plane.Normal.AsVector
            'set camera Target to Root Point
            oCamera.Target = oWorkPlane.Plane.RootPoint
            'set camera Eye
            Dim pEye As Point = oCamera.Target
            pEye.TranslateBy(oNormalEye)
            oCamera.Eye = pEye
            'until here it works fine

            'How can i get the right upVector for adjusting the camera like Inventor does it?
            Dim oUpvector As UnitVector = InventorApp.TransientGeometry.CreateUnitVector(0, 0, 1) 'example
            oCamera.UpVector = oUpvector
            'apply camera settings
            oCamera.Apply()
        End Sub
    End Class&lt;/PRE&gt;&lt;P&gt;In Sample eye.ipt (Inventor2017) for example i want to adjust "Arbeitsebene3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards Martin&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2017 11:18:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7352166#M98338</guid>
      <dc:creator>Martin-Winkler-Consulting</dc:creator>
      <dc:date>2017-09-04T11:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adjusting Camera View to Workplane</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7356082#M98339</link>
      <description>&lt;P&gt;Hello Martin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at how the workplane is created,&lt;/P&gt;
&lt;P&gt;You used&amp;nbsp; two Ases, The S.Axis and the Work.Axis1.&lt;/P&gt;
&lt;P&gt;If you look at the square that represents the workplane it is aligned with the Work.Axis1.&lt;/P&gt;
&lt;P&gt;you Up vector is the direction of that Work.Axis1...&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 19:36:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7356082#M98339</guid>
      <dc:creator>HermJan.Otterman</dc:creator>
      <dc:date>2017-09-05T19:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adjusting Camera View to Workplane</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7357365#M98340</link>
      <description>&lt;P&gt;Hello Herm Jan,&lt;/P&gt;&lt;P&gt;thanks for your Tip.&lt;/P&gt;&lt;P&gt;Now i figured out this solution and it works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Adjust_Camera(oWorkPlane As WorkPlane)
            Dim oView As View = InventorApp.ActiveView
            Dim oCamera As Camera = oView.Camera
            'Vector from Normal
            Dim oNormalEye As Inventor.Vector = oWorkPlane.Plane.Normal.AsVector
            Dim oPosPoint As Point = Nothing
            Dim oPosVectorX As UnitVector = Nothing
            Dim oPosVectorY As UnitVector = Nothing
            Try
                oWorkPlane.GetPosition(oPosPoint, oPosVectorX, oPosVectorY)
                'set camera Target to Root Point
                oCamera.Target = oPosPoint
                'set camera Eye by changing oPosPoint
                oPosPoint.TranslateBy(oNormalEye)
                oCamera.Eye = oPosPoint
                oCamera.UpVector = oPosVectorY
                'apply camera settings
                oCamera.ApplyWithoutTransition()
            Catch ex As Exception
                MsgBox("Kamera Einstellung nicht erfolgreich", vbCritical, "Ausrichten nach Arbeitsebene")
            End Try
        End Sub&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 07:38:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/adjusting-camera-view-to-workplane/m-p/7357365#M98340</guid>
      <dc:creator>Martin-Winkler-Consulting</dc:creator>
      <dc:date>2017-09-06T07:38:32Z</dc:date>
    </item>
  </channel>
</rss>

