×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Catia FT&A macro

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

RE: Catia FT&A macro

(OP)
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?

RE: Catia FT&A macro

Hi,

Where is Else in your code ?

Regards
Fernando

RE: Catia FT&A macro

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources