Orbiting the Camera in AutoCAD 2015 with C# -


i'm writing static class contains methods simplify working autocad's camera. methods seem work except orbit. heres orbit method in context of class

public static class cameramethods     {         #region _variables , properties         private static document _activedocument = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument;         private static database _database = _activedocument.database;         private static editor _editor = _activedocument.editor;         private static viewtablerecord _initialview = _editor.getcurrentview();         private static viewtablerecord _activeviewtablerecord = (viewtablerecord)_initialview.clone();         #endregion  /// <summary>         /// orbit angle around passed axis         /// </summary>         public static void orbit(vector3d axis, angle angle)         {             // adjust viewtablerecord             //var olddirection = _activeviewtablerecord.viewdirection;             _activeviewtablerecord.viewdirection = _activeviewtablerecord.viewdirection.transformby(matrix3d.rotation(angle.radians, axis, point3d.origin));              // set current view             _editor.setcurrentview(_activeviewtablerecord);         } } 

the problem every time call orbit orbits based off view previous time orbited. example, first time call orbit orbit 45 degrees around x axis i'd expect to. however, if change camera within autocad call method again, orbits if called twice; 90 degrees on x-axis. need advice on how fix that.

as active document can change on autocad (it's mdi application), not recommend store objects static you're doing.

instead, every call depends on mdiactivedocument should variables on each command call. may reason why you're getting behaviour.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -