AtomicNico
Nuclear
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:
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:
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)