I'm trying to write code which can measure geometry coordinates in Catia active document, probably in CATProduct?! this is my code and the result is nothing. MsgBox doesn't show anything.
Sub CatMain()
Dim varFilter(1) As Variant
Dim objSel As Selection
Dim objSelLB As Object ' <--- notice declared as object
Dim strReturn As String
Dim strMsg As String
varFilter(0) = "Body" 'Body represents a solid body
varFilter(1) = "HybridBody" 'HybridBody represents a geometrical set
Set objSel = CATIA.ActiveDocument.Selection
Set objSelLB = objSel
strMsg = "Select a body or geometrical set…"
objSel.Clear
strReturn = objSelLB.SelectElement2(varFilter, strMsg, False)
If strReturn = "Normal" Then
If objSel.Count2 > 0 Then
Set bb = objSel.Item(1).Value
Set cc = bb.HybridShapes
For s = 1 To cc.Count
Set cc = cc.Item(s)
cc.GetCoordinates arrXYZ
MsgBox ((cc.Parent.Name) & Separator & (cc.Name) & Separator & _
arrXYZ(0) & Separator & _
arrXYZ(1) & Separator & _
arrXYZ(2) & vbLf)
Next s
End If
End Sub