SPAWorkbench Or Measure in V6 3DExperience - Scripting
SPAWorkbench Or Measure in V6 3DExperience - Scripting
(OP)
UPDATE: I think I solved this.
Switched companies and now use 3DExperience and am wanting to get Point2D coordinates in the 3D space. I can get the objects coordinates in a 2D space referenced from the sketch axis, but not from the basic axis. I used to get at this issue with the SPAWorkbench and measure function. I haven't found anything from an internet search that has solved this. Anyone on here have a good solution? Also, anyone know of an API for 3Dx? I appreciate any assistance!
I'm using Excel VBA to Get and Put points and struggling on the Get side of things.
This code did run for normal Points prior to me adding in the SPA stuff.
UPDATE:
I was stumped for a good long while and then found a breadcrumb 30 minutes after I asked the question. That's how it works right! Corrected code shown below.
Switched companies and now use 3DExperience and am wanting to get Point2D coordinates in the 3D space. I can get the objects coordinates in a 2D space referenced from the sketch axis, but not from the basic axis. I used to get at this issue with the SPAWorkbench and measure function. I haven't found anything from an internet search that has solved this. Anyone on here have a good solution? Also, anyone know of an API for 3Dx? I appreciate any assistance!
I'm using Excel VBA to Get and Put points and struggling on the Get side of things.
This code did run for normal Points prior to me adding in the SPA stuff.
UPDATE:
I was stumped for a good long while and then found a breadcrumb 30 minutes after I asked the question. That's how it works right! Corrected code shown below.
CODE -->
Sub ExportPointMain(Units As String) ' Added Reference: CATIA CATOpnsMeasureIDLItf Object Library ' to understand usage of the MeasurableService (like old SPAWorkbench) Dim convertfct As String If Units = "in" Then convertfct = 25.4 Else convertfct = 1 End If ' V5R12 - Create dedicate openBody for created geometry 'Get CATIA Dim CATIA As Object Set CATIA = GetCATIA Set objWorkbook = ThisWorkbook Set objsheet = objWorkbook.Sheets("ExportFromCatia") Dim cmdrtn As String 'Exporting point coordinates to the excel using multiselection and for loop Dim oSel 'Set oSel = CATIA.ActiveDocument.Selection Set oSel = CATIA.ActiveEditor.Selection Dim MeasureServ Set MeasureServ = CATIA.ActiveEditor.GetService("MeasurableService") ' set TheSPAWorkbench 'Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench") ' set TheSPAWorkbench Dim Filter(1) Filter(0) = "Point" Filter(1) = "Point2D" Dim F_Point As String 'F_Point = oSel.SelectElement3(Filter, "Select points for coordinate export", False, CATMultiSelectionMode.CATMultiSelTriggWhenUserValidatesSelection, False) F_Point = oSel.SelectElement3(Filter, "Select points for coordinate export", False, 2, False) Dim coords(2) As Variant Dim TheMeaurable For X = 1 To oSel.Count Set Point = oSel.Item(X).Value 'If oSel.Item(X).Type = "Point2D" Then 'Function GetMeasurable(iMeasuredItem As AnyObject, iType As CATMeasurableType) As MeasurableInContext Set TheMeasurable = MeasureServ.GetMeasurable(Point, 8) ' set Measurable with reference cmdrtn = TheMeasurable.GetPoint(coords(0), coords(1), coords(2)) ' get coordinates from Measurable 'Else ' cmdrtn = Point.getcoordinates(coords) 'End If objsheet.Cells(4 + X, 4) = oSel.Item(X).Value.Name objsheet.Cells(4 + X, 1) = coords(0) / convertfct objsheet.Cells(4 + X, 2) = coords(1) / convertfct objsheet.Cells(4 + X, 3) = coords(2) / convertfct Next 'x End Sub