.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is this a ghost?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
HelloWorlddd
910 Views, 6 Replies

Is this a ghost?

     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.

6 REPLIES 6
Message 2 of 7
mzakiralam
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 .

http://through-the-interface.typepad.com/through_the_interface/2011/03/using-transient-graphics-to-s...
Message 3 of 7
HelloWorlddd
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

 

Message 4 of 7
_gile
in reply to: HelloWorlddd

Hi,

 

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
    {
        [CommandMethod("DragCircle")]
        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);
                    btr.AppendEntity(circle);
                    tr.AddNewlyCreatedDBObject(circle, true);
                }
                tr.Commit();
            }
        }

        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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 7
HelloWorlddd
in reply to: _gile

Yes, it's the function that I want to , thank you very much!
Message 6 of 7
mineshparikh
in reply to: HelloWorlddd

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

Message 7 of 7
HelloWorlddd
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

   http://forums.autodesk.com/t5/NET/Rubber-band-and-Jig-I-s-a-balloon/td-p/4711777

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost