Unsurpress multiple files

Discussion in 'SolidWorks' started by Jim Johns \(News\), May 11, 2006.

  1. Is there any way to unsurpress multilpe features in multiple different files
    at one time. Similar to a batch? I have a process where imported files are
    all surpressed and need to unsurpress

    Thanks in advance
    JIM
     
    Jim Johns \(News\), May 11, 2006
    #1
  2. Jim Johns \(News\)

    Mr. Who Guest

    API is the only way I can think of.
     
    Mr. Who, May 12, 2006
    #2
  3. Jim Johns \(News\)

    CS Guest

    Found this bit of code lying around. I don't recall if I wrote it or
    found it here through google groups. Anyway most of it is taken
    directly out of the API Help. It should do what you are looking for.


    Dim swApp As SldWorks.SldWorks
    Dim Assy As SldWorks.ModelDoc2
    Dim Config As SldWorks.Configuration

    Sub main()
    Dim rootComp As Component2

    Set swApp = Application.SldWorks
    Set Assy = swApp.ActiveDoc
    Set FeatMan = Assy.FeatureManager
    Set Config = Assy.GetActiveConfiguration
    Set rootComp = Config.GetRootComponent

    RecurseAssy rootComp, 0

    End Sub


    Sub RecurseAssy _
    ( _
    swComp As SldWorks.Component2, _
    nLevel As Long _
    )

    Dim vChildComp As Variant

    Dim swChildComp As SldWorks.Component2

    Dim swCompConfig As SldWorks.Configuration

    Dim sPadStr As String

    Dim i As Long

    Dim SplitStr As Variant

    Dim NewComp As Boolean


    For i = 0 To nLevel - 1

    sPadStr = sPadStr + " "

    Next i



    vChildComp = swComp.GetChildren

    For i = 0 To UBound(vChildComp)

    Set swChildComp = vChildComp(i)
    Debug.Print swChildComp.Name2
    superr = swChildComp.SetSuppression2(swComponentResolved)
    Select Case superr
    Case swSuppressionError_e.swSuppressionBadComponent
    Debug.Print "swSuppressionBadComponent"
    Case swSuppressionError_e.swSuppressionBadState
    Debug.Print "swSuppressionBadState"
    Case swSuppressionError_e.swSuppressionChangeFailed
    Debug.Print "swSuppressionChangeFailed"
    Case swSuppressionError_e.swSuppressionChangeOk
    'Debug.Print "swSuppressionChangeOk"
    End Select

    RecurseAssy swChildComp, nLevel + 1

    Next i

    End Sub
     
    CS, May 15, 2006
    #3
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.