jzecha
Aerospace
- Jan 20, 2016
- 236
I have run into an issue with customer provided models loading in and not all the parts are visible.
So i created a macro that un-hides all the parts, it works great.
The only issue is that sometimes when I open the sub assemblies of the tool in a New Window in that Catia session, not everything is visible because the visual status is saved at the detail/sub assembly level.
Can someone recommend the best way to resolve this issue with just one Macro that I run once at the top level assembly?
Current Macro:
So i created a macro that un-hides all the parts, it works great.
The only issue is that sometimes when I open the sub assemblies of the tool in a New Window in that Catia session, not everything is visible because the visual status is saved at the detail/sub assembly level.
Can someone recommend the best way to resolve this issue with just one Macro that I run once at the top level assembly?
Current Macro:
Code:
Language="VBSCRIPT"
Sub CATMain()
CATIA.DisplayFileAlerts = False
Dim Message, Style, Title, Response, MyString
Message = ("This macro will change the status of all CATParts to SHOW " &_
(chr(13)) &_
""&(chr(13))&_
" Do you want to continue ?")
Style = vbYesNo + vbDefaultButton1 'Define buttons. Button1 means marked by default
Title = "Purpose "
Response = MsgBox(Message, Style, Title)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
Dim productDocument1 As Document
Set productDocument1 = CATIA.ActiveDocument
Dim selection1 As Selection
Set selection1 = productDocument1.Selection
selection1.Search "CATProductSearch.Assembly,all" 'show assemblies in product
Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetShow 0
selection1.Clear
selection1.Search "CATProductSearch.Part,all" 'show Parts in product
Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetShow 0
selection1.Clear
selection1.Search "CATAsmSearch.Part,all" 'show Parts in assembly
Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetShow 0
selection1.Clear
selection1.Search "CATPrtSearch.MechanicalFeature,all"
Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetShow 0
selection1.Clear
selection1.Search "CATPrtSearch.BodyFeature,all" 'show bodies in part
Set visPropertySet1 = selection1.VisProperties
visPropertySet1.SetShow 0
selection1.Clear
Dim specsAndGeomWindow1 As Window
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D1 As Viewer
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
viewer3D1.Reframe
Dim viewpoint3D1 As Viewpoint3D
Set viewpoint3D1 = viewer3D1.Viewpoint3D
End If
CATIA.RefreshDisplay = True
End Sub