CATIA VBA Macro to Hide Parts
CATIA VBA Macro to Hide Parts
(OP)
In need of some programming help.
I'm trying to create a macro to hide all hardware from an assembly. (i.e. NAS*, SL*, etc.) The problem I am having is that if a sketch within a sub-assy has the hole feature name SLXXX the macro recognizes that as an instance and hides the sketch, therefore hiding the entire sub-assy. Is there any way around this?
Below is the code I have so far.
Sub HideHardware()
'Finding and hiding all hardware
MsgBox ("This Macro will hide all common hardware: SL*, NAS*, MS*, TYE*, AN*, CCR*"), vbOKOnly
Set productDocument1 = CATIA.ActiveDocument
Set Selection1 = productDocument1.Selection
Selection1.Search "Name = NAS*+AN*+MS*+TYE*+SL*+CCR*, sel"
Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties
visProperties1.SetShow catVisPropertyNoShowAttr
End Sub
Any help would be much appreciated.
I'm trying to create a macro to hide all hardware from an assembly. (i.e. NAS*, SL*, etc.) The problem I am having is that if a sketch within a sub-assy has the hole feature name SLXXX the macro recognizes that as an instance and hides the sketch, therefore hiding the entire sub-assy. Is there any way around this?
Below is the code I have so far.
Sub HideHardware()
'Finding and hiding all hardware
MsgBox ("This Macro will hide all common hardware: SL*, NAS*, MS*, TYE*, AN*, CCR*"), vbOKOnly
Set productDocument1 = CATIA.ActiveDocument
Set Selection1 = productDocument1.Selection
Selection1.Search "Name = NAS*+AN*+MS*+TYE*+SL*+CCR*, sel"
Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties
visProperties1.SetShow catVisPropertyNoShowAttr
End Sub
Any help would be much appreciated.





RE: CATIA VBA Macro to Hide Parts
The following code do the job
CODE --> CATVBA
Sub HideHardware() 'Finding and hiding all hardware MsgBox ("This Macro will hide all common hardware: SL*, NAS*, MS*, TYE*, AN*, CCR*"), vbOKOnly Set productDocument1 = CATIA.ActiveDocument Set Selection1 = productDocument1.Selection Selection1.Search "Name = NAS*+AN*+MS*+TYE*+SL*+CCR*, sel" Dim itemInSelection As Integer itemInSelection = Selection1.Count U = 1 While U <= itemInSelection Set checkItem = Selection1.Item(U).Value If TypeName(checkItem) <> "Part" Then Selection1.Remove (U) itemInSelection = itemInSelection - 1 U = U - 1 End If U = U + 1 Wend Set visProperties1 = CATIA.ActiveDocument.Selection.VisProperties visProperties1.SetShow catVisPropertyNoShowAttr End Subindocti discant et ament meminisse periti
RE: CATIA VBA Macro to Hide Parts
CODE --> CATVBA
indocti discant et ament meminisse periti
RE: CATIA VBA Macro to Hide Parts
CODE --> CATVBA
indocti discant et ament meminisse periti
RE: CATIA VBA Macro to Hide Parts