Navisworks .NET API 2013 new feature – Viewpoint 3

By Xiaodong Liang

Continued with last post, the following codes demonstrate how to set align up, set point at and rotate the camera.

 

// set up vector    private void changeUp()    {        Document oDoc =            Autodesk.Navisworks.Api.Application.ActiveDocument;             // make a copy of current viewpoint        Viewpoint oCurrVCopy = oDoc.CurrentViewpoint.CreateCopy();             // a new up vector. e.g. Y +        Vector3D oNewUpVec = new Vector3D(0, 1, 0);             oCurrVCopy.AlignUp(oNewUpVec);             // update current viewpoint        oDoc.CurrentViewpoint.CopyFrom(oCurrVCopy);                   }         private void rotateCamera()    {        Document oDoc =             Autodesk.Navisworks.Api.Application.ActiveDocument;             //  Make a copy of current viewpoint            Viewpoint oCurrVCopy =             oDoc.CurrentViewpoint.CreateCopy();             //  set the axis we will rotate around (¨Zú:o0°,0°,1±)?        UnitVector3D odeltaA =             new UnitVector3D(0, 0, 1);             // Create delta of Quaternion: axis is Z,         // angle is 45 degree        Rotation3D delta =             new Rotation3D(odeltaA, 3.14 / 4);             // multiply the current Quaternion with the delta ,         // get the new Quaternion         oCurrVCopy.Rotation =             MultiplyRotation3D(delta,oCurrVCopy.Rotation );             // Update current viewpoint        oDoc.CurrentViewpoint.CopyFrom(oCurrVCopy);         }

Comments

One response to “Navisworks .NET API 2013 new feature – Viewpoint 3”

  1. ALEKSANDR PEKSHEV Avatar
    ALEKSANDR PEKSHEV

    How to set HOV?

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading