CycloneWade
Automotive
- Apr 1, 2005
- 76
I created a macro that searches the tree for a particular item and suppresses it. What I would like to do in my macro is query whether the feature is suppressed or not, then suppress or unsuppress the flat pattern based on the state of the previous feature.
I should mention I would like the same macro to reverse the process.
Regards,
Code for Reference:
' ******************************************************************************
' C:\Users\WANDER~1.TRI\AppData\Local\Temp\swx5752\Macro1.swb - macro recorded on 06/04/08 by wanderson
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Dim swFeature As SldWorks.Feature
Dim FeatName As String
Dim FeatType As String
Dim nBendState As Long
Dim nRetVal As Long
Dim bRet As Boolean
Sub main()
Set swApp = Application.SldWorks
If Not swApp Is Nothing Then
Set Part = swApp.ActiveDoc
If Not Part Is Nothing Then
Set swFeature = Part.FirstFeature
While Not swFeature Is Nothing
FeatType = swFeature.GetTypeName
' MsgBox "" & FeatType
If FeatType = "Bending" Then
' Select the feature
Dim suppressSet As Boolean
Dim suppressState As Long
' Need to determine if Flex "Bending" feature is suppressed 'or not suppressed theneither suppress or unsuppress flat 'pattern depending on current state.
' This command suppresses feature if the feature is called 'Bending
suppressSet = swFeature.SetSuppression(swSuppressFeature)
' Select the feature
End If
Set swFeature = swFeature.GetNextFeature
Wend
End If
End If
End Sub
I should mention I would like the same macro to reverse the process.
Regards,
Code for Reference:
' ******************************************************************************
' C:\Users\WANDER~1.TRI\AppData\Local\Temp\swx5752\Macro1.swb - macro recorded on 06/04/08 by wanderson
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Dim swFeature As SldWorks.Feature
Dim FeatName As String
Dim FeatType As String
Dim nBendState As Long
Dim nRetVal As Long
Dim bRet As Boolean
Sub main()
Set swApp = Application.SldWorks
If Not swApp Is Nothing Then
Set Part = swApp.ActiveDoc
If Not Part Is Nothing Then
Set swFeature = Part.FirstFeature
While Not swFeature Is Nothing
FeatType = swFeature.GetTypeName
' MsgBox "" & FeatType
If FeatType = "Bending" Then
' Select the feature
Dim suppressSet As Boolean
Dim suppressState As Long
' Need to determine if Flex "Bending" feature is suppressed 'or not suppressed theneither suppress or unsuppress flat 'pattern depending on current state.
' This command suppresses feature if the feature is called 'Bending
suppressSet = swFeature.SetSuppression(swSuppressFeature)
' Select the feature
End If
Set swFeature = swFeature.GetNextFeature
Wend
End If
End If
End Sub