Article | 60000929 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 7/29/2009 |
Submitted by | Dominik Eichenlaub |
Keywords |
bool onMycmdCircle = false;
VectorDraw.Geometry.gPoint cent = new VectorDraw.Geometry.gPoint();private void Form1_Load(object sender, EventArgs e)
{
this.vdSC.BaseControl.ActiveDocument.ShowUCSAxis = false;
this.vdSC.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(false);this.vdSC.BaseControl.ActiveDocument.OnActionDraw += new VectorDraw.Professional.vdObjects.vdDocument.ActionDrawEventHandler(ActiveDocument_OnActionDraw);
}void ActiveDocument_OnActionDraw(object sender, object action, bool isHideMode, ref bool cancel)
{ //here we draw the rubber circleif (action is VectorDraw.Actions.ActionGetPoint && onMycmdCircle)
{
VectorDraw.Actions.BaseAction act = action as VectorDraw.Actions.BaseAction;
VectorDraw.Geometry.gPoint refpoint = act.ReferencePoint;
VectorDraw.Geometry.gPoint currentpoint = act.OrthoPoint;
VectorDraw.Professional.vdFigures.vdCircle circle = new VectorDraw.Professional.vdFigures.vdCircle();
circle.SetUnRegisterDocument(vdSC.BaseControl.ActiveDocument);
circle.setDocumentDefaults();
circle.Center = cent;
circle.Radius = circle.Center.Distance3D(currentpoint);
circle.Draw(act.Render);
}
else
{
return;
}
return;}
private void button2_Click(object sender, EventArgs e)
{
VectorDraw.Geometry.gPoint pt_cent = new VectorDraw.Geometry.gPoint();
VectorDraw.Geometry.gPoint pt_ref = new VectorDraw.Geometry.gPoint();
object status_cen = vdSC.BaseControl.ActiveDocument.ActionUtility.getUserPoint(out pt_cent);
vdSC.BaseControl.ActiveDocument.ActiveLayOut.User2WorldMatrix.TransformPt(pt_cent, cent);
if (status_cen != null && (VectorDraw.Actions.StatusCode)status_cen == VectorDraw.Actions.StatusCode.Success)
{
onMycmdCircle = true;
object status_ref = vdSC.BaseControl.ActiveDocument.ActionUtility.getUserPoint(out pt_ref);
onMycmdCircle = false;
if (status_ref != null && (VectorDraw.Actions.StatusCode)status_ref == VectorDraw.Actions.StatusCode.Success)
{
//VectorDraw.Geometry.gPoint cent = new VectorDraw.Geometry.gPoint();double radious = 0;
VectorDraw.Geometry.gPoint refp = new VectorDraw.Geometry.gPoint();
vdSC.BaseControl.ActiveDocument.ActiveLayOut.User2WorldMatrix.TransformPt(pt_ref, refp);
radious = refp.Distance3D(cent);
vdSC.BaseControl.ActiveDocument.CommandAction.CmdCircle(cent, radious);
}
}}