Jegsaran
Automotive
- Dec 16, 2020
- 42
Hello everyone,
I am working in an assembly which contains numerous child products and parts. I am trying to measure the coordinate of a circular edge, all I am getting is based on the part's axis system. I need to get the global coordinate. Is there any idea to get it?
As far as I have the following code;
Sub CATMain()
Dim doc, sel, spa, ref, measurable
Dim inputObjectType(0)
Set doc = CATIA.ActiveDocument
Set sel = doc.Selection
'Selection of circular edge
inputObjectType(0) = "TriDimFeatEdge"
Status = sel.SelectElement2(inputObjectType, "Select the circular edge", True)
If (Status = "cancel") Then Exit Sub
Set ref = sel.Item(1).Reference
Set spa = doc.GetWorkbench("SPAWorkbench")
Set measurable = spa.GetMeasurable(ref)
sel.Clear
Dim aRel(2)
measurable.GetCenter aRel
MsgBox "x = " & aRel(0) & " ; y = " & aRel(1) & " ; z = " & aRel(2)
End Sub
I am working in an assembly which contains numerous child products and parts. I am trying to measure the coordinate of a circular edge, all I am getting is based on the part's axis system. I need to get the global coordinate. Is there any idea to get it?
As far as I have the following code;
Sub CATMain()
Dim doc, sel, spa, ref, measurable
Dim inputObjectType(0)
Set doc = CATIA.ActiveDocument
Set sel = doc.Selection
'Selection of circular edge
inputObjectType(0) = "TriDimFeatEdge"
Status = sel.SelectElement2(inputObjectType, "Select the circular edge", True)
If (Status = "cancel") Then Exit Sub
Set ref = sel.Item(1).Reference
Set spa = doc.GetWorkbench("SPAWorkbench")
Set measurable = spa.GetMeasurable(ref)
sel.Clear
Dim aRel(2)
measurable.GetCenter aRel
MsgBox "x = " & aRel(0) & " ; y = " & aRel(1) & " ; z = " & aRel(2)
End Sub