Catia FT&A macro
Catia FT&A macro
(OP)
I'm writing simple macro for FT&A module and i have strange problem.
Sub CATMain()
Set PartDoc = Catia.ActiveDocument
Set Part = PartDoc.Part
Set AnnotationSets = Part.AnnotationSets
LiczbaZA = AnnotationSets.Count
Set ZbiorAdnotacji = AnnotationSets.Item(1)
Set Adnotacje = ZbiorAdnotacji.annotations
LiczbaA = Adnotacje.Count
dim test as double
dim test2 as double
For Licznik = 1 To LiczbaA
Set Adnotacja = Adnotacje.Item(Licznik)
typ = Adnotacja.Type
If typ = "FTA_LinearDimension" Then
Set Wymiar3d = Adnotacja.Dimension3D
Set PobierzAn = Wymiar3d.Get2dAnnot
Set Wartosc = PobierzAn.GetValue
test = Wartosc.Value
MsgBox (test)
chuj =CDbl( Wartosc.Value)
If (chuj) = 10 Then
MsgBox "ZIOOOM"
End If
End if
Next
End Sub
Sub CATMain()
Set PartDoc = Catia.ActiveDocument
Set Part = PartDoc.Part
Set AnnotationSets = Part.AnnotationSets
LiczbaZA = AnnotationSets.Count
Set ZbiorAdnotacji = AnnotationSets.Item(1)
Set Adnotacje = ZbiorAdnotacji.annotations
LiczbaA = Adnotacje.Count
dim test as double
dim test2 as double
For Licznik = 1 To LiczbaA
Set Adnotacja = Adnotacje.Item(Licznik)
typ = Adnotacja.Type
If typ = "FTA_LinearDimension" Then
Set Wymiar3d = Adnotacja.Dimension3D
Set PobierzAn = Wymiar3d.Get2dAnnot
Set Wartosc = PobierzAn.GetValue
test = Wartosc.Value
MsgBox (test)
chuj =CDbl( Wartosc.Value)
If (chuj) = 10 Then
MsgBox "ZIOOOM"
End If
End if
Next
End Sub





RE: Catia FT&A macro
i'm writing some macro for FT&A module and i have strange problem.
Sub CATMain()
Set PartDoc = Catia.ActiveDocument
Set Part = PartDoc.Part
Set AnnotationSets = Part.AnnotationSets
LiczbaZA = AnnotationSets.Count
Set ZbiorAdnotacji = AnnotationSets.Item(1)
Set Adnotacje = ZbiorAdnotacji.annotations
LiczbaA = Adnotacje.Count
For Licznik = 1 To LiczbaA
Set Adnotacja = Adnotacje.Item(Licznik)
typ = Adnotacja.Type
If typ = "FTA_LinearDimension" Then
Set Wymiar3d = Adnotacja.Dimension3D
Set PobierzAn = Wymiar3d.Get2dAnnot
Set Wartosc = PobierzAn.GetValue
If Wartosc.Value = 10 Then
MsgBox "Ok!"
End If
End if
Next
End Sub
Basically im retriving dimensions from FT&A model using GetValue method. When i have, for example hole with diameter 10 mm, there should be message "Ok!" printed on screen. And everything works fine when the code is in VBA, but when i change it for Catscript if/than/else function isnt working properly. Even though Wartosc.Value = 10 for sure, i cant see that message (condition is always false). Any ideas whats wrong?
RE: Catia FT&A macro
Where is Else in your code ?
Regards
Fernando
RE: Catia FT&A macro