Search code examples
solidworks

Inserting block without specifying the MathPoint. Attach to mouse instead


I am programmatically inserting a block into a drawing using the MakeSketchBlockFromFile function. This function requires a MathPoint for the position of the block, but I would like to have the user place the block on the drawing instead. I basically want to mimic the functionality of the Tools-Block-Insert menu item.

Is there another API function that I have missed that will allow me to insert a block, but have the block attached to the mouse instead of specifying a specific location?


Solution

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