tags:

views:

68

answers:

2

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?

A: 

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.

jimconstable
I'm giving the user the ability to set some custom properties for a selected part in a drawing that are linked to notes in the block. When the dialog is closed, I would like to already have the block selected instead of having the user open the block themselves.
Tim
the other option is you just insert it in the centre of the drawing and the use can move it.
jimconstable
A: 

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

Tim