Eland
Aerospace
- Jul 21, 2004
- 5
I'm trying to select some elements to hide, that is the same thing to click mouse with Ctrl key in the working window. However I cannot go further because of the Selection.Add() command.
Maybe the problem is improper object in the ().
My sample script is shown bellow
Language="VBSCRIPT"
Sub CATMain()
Set part1 = CATIA.ActiveDocument.Part
Set selection1 = CATIA.ActiveDocument.Selection
Set hybridBodies1 = part1.HybridBodies
Number1 = hybridBodies1.Count - 1
For j = 1 To Number1
Set hybridBody1 = hybridBodies1.Item(j)
Set hybridShapes1 = hybridBody1.HybridShapes
Number2 = hybridShapes1.Count
For i = 1 To Number2
Set elementToHide = hybridShapes1.Item(i)
Set selection = selection1.Add(elementToHide) <<<<< This guy has an error.
Next
Next
CATIA.StartCommand("Hide/Show")
End Sub
Oh, one more thing... Is is possible to select open_body itself to hide all elements belonged to that?
Thank you in precedence.
Maybe the problem is improper object in the ().
My sample script is shown bellow
Language="VBSCRIPT"
Sub CATMain()
Set part1 = CATIA.ActiveDocument.Part
Set selection1 = CATIA.ActiveDocument.Selection
Set hybridBodies1 = part1.HybridBodies
Number1 = hybridBodies1.Count - 1
For j = 1 To Number1
Set hybridBody1 = hybridBodies1.Item(j)
Set hybridShapes1 = hybridBody1.HybridShapes
Number2 = hybridShapes1.Count
For i = 1 To Number2
Set elementToHide = hybridShapes1.Item(i)
Set selection = selection1.Add(elementToHide) <<<<< This guy has an error.
Next
Next
CATIA.StartCommand("Hide/Show")
End Sub
Oh, one more thing... Is is possible to select open_body itself to hide all elements belonged to that?
Thank you in precedence.