Have a macro select an entity

Hello

In a drawing, I would like to create a macro that fills me a note with the custom parameter named 'Product Code' of the selected part.

I know how to construct the macro for creating and filling the note, but I don't know how to interrupt the macro to ask the user to select an edge or surface to attach the note to.

Anyone have any info or a link that could be useful to me?

Thanks in advance

Jey

Hello

You can put a simple msgBox with a message like "Please select the entity .... before validating this message." and then retrieve the entity selected in your macro by the GetSelectedObject6 function.

Kind regards

Hello

Sorry for the previous post, it doesn't work. On the other hand, you can do:

Dim SelMgr As SelectionMgr
Set SelMgr = Part.SelectionManager
Set Feature = SelMgr.GetSelectedObject6(1, 0)
Do While Feature Is Nothing
    DoEvents
    Set Feature = SelMgr.GetSelectedObject6(1, 0)
Loop

 

This allows the macro to be put on hold until an item is selected.

Kind regards

4 Likes

Hello

A silly little question, but why not create your note that points to the "product code" property  and place it manually?

You have to select an edge or face to place it anyway, a dropped drag would be just as fast.

2 Likes

Thank you d.roger

everything works well.

Thank you very much.

accobre 427: just to go faster and especially to avoid the repetition of certain tasks.