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!

Reading face details using VB macro

Status
Not open for further replies.

GielduGieldu

Mechanical
Jul 17, 2016
2
PL
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
 
Replies continue below

Recommended for you

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

Code:
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
- Text along a curve for Catia V5
 
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top