Hello I'm creating a macro. I have a view with an assembly and I want to point to one of the pieces to add a note attached to it with a link to a property
I've already managed to get through the component tree of the parts that are in the view, and I manage to get the swComp and to have the name with . Name2, or the .getPathName path and I manage to list the bodies/faces too
I also manage to add a note on my eyesight
I can't select the piece I want to attach the note to. I try with .select4, and other functions I found, but impossible. It's really the link between the piece and the note that I can't make
Here's the code I'm currently using. It selects the piece well, it creates a note but it is not attached to the selection
Dim swApp As Object
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim boolstatus As Boolean
Dim swModelDocExt As SldWorks.ModelDocExtension
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
Set swSelMgr = swModel.SelectionManager
Set swComp = swSelMgr.GetSelectedObject6(1, -1)
boolstatus = swModel.ActivateView("Vue de mise en plan4")
boolstatus = swModel.Extension.SelectByID2("Tuy entree huile 49477-23@Vue de mise en plan4/Pipe_1-Tuy entree huile 49477-1@Tuy entree huile 49477/3inSchedule10_2^Pipe_1-Tuy entree huile 49477-3@Pipe_1-Tuy entree huile 49477", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Debug.Print boolstatus
Dim myNote As Object
Set myNote = swModel.InsertNote("Lg= $PRPMODEL:""Longueur"" mm")
End Sub