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!

Catia macro to get rotation axis?

Status
Not open for further replies.

jproberge

Mechanical
May 2, 2014
10
CA
Hello everyone,

I have an assembly with two parts that are linked by a revolute joint. I want to write a macro to get the orientation of the revolution axis?

Any idea how to do that?

Thanks!
 
Replies continue below

Recommended for you

Wow, I still don't know how to do this.

So if by chance someone knew, I would be very interested how I could accomplished that directly or indirectly...

Thanks
 
here is the axis of the coincidence:

Code:
    Sub CATMain()

    Dim oDoc As Document
    Set oDoc = CATIA.ActiveDocument

    Dim oProd As Product
    Set oProd = oDoc.Product

    Dim oConstraintsCol As Constraints
    Set oConstraintsCol = oProd.Connections("CATIAConstraints")

    Dim oCoincid As Constraint
    Set oCoincid = oConstraintsCol.Item(2) ' I have a fix as the first constraint

    Dim oRef1 As Reference
    Set oRef1 = oCoincid.GetConstraintElement(1) ' get first element of the coicidence

    oDoc.Selection.Clear
    oDoc.Selection.Add oRef1 ' just for fun

    Dim TheSPAWorkbench As Workbench
    Set TheSPAWorkbench = oDoc.GetWorkbench("SPAWorkbench")

    Set TheMeasurable = TheSPAWorkbench.GetMeasurable(oRef1)

    Dim aAxisVector(2)

    TheMeasurable.GetDirection aAxisVector

    MsgBox (" vector of coincidence = " _
        & aAxisVector(0) & "," & aAxisVector(1) & "," & aAxisVector(2))


    oDoc.Selection.Clear

    End Sub

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top