In this tutorial you will see step by step how to build an easy macro to show only needed version parts/product
(When I work in CATSCRIPT I don't work with OPTION EXPLICIT, I don't declare the variables type, this is my approach in this situation, you can set them properly)
'''CATIA CODE
''declare main variable
Set oSel = Catia.ActiveDocument.Selection
Set VisProp = oSel.VisProperties
'start Catia procedure
Sub CatMain()
oSel.Clear
''STEP 1 Input box
strname = InputBox("Type the revision/status/variant")
if strname = "" then
msgbox("Please add somethig")
exit sub
end if
''HIDE all procedure
hide_all()
''Select and serach in selection
oSel.Add Catia.ActiveDocument.product
Osel.Search("Name in graph: *" & strname & "*,sel")
ShowProcedure()
End Sub
Sub hide_all()
oSel.clear
oSel.Search("(((((((((((((('Product Structure'.Part + FreeStyle.Part) + 'Systems Routing'.Part) + 'HVAC Design'.Part) + 'Assembly Design'.Part) + 'Waveguide Diagrams'.Part) + 'HVAC Diagrams'.Part) + 'Part Design'.Part) + 'Systems Space Reservation'.Part) + 'Generative Shape Design'.Part) + 'Functional Molded Part'.Part) + 'Process Applications'.Part) + 'Tubing Diagrams'.Part) + 'Plant Layout'.Part) + 'Piping and Instrumentation Diagrams'.Part),all")
HideRoutine()
oSel.Search("(((((((((('Product Structure'.Assembly + 'Systems Routing'.Assembly) + 'HVAC Design'.Assembly) + 'Assembly Design'.Assembly) + 'Waveguide Diagrams'.Assembly) + 'HVAC Diagrams'.Assembly) + 'Systems Space Reservation'.Assembly) + 'Process Applications'.Assembly) + 'Tubing Diagrams'.Assembly) + 'Plant Layout'.Assembly) + 'Piping and Instrumentation Diagrams'.Assembly),all")
HideRoutine()
oSel.add Catia.Activedocument.product
ShowProcedure()
end sub
Sub HideRoutine()
VisProp.SetShow(1)
oSel.Clear
end sub
Sub ShowProcedure()
VisProp.SetShow(0)
oSel.Clear
end sub