Hi Guys,
I am new in this forum and first i wanna say hello to all of you!
I am a new VBA user for CATIA V5 and i need your advice. I am not looking for someone who does the project for me but just some tips, so please if you can help me.
I am developing a macro to import in excel the data from a part, geometry and specifications, basically i need to count and to assign a number to each surface of the part, and for each surface to extract the specifications if present on it.
I understood the part about how to extract the specifications but i dont know how to link every specification to its surface.
Thats what i wrote up to now:
---------------------------------------------
Sub CATMain()
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim annotationSets1 As AnnotationSets
Set annotationSets1 = part1.AnnotationSets
Dim annotationSet1 As AnnotationSet
Set annotationSet1 = annotationSets1.Item(1)
Dim annotations As annotations
Set annotations = annotationSet1.annotations
Dim IdxAnnot
Dim AnnotName
Dim AnnotSuperType
Dim AnnotType
For IdxAnnot = 1 To annotations.Count
Set Annotation = annotations.Item(IdxAnnot)
AnnotName = Annotation.Name
AnnotSuperType = Annotation.SuperType
AnnotType = Annotation.Type
'MsgBox ("Annotation: " & IdxAnnot & " " & AnnotName & " , " & AnnotSuperType & " , " & AnnotType
Select Case AnnotType
Case "FTA_DatumSimple"
Label = Annotation.DatumSimple.Label
MsgBox ("Annotation: " & IdxAnnot & " , " & AnnotSuperType & " , " & Label
Case "FTA_ReferenceFrame"
Set AllDatumsSimple = Annotation.ReferenceFrame.AllDatumsSimple (WRONG)
For DatumsCount = 1 To AllDatumsSimple.Count
Set Datum1 = AllDatumsSimple.Item(DatumsCount
'Set Label = Datum1.DatumSimple.Label
MsgBox DatumsCount
Next
'MsgBox ("Annotation: " & IdxAnnot & " , " & AnnotSuperType & " , " & Label)
........
End Select
.........
Next
...........
-------------------------------------------------
I know is nothing special and there are errors, but i dont know how to fix it.
Basically what i want to do is for each type of specification retrieve the information I need, but how to understand these specifications on which surface are applied? and for each surface i need to know on which plan is positioned (normal vector).
I hope I explained my problem clearly and that someone could help me.
Thank you guys
I am new in this forum and first i wanna say hello to all of you!
I am a new VBA user for CATIA V5 and i need your advice. I am not looking for someone who does the project for me but just some tips, so please if you can help me.
I am developing a macro to import in excel the data from a part, geometry and specifications, basically i need to count and to assign a number to each surface of the part, and for each surface to extract the specifications if present on it.
I understood the part about how to extract the specifications but i dont know how to link every specification to its surface.
Thats what i wrote up to now:
---------------------------------------------
Sub CATMain()
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim annotationSets1 As AnnotationSets
Set annotationSets1 = part1.AnnotationSets
Dim annotationSet1 As AnnotationSet
Set annotationSet1 = annotationSets1.Item(1)
Dim annotations As annotations
Set annotations = annotationSet1.annotations
Dim IdxAnnot
Dim AnnotName
Dim AnnotSuperType
Dim AnnotType
For IdxAnnot = 1 To annotations.Count
Set Annotation = annotations.Item(IdxAnnot)
AnnotName = Annotation.Name
AnnotSuperType = Annotation.SuperType
AnnotType = Annotation.Type
'MsgBox ("Annotation: " & IdxAnnot & " " & AnnotName & " , " & AnnotSuperType & " , " & AnnotType
Select Case AnnotType
Case "FTA_DatumSimple"
Label = Annotation.DatumSimple.Label
MsgBox ("Annotation: " & IdxAnnot & " , " & AnnotSuperType & " , " & Label
Case "FTA_ReferenceFrame"
Set AllDatumsSimple = Annotation.ReferenceFrame.AllDatumsSimple (WRONG)
For DatumsCount = 1 To AllDatumsSimple.Count
Set Datum1 = AllDatumsSimple.Item(DatumsCount
'Set Label = Datum1.DatumSimple.Label
MsgBox DatumsCount
Next
'MsgBox ("Annotation: " & IdxAnnot & " , " & AnnotSuperType & " , " & Label)
........
End Select
.........
Next
...........
-------------------------------------------------
I know is nothing special and there are errors, but i dont know how to fix it.
Basically what i want to do is for each type of specification retrieve the information I need, but how to understand these specifications on which surface are applied? and for each surface i need to know on which plan is positioned (normal vector).
I hope I explained my problem clearly and that someone could help me.
Thank you guys