For the first item - duplicate items - I have added this at the end of the ForEach SelectedObject loop:
transformedEntity.SwapIdWith(selectedEntity.ObjectId, true, true);
selectedEntity.Erase();
In my example code you see that I insert the block using VBA then drag it. I insert at 0,0,0 just to get it onto the drawing. When I run the code I get a block at 0,0,0 and one on the end of my cursor.
With regular AutoCAD INSERT command I insert a block and I only have the one on the cursor. A small issue and one that could be solved with a hack.
Hi Mark.
It looks like you're using the Drag() overload that wraps acedDragGen().
The problem there is that acedDragGen() wasn't really designed to
drag new objects (e.g., the way the INSERT command works), but
rather, existing objects in the database (e.g., the way the MOVE
command works).
If your app works kind-a like the INSERT command, then you should
not be using the acedDragGen() wrapper. Rather you should use the
wrapper for AcEdJig (which is designed for dragging new objects).
If you were using the AcEdJig wrapper, there would be no need to
create an insertion of the block in the drawing first, and hence, no
need for the swapIdWith() or any other kludge.
The sample code at the URL below works for me, and shows how
to do dragging of new, non-database resident objects properly.
http://www.caddzone.com/InsertJig.cs