×
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

COG in meter and other coordinates in mm

COG in meter and other coordinates in mm

COG in meter and other coordinates in mm

(OP)
Hello everybody,
I'm using a macro to extract some characteristics of my parts, especially coordinates.

But I don't understand why the coordinates of the Center of Gravity are in meter in my Excel file while the other are in millimeters.

I built my code in the same way for the different coordinates so I don't understand why it's different.

Example of my code:

CODE --> CATScript

objGCATIASelection0.Search "(CATLndSearch.Product),all"
  Dim objProduct As Part
  Dim objProductMat As Part
  Dim intNbParts As Integer
  Dim ii As Integer
    Dim intNbEdges As Integer
    Dim doc, sel, spa, ref, measurable
    Dim jj As Integer
    Dim kk As Integer
    Dim objInertia As Inertia
    Set objInertia = objProduct.GetTechnologicalObject("Inertia")
    Dim Coordinates(2)
    objInertia.GetCOGPosition Coordinates

     Set doc = CATIA.ActiveDocument
    Set sel = doc.Selection
    Set spa = doc.GetWorkbench("SPAWorkbench")

   sel.Search "Topology.CGMEdge,all"
    intNbEdges = sel.Count
   EdgeNB = 1 
    For jj = 1 To intNbEdges

        Set myCircle = sel.Item(jj)
        If myCircle.Type = "TriDimFeatEdge" Then
             If myCircle.LeafProduct.Name = partName Then 
                Set ref = sel.Item(jj).Reference
                Set measurable = spa.GetMeasurable(ref)
                Dim oCoordinates(2)
                measurable.GetCenter oCoordinates
                Dim Radius As Long
                Radius = measurable.Radius

                WriteToEXCELRunSheet intGReportCurrentRow, strGReportTitleCOGX, Round(Coordinates(0), 3)
                     WriteToEXCELRunSheet intGReportCurrentRow, strGReportTitleEndX, Round(oCoordinates(0), 3) 

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