Tips & Tricks

 
 

Tip 1:

How to Display Functional Tolerance & Annotation Information using VB 
  
Answer
The following can be placed in a .CATScript and run as a macro in CATIA to return information about Datums, Roughness, Notes created with Functional Tolerance & Annotation workbench:
Sub CATMain()

Dim PartDoc As Document
Set PartDoc = CATIA.ActiveDocument

Dim Part As Part
Set Part = PartDoc.Part

Dim AnnotationSets As AnnotationSets
Set AnnotationSets = Part.AnnotationSets

For i = 1 To AnnotationSets.Count
Set AnnotationSet = AnnotationSets.Item(i)
MsgBox (AnnotationSets.Item(i).Name)
Set Annotations = AnnotationSet.Annotations

For j = 1 To Annotations.Count
Set Annotation = Annotations.Item(j)
annotSuperType = Annotation.SuperType
annotType = Annotation.Type

Select Case annotSuperType
Case "FTA_NonSemantic"
Select Case annotType
Case "FTA_Text"
Text = Annotation.Text.Text & sLF
MsgBox Annotation.Name & " = " & Text
Case "FTA_Roughness"
Applicability = Annotation.Roughness.Applicability
Obtention = Annotation.Roughness.Obtention
Field1 = Annotation.Roughness.Field(1)
MsgBox Annotation.Name & " -> Field1 = " & (Annotation.Roughness.Field(1))
Field2 = Annotation.Roughness.Field(2)
MsgBox Annotation.Name & " -> Field2 = " & (Annotation.Roughness.Field(2))
Field3 = Annotation.Roughness.Field(3)
MsgBox Annotation.Name & " -> Field3 = " & (Annotation.Roughness.Field(3))
Field4 = Annotation.Roughness.Field(4)
MsgBox Annotation.Name & " -> Field4 = " & (Annotation.Roughness.Field(4))
Field5 = Annotation.Roughness.Field(5)
MsgBox Annotation.Name & " -> Field5 = " & (Annotation.Roughness.Field(5))
Field6 = Annotation.Roughness.Field(6)
MsgBox Annotation.Name & " -> Field6 = " & (Annotation.Roughness.Field(6))
Field7 = Annotation.Roughness.Field(7)
MsgBox Annotation.Name & " -> Field7 = " & (Annotation.Roughness.Field(7))
End Select
End Select

Select Case annotType
Case "FTA_DatumSimple"
Label1 = Annotation.DatumSimple.Label
MsgBox Annotation.Name & " = " & (Annotation.DatumSimple.Label)
End Select

Next
Next
End Sub

 

Tip 2:
 

When a V4 .session is opened in V5, a CATProduct is created, but it contains no geometry. How do you read a V4 Session into V5 CATProduct?  
  
Cause
The session must be created correctly in V4, making sure to select 'Save reference only' when saving the session, see Step 4 below.
Also, the .session file and all V4 models must be stored in the same directory on the V5 machine. 

Answer
Steps to take a V4 Session to V5.

In V4:
--------
1. Set up Session declaration (DLNAME) in V4

Example: CATIA.SESSION = '"/catdb/session","MY_SESSION_FILE"' ;

2. Create Session in V4 using: File - New - Session

3. Add models to Session using: File - Add Passive

4. Save Session using:

File - Save Session as...
Select Session file (DLNAME set in Step 1 above) to save to
Enter Session name
Select 'Save reference only'

In V5:
--------
5. Copy the SESSION.SESSION file and ALL V4 MODELS used in the V4
Session to the V5 machine. Store all files in the same directory.

6. Open Session using: File - Open, select the SESSION.SESSION file.

The result will be V4 .models in a V5 CATProduct. 

 
© 2008 EDS Technologies.