In the case, your application requires input from a user defined plane (UCS in AutoCAD), this is the code to align User Interface items like Grid and ViewCube. The code needs to be used after the Form load event.
// arbitrary plane
Plane plane = new Plane(Point3D.Origin, new Vector3D(1, 2, 3));
// top view according to the plane above
design1.SetView(plane.AxisZ, plane.AxisY, true, false);
// align viewcube
design1.ActiveViewport.ViewCubeIcon.InitialRotation = design1.ActiveViewport.Camera.Rotation * new Quaternion(Vector3D.AxisY, -90) * new Quaternion(Vector3D.AxisZ, -90);
// align the grid
design1.ActiveViewport.Grid.Plane = plane;
Comments
Very nice!
I plan to use this ability to align the Grid to a plane... is it possible to change this outside of Form.Load event in order to change in real time (this is useful for applications such as 3d sketching where the plane is selectable in realtime)
Yes, the only problem is if you call it inside the Form/Window constructor.
Could you please let me know, is it possible to pass the rotation/translation (camera or model view) to Eyeshot API as 4x4 matrix? I'm just trying to synchronize the rotation between the custom build OpenGL 3D control and the Eyeshot control.
Please sign in to leave a comment.