Macro for Unsuppress all mates in all assemblies

Discussion in 'SolidWorks' started by Ben Eadie, Sep 1, 2005.

  1. Ben Eadie

    Ben Eadie Guest

    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
     
    Ben Eadie, Sep 1, 2005
    #1
  2. Ben Eadie

    Tin Man Guest

    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
     
    Tin Man, Sep 2, 2005
    #2
  3. Ben Eadie

    kmaren24 Guest

    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
     
    kmaren24, Sep 2, 2005
    #3
  4. Ben Eadie

    Ben Eadie Guest

    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
     
    Ben Eadie, Sep 2, 2005
    #4
  5. Ben Eadie

    kmaren24 Guest

    Yeah that will do.

    KM
     
    kmaren24, Sep 2, 2005
    #5
  6. Ben Eadie

    Boat Guest

    Random behavior macro? More descriptive: 'Postconditions: all mates in
    active assembly unsuppressed.'
     
    Boat, Sep 3, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.