6 Replies Latest reply on Dec 18, 2013 6:09 AM by Nazar Chaykin

    Flatten: Suppress or Unsuppress?

    Nazar Chaykin

      Hello to all!

           There is macro that should suppress or unsuppress how it making "Flatten". As far as "Flatten" macros unsuppress only "Flat-Pattern1" and I should unsuppress "Flatten-<EdgeBend..."  by hand. Please advise me how to make it all to unsuppress automaticly "Flatten-<EdgeBend..."?


      Sub FeatureSuppression()
      ' Variable used to hold the SldWorks object
      Dim swApp As Object
      ' Variable used to hold the ModelDoc object
      Dim Model As Object
      ' Variable used to hold the current Feature object
      Dim feat As Object
      Dim featureName As String
      Set swApp = CreateObject("SldWorks.Application")
      ' Attach to the active document
      Set Model = swApp.ActiveDoc
      ' Exit if no model is active
      If Model Is Nothing Then
          Exit Sub
      End If
      ' Get the 1st feature in part
      Set feat = Model.FirstFeature
      ' While we have a valid feature
      Do While Not feat Is Nothing
          ' Get the name of the feature
          Let featureName = feat.Name
          ' See if the feature name contains our search string
          If InStr(1, featureName, SearchStr, 1) Then
              ' Select the feature
              res = Model.SelectByID(featureName, "BODYFEATURE", 0, 0, 0)
                  res = Model.EditUnsuppress() ' Unsuppress the feature
          End If
          Set feat = feat.GetNextFeature() ' Get the next feature
      Loop ' Continue until no more features exist
      End Sub