OBTAIN CAPTURES' VALUE
OBTAIN CAPTURES' VALUE
(OP)
Hello All,
I have a VBA code below, which cycles through captures in CATPart 3D Annotation set in a part document as per image below.
How can I obtain value of all captures in the CATPart 3D Annotation set.
Example: when first screen capture "All" displays, it will display string "All" and I want to save this string "All" in a variable as well.
Other similar strings (ie. PART INFORMATION, DESIGN NOTES...etc) should also be obtained, displayed and saved to variables as well.
================= my VBA CODE ===============
Sub CATMain()
MsgBox "Active document must be a part document and captures are expanded " & Chr(13) & "in order to have the macro works properly."
'//// Access the active document
Dim PartDoc As Document
Set PartDoc = CATIA.ActiveDocument
'//// Set PartRoot part from the PartDoc part document
Set PartRoot = PartDoc.Part
'//// Set user's annotation collection = PartRoot annotation sets, which has multiple annotation sets
Set myAnnotCollection = PartRoot.AnnotationSets
' myAnnotCollection.Clear
'//// Get first annotation set from annotation collection, myAnnotCollection
Dim AnnoSet1
Set AnnoSet1 = myAnnotCollection.Item(1)
'//// Get the number of captures in "annotSet1" above
Dim myCaptures, NumberOfCaptures
Set myCaptures = AnnoSet1.Captures '//// Access captures inside the annotation set
NumberOfCaptures = AnnoSet1.Captures.Count
MsgBox "Number of annotation sets in active document is: " & myAnnotCollection.Count & " and number of captures is: " & NumberOfCaptures
'//// Loop through capture collection
Dim j As Integer
For j = 1 To myCaptures.Count
'//// Display the current capture
Set myCaptures = AnnoSet1.Captures.Item(j)
'//// Display the annotated Capture, one-by-one, on the monitor
myCaptures.DisplayCapture
MsgBox "Capture #: " & j
Next
End Sub
============================== my image mentioned above for illustration ============

Any help from Ferdo and any of you is greatly appreciated.
Thank you All in advance
Quin
I have a VBA code below, which cycles through captures in CATPart 3D Annotation set in a part document as per image below.
How can I obtain value of all captures in the CATPart 3D Annotation set.
Example: when first screen capture "All" displays, it will display string "All" and I want to save this string "All" in a variable as well.
Other similar strings (ie. PART INFORMATION, DESIGN NOTES...etc) should also be obtained, displayed and saved to variables as well.
================= my VBA CODE ===============
Sub CATMain()
MsgBox "Active document must be a part document and captures are expanded " & Chr(13) & "in order to have the macro works properly."
'//// Access the active document
Dim PartDoc As Document
Set PartDoc = CATIA.ActiveDocument
'//// Set PartRoot part from the PartDoc part document
Set PartRoot = PartDoc.Part
'//// Set user's annotation collection = PartRoot annotation sets, which has multiple annotation sets
Set myAnnotCollection = PartRoot.AnnotationSets
' myAnnotCollection.Clear
'//// Get first annotation set from annotation collection, myAnnotCollection
Dim AnnoSet1
Set AnnoSet1 = myAnnotCollection.Item(1)
'//// Get the number of captures in "annotSet1" above
Dim myCaptures, NumberOfCaptures
Set myCaptures = AnnoSet1.Captures '//// Access captures inside the annotation set
NumberOfCaptures = AnnoSet1.Captures.Count
MsgBox "Number of annotation sets in active document is: " & myAnnotCollection.Count & " and number of captures is: " & NumberOfCaptures
'//// Loop through capture collection
Dim j As Integer
For j = 1 To myCaptures.Count
'//// Display the current capture
Set myCaptures = AnnoSet1.Captures.Item(j)
'//// Display the annotated Capture, one-by-one, on the monitor
myCaptures.DisplayCapture
MsgBox "Capture #: " & j
Next
End Sub
============================== my image mentioned above for illustration ============

Any help from Ferdo and any of you is greatly appreciated.
Thank you All in advance
Quin





RE: OBTAIN CAPTURES' VALUE
indocti discant et ament meminisse periti
RE: OBTAIN CAPTURES' VALUE
Now, i try to compare captured capture values with text string. How could I achieve?
I used If statement to display captures having non "All" or "Change" values as follow
Dim myString
Set myString = myCaptures.Name
If myString <> "All"
[/indent]'//// Display the annotated Capture, one-by-one, on the monitor
myCaptures.DisplayCapture
End If
but it does not work.
Do you have any idea?
Thank you
Quin
RE: OBTAIN CAPTURES' VALUE
so what does it do? what do you expect?
Maybe you're missing a loop like
CODE -->
indocti discant et ament meminisse periti