LCform
Mechanical
- Jan 13, 2016
- 139
I have a drawing in Solidworks , that there are four or five parts views are imported in it, I need to write a macro that when I click on each view, relating to a specific part, I can get the information of that part, that could be : the name of the part, and information that is inserted in the drawing table. I need this to use it for a daily task.
When I tried recording a macro, what I got was this
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("View of design 8")
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.149152636311266, 0.13636438206487, 374.999635197609, False, 0, Nothing, 0)
Part.ClearSelection2 True
End Sub
When I tried recording a macro, what I got was this
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.ActivateView("View of design 8")
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.149152636311266, 0.13636438206487, 374.999635197609, False, 0, Nothing, 0)
Part.ClearSelection2 True
End Sub