×
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

Reading face details using VB macro

Reading face details using VB macro

Reading face details using VB macro

(OP)
Hi!

I'm would like to read face details (i.e. face vector, and the origin for that vector). Despite many tyrings, I still don't have the solution.

My latest idea is to use the Face object as is thas the methods get:

Sub CATMain()
Set objSel = CATIA.ActiveDocument.Selection
objSel.Search ("Type=Face,all")

Dim SingleFace As Face

For i = 1 To objSel.Count
Dim oSel As objSel.Item(i)
'?????? What to do furhter??
Next
End Sub

Do you now how to read the data of the face/plane? The required data are stored in Plane object and are accessible through the methods GetFirstAxis and GetPosition.

Regards,
Janusz

RE: Reading face details using VB macro

Hi Janusz,
I am not sure exactly what you are looking for, but perhaps this can help you:

CODE --> vba

Sub CATMain()
    Set objSel = CATIA.ActiveDocument.selection
    objSel.Search ("Type=Face,all")

    Dim singleFace
    Dim axes1(2)
    Dim axes2(2)
    Dim origin(2)

    For i = 1 To objSel.Count
        Set singleFace = objSel.Item2(i).Value
        
        singleFace.GetFirstAxis axes1
        singleFace.GetSecondAxis axes2
        singleFace.GetOrigin origin
        
        Debug.Print "FirstAxis: " & Join(axes1, ",")
        Debug.Print "SecondAxis: " & Join(axes2, ",")
        Debug.Print "Origin: " & Join(origin, ",")
    Next
 End Sub 

Tesak
http://scripts4all.eu/txtoncurve/ - Text along a curve for Catia V5

RE: Reading face details using VB macro

(OP)
Dear tesak,

Thanks!
Your tip exactly fulfills my needs.

The only problem is that it works when I have cuboid. When I have cylidner, for example, I receive the message "Object doesn't support this property or method".

Do you have any ideas how to cope with this?

Regards,
Janusz

RE: Reading face details using VB macro

Posted solution works only for planar faces and planes, you have to skip general surfaces within a loop.

Tesak
http://scripts4all.eu/txtoncurve/ - Text along a curve for Catia V5

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