Discussion:
Macro for Unsuppress all mates in all assemblies
(too old to reply)
Ben Eadie
2005-09-01 20:24:55 UTC
Permalink
Is there a macro out there that can toggle all the mates active in an
assembly in all the configs, or just unsupress all the mates in an
assembly?

I realize this is most likely going to bite me in the butt but I want to
give it a go and try and save some time

Ben
Tin Man
2005-09-02 03:11:46 UTC
Permalink
This will unsuppress all the mates in an assembly. I'm not really sure,
but I'd guess it only affects the active configuration.
Ken


'Copied from/Started with:
'Get Mates and Mate Entities Example (VB)
'This example shows how to traverse a FeatureManager design tree and
get all of the assemblies mates and mate entities.

'----------------------------------------------
' Preconditions: Assembly document is open.
' Postconditioins: None
'

Option Explicit

Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.feature
Dim swMateFeat As SldWorks.feature
Dim swSubFeat As SldWorks.feature
Dim swMate As SldWorks.Mate2
Dim swComp As SldWorks.Component2
Dim swMateEnt(2) As SldWorks.MateEntity2
Dim i As Integer


' Disable Visual Basic error on implicit Query Interface
On Error Resume Next

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature

' Iterate over features in FeatureManager design tree
Do While Not swFeat Is Nothing
If "MateGroup" = swFeat.GetTypeName Then
Set swMateFeat = swFeat
' Get first mate, which is a subfeature
Set swSubFeat = swMateFeat.GetFirstSubFeature
Do While Not swSubFeat Is Nothing
Set swMate = swSubFeat.GetSpecificFeature2

If Not swMate Is Nothing Then
' Debug.Print swSubFeat.Name
swModel.SelectByID swSubFeat.Name, "MATE", 0, 0, 0
swModel.SelectedFeatureProperties 0, 0, 0, 0, 0,
0, 0, 1, 0, swSubFeat.Name
swModel.ClearSelection
End If

' Get the next mate in MateGroup
Set swSubFeat = swSubFeat.GetNextSubFeature
Loop
End If
Set swFeat = swFeat.GetNextFeature
Loop

End Sub
Boat
2005-09-03 11:53:11 UTC
Permalink
Post by Tin Man
'----------------------------------------------
' Preconditions: Assembly document is open.
' Postconditioins: None
Random behavior macro? More descriptive: 'Postconditions: all mates in
active assembly unsuppressed.'

k***@hotmail.com
2005-09-02 13:22:22 UTC
Permalink
If this is just the top level why not just shift select the mates and
under the edit pull down choose unsuppress-all configurations?

KM
Ben Eadie
2005-09-02 17:41:38 UTC
Permalink
Post by k***@hotmail.com
If this is just the top level why not just shift select the mates and
under the edit pull down choose unsuppress-all configurations?
KM
Why not... Ill tell you why not... Ummmm I errrrrr welll you see its
like this i was too busy to see the obvious? Will that do?

Thanks
k***@hotmail.com
2005-09-02 18:51:50 UTC
Permalink
Yeah that will do.

KM
Loading...