Insert block without specifying MathPoint. Attach to mouse instead

I programmatically insert a block into a drawing using the MakeSketchBlockFromFile function. This function requires MathPoint for the position of the block, but I would like the user to place the block in the drawing. I basically want to emulate the functionality of the Tools-Block-Insert menu.

Is there another API function I missed that would allow me to insert a block but bind the block to the mouse instead of pointing to a specific location?

+1


a source to share


2 answers


I subclassed the DataObject class and used DoDragDrop to allow the user to drag the block onto the drawing. Works like a champion.



0


a source


I haven't programmed any programming for a while, but the only method that seems to return the math point that gives you the mouse position is

SwManipulatorHandler2::OnUpdateDrag

      



I suspect that this is the only way to do this by creating one of these manipulators and getting the user to position it and then creating a block at that location.

Also: I'm a little confused as to why you are replicating the already existing functionality.

0


a source







All Articles