Prod.: Engine, ver.: 6, ID: 60000964, HowTo : Use the View3D "VROT" without changing the rotation center

HowTo : Use the View3D "VROT" without changing the rotation center

Article60000964
TypeHowTo
ProductEngine
Version6
Date Added9/22/2009
Submitted byMichael Prewecki
Keywords

Subject

Use the View3D "VROT" without changing the rotation center

Summary

I'm trying to fix the point of rotation to the last vertex of one of the objects in the drawing. Now if I remain outside the "white rotation circle" then rotation operations function as expected, i.e. the end point of the line remains in a fixed position at the centre of the drawing.

However if I move inside the circle then the "fixed" point moves. This is not the behavior I'm looking for. I need the "target" point to remain at the centre of the drawing. How can I achieve this?

Solution

In the 6017 version a new function is available in order to rotate the view the way you want. You will have to set the view (matrix) and the viewcenter as you already do in your project but instead of calling the View3D "VROT", you will call the wrapper's new method. Like (changes in bold) :
Private Sub cmdRotate_Click()
    Dim SecClipNear As vdrawI5.vdSectionClip
    Dim SecClip     As vdrawI5.vdSectionClips
    Dim Origin      As vdrawI5.vdxyz
    Dim Direction   As vdrawI5.vdxyz
    Dim Layout      As vdrawI5.vdLayout
   
    SetAnglesAndTargetPointToModelRenderer VDraw, 0, 0, 0, -25988.0391, -34608.9102, 781.0027
    VDraw.ActiveDocument.ActiveLayOut.ViewCenter = Array(0, 0, 0)
   
    Dim doc As VectorDraw_Professional.vdDocument
    Set doc = VDraw.ActiveDocument.WrapperObject
    ''''''VDraw.CommandAction.View3D "VROT"    ' don't use this, but use :
    doc.ActionUtility.getUserDynamicRotEx False  'this, which is the new method
   
End Sub
 
Public Sub SetAnglesAndTargetPointToModelRenderer(MCAD As VDrawLib5.VDraw, dblRotation As Double, dblDip As Double, dblTwist As Double, dblOrigX As Double, dblOrigy As Double, dblOrigZ As Double)
    Dim vMatrix As New VectorDraw_Geometry.Matrix
   
    ' Build Matrix with the angle rotations and Translations done
    vMatrix.IdentityMatrix
    vMatrix.TranslateMatrix_2 -dblOrigX, -dblOrigy, -dblOrigZ
    vMatrix.RotateZMatrix VDrawGeo_Globals.DegreesToRadians(-dblRotation)
    vMatrix.RotateXMatrix VDrawGeo_Globals.DegreesToRadians(-dblDip)
    vMatrix.RotateZMatrix VDrawGeo_Globals.DegreesToRadians(360 - dblTwist)
   
    ' Set Matrix to document which influence the Model Space
    MCAD.ActiveDocument.WrapperObject.World2ViewMatrix = vMatrix
   
    MCAD.Redraw
    MCAD.CommandAction.RegenAll
   
End Sub
 

The new function is the getUserDynamicRotEx which accept a boolean. With this boolean false it is working as wished, while passing true it is working just like View3D "VROT" (and getUserDynamicRot) is.

/// <summary>
/// Starts a dynamic rotate action so the user can rotate the active layout in 3D.
/// </summary>
/// <param name="changeView">Defines if the Target point of View matrix and ViewCenter are changed at the start of the Action.</param>
/// <returns>Returns a status code indicating the success of the action.</returns>
StatusCode getUserDynamicRotEx(bool changeView);//6017 60000964