Insert block with user interaction

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

Hi, I already asked this in another similar discussion but I prefere to start a new one just in case.


I want to know if it's possible to insert a block with user interaction (I mean with a selected point from the user click on the 2D sheet) ?

Why do I need this ?

I want to be able to place a block on a specified location and show a specific dialog (a user form, which connects to an MDB file to update some properties in the dialog depending on the user's entries in the mandatory fields).

I really need to place the block on the specified location chosen by the user (as you can do with a regular block dragged from the library) but I also need to show this particular dialog because it has a lot of options (in addition to the MDB connection) that I can't have in the standard block properties dialog from Solid Edge. Once the form is filled, the values are then stored in the block labels.


I thought about 2 ways to do that but in both case I'm stuck because I don't know if it's possible :

1/ click on the button to start the macro, show the form, fill it and accept (that I can do), then place the block on the desired location (i.e. where I click on the drawing - that I don't know how to do).

2/ Drag the block from the library and click it's location, then show the form instead of standard SE dialog (I know that I can set my labels so that they're not asked when the block is placed, so no SE dialog is shown during the insertion). I don't know how to do that or even if it's possible.



My workaround for the moment is to place the block with standard Solid Edge tools (drag and drop from the library), then select it and click on my button to launch the macro which shows the specific dialog and allows all the actions I need from this form.


Re: Insert block with user interaction

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

I  might have found a solution by myself after thinking about something else (mouse events) and searching through the forum.


I saw that it's possible to find the coordinates of a mouse click. That exactly what I need Smiley Happy (and there's a nice sample about this in ...\Solid Edge ST9\Custom\MouseEvents).


My solution would then be the following (I still have to code everything, using parts of the sample codes) :

- click on the button to launch my macro

- click on the drawing sheet were I want my block to be placed

- get the click coordinates on mouse up event (for further block placement)

- store the coordinates temporarily

- show my windows form

- fill the form and accept (or cancel to exit the macro)

- place the block on the previously stored coordinates

- fill the block occurrence labels with the form values

- exit the macro

Re: Insert block with user interaction


Bravo! you found the solution, which is the correct way to proceed for what you aim to do.

Additionally, check if any coordinate conversion that might be required from internal units to Draft units.

I am not very sure nor have checked but routinely do this when accomplishing similar tasks in the Part environment.