Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting the part name by clicking on drawing view 1

Status
Not open for further replies.

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
 
Replies continue below

Recommended for you

Thank you so much

first that I chose ctrl+Q , is it ok ? second that it was not functioning, third that I want those informations written somewhere, not only displayed
 
ArtemTat

I thank you for your post but yet I am searching to use this macro and could not
 
unfortunately it has a password and not possible to modify or check what is wrong
 
Sorry to hear that. Do you have any specific errors or it just does nothing? Can you record a short video of how you use the macro? Do you have a text file with properties and the properties do exist in the model?

ctrl+q is a shortcut for a force rebuild so it is better to use some other shortcut.

Thanks,
Artem
 
Hello Artem

thank you so much

Video I think I can not record, but as far as creating the Macro button I think I have done right. But yes when I open the assembly file, Nothing happens, I mean when I highlight the part and press the macro button.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor