Hey Mark,
I'm no Tony, but maybe I can help.
You are transforming a database resident object with each move of the mouse.
Your jig should be working with non db resident objects. Check out this
example http://www.theswamp.org/index.php?topic=8198.0, just note that I
never did finish this to my liking. Run it and move your mouse out of the
drawing area to see what I mean.
However, since you are targeting 2007, you can use the overloaded Drag
method that wraps acedDragGen().
public class EntityDragger
{
private Point3d m_basePoint;
[CommandMethod("dragSS")]
public void SsDragger()
{
Editor currentEditor = acadApp.DocumentManager.MdiActiveDocument.Editor;
//Create a new selection set options object
PromptSelectionOptions ssOptions = new PromptSelectionOptions();
ssOptions.AllowDuplicates = true;
ssOptions.MessageForAdding = "Select objects to copy: ";
//Get a selection from the user
PromptSelectionResult ssResult = currentEditor.GetSelection(ssOptions);
if (ssResult.Status != PromptStatus.OK)
{
return;
}
//Get a base point from the user
PromptPointResult pointResult = currentEditor.GetPoint("\nSelect base point:
");
if (pointResult.Status != PromptStatus.OK)
{
return;
}
m_basePoint = pointResult.Value;
//Initiate the drag callback delegate
DragCallback dragCallbackDelegate = this.FollowCursor;
//Start the drag operation
PromptDragOptions dragOptions = new PromptDragOptions(ssResult.Value,
"\nSelect destination point: ", dragCallbackDelegate);
PromptPointResult destinationPointResult = currentEditor.Drag(dragOptions);
if (destinationPointResult.Status != PromptStatus.OK)
{
return;
}
//Determine the final displacement matrix
Matrix3d transMat =
Matrix3d.Displacement(m_basePoint.GetVectorTo(destinationPointResult.Value));
//transform the ss to the new location
this.TransformSelectionSet(ssResult.Value, transMat);
}
//DragCallback Delegate
public SamplerStatus FollowCursor(Point3d currentPoint, ref Matrix3d
transMat)
{
transMat = Matrix3d.Displacement(m_basePoint.GetVectorTo(currentPoint));
return SamplerStatus.OK;
}
}
Also note that they fixed the GetVectorTo() method in 07; this:
Vector3d displacementVector =
currentCursorPosition.GetVectorTo(previousCursorPosition);
displacementVector = displacementVector.MultiplyBy(-1);
can be replaced with this:
Vector3d displacementVector =
previousCursorPosition.GetVectorTo(currentCursorPosition);
p.s. - I just saw that you posted over in the swamp. I'll post this code
there so you can see it with some formatting.
--
Bobby C. Jones
"Mark Johnston" wrote in message
news:5249253@discussion.autodesk.com...
Thanks Nathan,
I did see your VB example. I was hoping to do this in C# but I may just
build on your example. I agree that checking for amount of movement should
be unnecessary. It was something I did just to see what would happen.
(hoping for a clue)
Maybe a reader with experience in C# can point me in the right direction.
(hint Tony)
wrote in message news:5248434@discussion.autodesk.com...
I can't see anything wrong with your code. I haven't tried yours but I have
a VB block insert example that does not twitch. Checking a tolerance should
be unnecessary.
Regards - Nathan