Valued Contributor
Posts: 87
Registered: ‎05-03-2013
Message 1 of 7 (360 Views)
Accepted Solution

Is this a ghost?

360 Views, 6 Replies
12-22-2013 12:59 AM

     Now I already understand the mechanism of the rubber band, but I’m not sure what’s name of another mechanism


     For example, as shown in attachment picture, when copying a circle, then move the mouse, there is a circle in the center of the cross, what I want to achieve is how to let the moving circle come true.


     Maybe this mechanism should call Ghost? I'm not sure.


     Is there someone can understand what I'm saying? If you can provide any reference information, very grateful.

Posts: 229
Registered: ‎11-09-2012
Message 2 of 7 (343 Views)

Re: Is this a ghost?

12-22-2013 02:22 AM in reply to: HelloWorlddd
you can have a look in below link where move command is implemented. before move you can clone the selected object and the move it .

Valued Contributor
Posts: 87
Registered: ‎05-03-2013
Message 3 of 7 (341 Views)

Re: Is this a ghost?

12-22-2013 02:36 AM in reply to: HelloWorlddd

Uh..I think what I want is a sample code then I can study by myslef.


I want to express is an effect:
     Such as execute a  command to create a circle, the radius is 3,
     Then, program asks the user to select a center as the anchor point,
     At this time the circle that has been displayed on screen,  the circle can be moved during the mouse is moving
     Yes, this is just a very human mechanism thought it does not change the functionality of the program

This feature is very nice.

I think there must be a class can let it come true.  but I really don't know which one is it..wating for your help., very thanks


*Expert Elite*
Posts: 2,077
Registered: ‎04-29-2006
Message 4 of 7 (321 Views)

Re: Is this a ghost?

12-22-2013 04:10 AM in reply to: HelloWorlddd



You can do it with a Jig.

Here's a little sample using a class deriving from EntityJig.


using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

namespace DragCircleSample
    public class CommandMethods
        public void DragCircle()
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            using (Circle circle = new Circle(Point3d.Origin, Vector3d.ZAxis, 3.0))
                CircleJig jig = new CircleJig(circle);
                PromptResult pr = ed.Drag(jig);
                if (pr.Status == PromptStatus.OK)
                    BlockTableRecord btr =
                        (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                    tr.AddNewlyCreatedDBObject(circle, true);

        class CircleJig : EntityJig
            Circle circle;
            Point3d center;

            public CircleJig(Circle circle) : base(circle)
                this.circle = circle;
                this.center = circle.Center;

            protected override bool Update()
                circle.Center = center;
                return true;

            protected override SamplerStatus Sampler(JigPrompts prompts)
                PromptPointResult ppr = 
prompts.AcquirePoint("\nSpecify the circle center: "); if (ppr.Value.DistanceTo(center) < Tolerance.Global.EqualPoint) return SamplerStatus.NoChange; center = ppr.Value; return SamplerStatus.OK; } } } }


Gilles Chanteau
Valued Contributor
Posts: 87
Registered: ‎05-03-2013
Message 5 of 7 (308 Views)

Re: Is this a ghost?

12-22-2013 06:07 AM in reply to: _gile
Yes, it's the function that I want to , thank you very much!
New Member
Posts: 1
Registered: ‎12-24-2013
Message 6 of 7 (243 Views)

Re: Is this a ghost?

12-24-2013 08:14 AM in reply to: HelloWorlddd

i was facing the same problem. i m also looking for the same answer.

Valued Contributor
Posts: 87
Registered: ‎05-03-2013
Message 7 of 7 (239 Views)

Re: Is this a ghost?

12-24-2013 08:21 AM in reply to: mineshparikh

   You can refer my topic that mention during this days,  there are what you want, I can tell you now how I deal with my problems, finally solve with the DrawJig class


You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community