Question

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?

Was it helpful?

Solution 2

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

OTHER TIPS

I haven't done any solidworks programming for a while but the only method which seems to return a mathpoint that gives you the mouse position is

SwManipulatorHandler2::OnUpdateDrag

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

Aside: I am a little confused as to why you are replicating functionality that already exists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top