Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia FT&A macro

Status
Not open for further replies.

estrellas

Mechanical
Joined
May 13, 2012
Messages
3
Location
PL
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
 
One more time,
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?
 
Hi,

Where is Else in your code ?

Regards
Fernando
 
My mistake, but it's all about line: "If Wartosc.Value = 10 Then", even when Wartosc.Value is 10 (for sure!) this condition is false.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top