×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro tips for me.

Macro tips for me.

Macro tips for me.

(OP)
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

RE: Macro tips for me.

You may want to try grouping features in a folder instead of creating a feature.

Just store the suppressed/unsuppressed of your previous "trigger" feature in a variable (perhaps a Boolean) and keep traversing.   When you reach the flat pattern, suppress/unsuppress accordingly.

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources