AnsweredAssumed Answered

Macro for Solidworks with which I can filter mate's which have two identical words in the matename

Question asked by Lorenz Dennler on Jun 20, 2019
Latest reply on Jun 24, 2019 by Luke Malpass

Hello everyone!

 

As described in the title im looking for a macro for Solidworks where i can select specific mate's, all who contain the word "Concentric" and "BN"

 

I don't have much experience with VBA, so I hope someone can help me out here. At the moment I'm getting as far as I can select a specific reference with it.

 

This is the code i wrote.

 

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.Extension.SelectByFeature("concentric10823391", "MATE", 0, 0, 0, True, 0, Nothing, 0)

End Sub

 

and i need something like that

 

boolstatus = Part.Extension.SelectByFeature("concentric" "BN", "MATE", 0, 0, 0, True, 0, Nothing, 0)

 

but i think its way more complicated than i just assumed.

 

Thanks for all the help,

regards

Lorenz

Outcomes