Prod.: Engine, ver.: 6, ID: 60000929, HowTo : Make my own command like cmdCircle without rubber radious line

HowTo : Make my own command like cmdCircle without rubber radious line

Article60000929
TypeHowTo
ProductEngine
Version6
Date Added7/29/2009
Submitted byDominik Eichenlaub
Keywords

Subject

Make my own command like cmdCircle without rubber radious line

Summary

I would like to make my own command like cmdCircle but without rubber radious that cmdCircle is displaying. How can I do it ?

Solution

You need to create your own cmd-circle and instead of using our cmdCircle. For example in an empty C# project in the form add a vdScrollable control (named vdSC) amd a button and use a code like :
      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 circle
 
            if (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);
                }
            }
 
        }