Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

[MACRO] CATIA need for advice, please help me

Status
Not open for further replies.

scarda

Mechanical
Apr 23, 2014
14
US
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
 
Replies continue below

Recommended for you

you should be able to get the coordinate of the vertex the same way you get coordinates from a point

Eric N.
indocti discant et ament meminisse periti
 
Hi Fernando, Hi Eric,

Thank you guys for your replies, always useful!

At the beginning i tried using the getcoordinates method, but i got an error (object doesn't support this property or method),
so i thought it was not possible to use it for vertices.

After your replies i tried using a code i found on another forum and it worked,
now i am sure the problem it's my code, i will compare them to understand the error.

Thank you guys for the help, it's all thanks to people like you if we new users dont give up!

Regards

Sergio


 
for a solution : faq560-1377

why does catia does this ==> read this



Eric N.
indocti discant et ament meminisse periti
 
Hi Fernando, Hi Eric,

it's always nice to find your replies!

Eric, thank you very much for your links, they would be really useful considering that are the two cases in which i had troubles:

about the extraction of vertices' coordinates i used getcoordinates and it didnt work, i will try the solution suggested in your link.

I saw in your code you used the module getpoints instead of getcoordinates,
seems like with both i can get the coordinates of a point so whats the difference?

about the selectelement2 module i tried other suggestions i found on other forums but they didnt work,
i will try the solution suggested in your link and let you know!

Fernando, thank you for your support, i still need to understand how to do a couple of things,
but if i succeed for sure i will show you, and if it could help some users would be a pleasure!
(its going quite slow because i am busy with my thesis but sooner or later i will finish it)

Guys I still have a question: i have a part with tolerance annotations and i need to retrieve their information,
i know how to browse the annotations set and find all the annotations,
but i dont know how to retrieve the information about which geometrical entity the annotation is applied to, some suggestion?

Thank you again guys,

Regards from Beijing

Sergio



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top