Product : Engine, Version : 5.0.0.1033, ArticleID : 41023700

HowTo : Render problem

Article41023700
TypeHowTo
ProductEngine
Version5.0.0.1033
Date Added9/10/2004
Submitted byMattheos Cotzias
Keywords

Subject

Render problem

Summary

Render problem. (Refresh)
Private Sub VD_CommandActionDraw(ByVal Render As VDStdLib5.vdRender, ByVal Action As VDStdLib5.VdConstCmdActions, ByVal referencePoint As VDStdLib5.vdxyz, ByVal currentPoint As VDStdLib5.vdxyz, Cancel As Integer)
'This function is drawing the red-line, which is not part of the document.
Dim Dist As Double
Dim Angle As Double
    aMousePos = Empty
    Render.Select_Pen VdPenSolid, 1, 0
    aMousePos = VD.CursorPos
    Dist = VD.Utility.geomDistance(aStart, aMousePos)
    Angle = VD.Utility.geomAngle(aStart, aMousePos)
    aMousePos = VD.Utility.geomPolar(aStart, Angle + (3.1415927 * Degrees / 180#), Dist)
    If (Action = VDStdLib5.CMDGETLINE) And (SpecialLine = True) Then
        VD.Refresh
        Render.Drawline aStart(0), aStart(1), aStart(2), aMousePos(0), aMousePos(1), aMousePos(2)
    Else
        aMousePos = Empty
    End If

End Sub

Solution

In CommandActionDraw event is better to use the currentPoint parameter instead of CursorPos property of vdraw.

Private Sub VD_CommandActionDraw(ByVal Render As VDStdLib5.vdRender, ByVal Action As VDStdLib5.VdConstCmdActions, ByVal referencePoint As VDStdLib5.vdxyz, ByVal currentPoint As VDStdLib5.vdxyz, Cancel As Integer)
'This function is drawing the red-line, which is not part of the document.
Dim Dist As Double
Dim Angle As Double
    aMousePos = Empty
    Render.Select_Pen VdPenSolid, 1, 0
    aMousePos = Array(currentPoint.x, currentPoint.y, currentPoint.z) 'NOT VD.CursorPos
    Dist = VD.Utility.geomDistance(aStart, aMousePos)
    Angle = VD.Utility.geomAngle(aStart, aMousePos)
    aMousePos = VD.Utility.geomPolar(aStart, Angle + (3.1415927 * Degrees / 180#), Dist)
    If (Action = VDStdLib5.CMDGETLINE) And (SpecialLine = True) Then
        ' VD.Refresh There is no need for Refresh
        Render.Drawline aStart(0), aStart(1), aStart(2), aMousePos(0), aMousePos(1), aMousePos(2)
    Else
        aMousePos = Empty
    End If

End Sub