×
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

Catia MACRO: Show/Hide Mechanical Features in Body

Catia MACRO: Show/Hide Mechanical Features in Body

Catia MACRO: Show/Hide Mechanical Features in Body

(OP)
Hello everyone

I am trying to create a macro that would show/hide all the features inside a Body. I have managed to get to a point where it is working nicely but I can not figure out how to make it check all the bodies and not just the ones with the name "Part Body".
Does anyone have any suggestions?

Thank you.

CODE --> VBSCRIPT

Language="VBSCRIPT"

Sub CATMain()

Set productDocument1 = CATIA.ActiveDocument

Set productDocument1 = CATIA.ActiveDocument

Set productDocument1 = CATIA.ActiveDocument

Set selection1 = productDocument1.Selection

selection1.Search "(CATPrtSearch.BodyFeature.Visibility=Visible),all"

Set selection1 = productDocument1.Selection

selection1.Search "CATPrtSearch.MechanicalFeature,sel"

Set selection1 = productDocument1.Selection

Set visPropertySet1 = selection1.VisProperties

Set visPropertySet1 = visPropertySet1.Parent

visPropertySet1.SetShow catVisPropertyShowAttr

selection1.Clear 

selection1.Search "((((CATStFreeStyleSearch.BodyFeature + CATPrtSearch.BodyFeature) + CATGmoSearch.BodyFeature) + CATSpdSearch.SpdBodyRef) + CATSpdSearch.BodyFeature),all"

Set selection1 = productDocument1.Selection

Set visPropertySet1 = selection1.VisProperties

Set visPropertySet1 = visPropertySet1.Parent

visPropertySet1.SetShow catVisPropertyShowAttr

selection1.Clear 

End Sub 

RE: Catia MACRO: Show/Hide Mechanical Features in Body

Hi,

Daniel, your code is working fine, no matter the name of the body but you can clean it a little bit.

CODE --> CATScript

Language="VBSCRIPT"

Sub CATMain()
Set productDocument1 = CATIA.ActiveDocument

Set selection1 = productDocument1.Selection
selection1.Search "(CATPrtSearch.BodyFeature),all"

Set selection1 = productDocument1.Selection
selection1.Search "CATPrtSearch.MechanicalFeature,sel"

Set visPropertySet1 = selection1.VisProperties
Set visPropertySet1 = visPropertySet1.Parent
visPropertySet1.SetShow catVisPropertyShowAttr

selection1.Clear 

selection1.Search "((((CATStFreeStyleSearch.BodyFeature + CATPrtSearch.BodyFeature) + CATGmoSearch.BodyFeature) + CATSpdSearch.SpdBodyRef) + CATSpdSearch.BodyFeature),all"

visPropertySet1.SetShow catVisPropertyShowAttr

selection1.Clear 

End Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Catia MACRO: Show/Hide Mechanical Features in Body

(OP)
Sorry for my late reply.

Thank you. It was not working on some of the projects and i have found the problem. It was just the way the parts were hidden.

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