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.
Solved! Go to Solution.
Solved by _gile. Go to Solution.
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
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; } } } }
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