Represents a user define function of type
vdActionDrawDelegate that will be called after default action draw.
Syntax
Example
display polar coordinates when prompt user to get a reference point
C# | Copy Code |
---|
vdcanvas.vdActionDraw = _vdActiondraw; function _vdActiondraw(action) { var ptref = action.ReferencePoint;//get the reference point in world Coordinate System if (!ptref || action.actionType != vdConst.ACTION_LINE_WORLD) return;//do nothing if the action is not waiting for a user reference point var ptcur = action.CurrentPoint;//get the current mouse location in world Coordinate system var dist = vdgeo.Distance3D(ptref, ptcur);//get the distance between reference and current point in drawing units var angle = vdgeo.GetAngle(ptref, ptcur);//get the angle counter-clockwise relative to x direction in radians if (angle > vdgeo.HALF_PI && angle < vdgeo.VD_270PI) angle += vdgeo.PI;//change the angle to be horizadally readable var angledeg = vdgeo.RadiansToDegrees(angle); //convert the angle in degrees //create a temporary text and draw it in the center of user raber reference line var midpt = vdgeo.MidPoint(ptref, ptcur); var txtSize = vdcanvas.GetPixelSize() * 20; var textvalue = dist.toFixed(2) + '<' + angledeg.toFixed(2); var txt = vdcanvas.AddText(textvalue, txtSize, midpt, vdConst.VdConstHorJust_VdTextHorCenter, vdConst.VdConstVerJust_VdTextVerBottom, angle, false, {}); txt.PenColor = vdConst.colorFromString("255,0,0"); vdcanvas.DrawEntity(txt); } |
See Also