×
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!

*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

SPAWorkbench Or Measure in V6 3DExperience - Scripting

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.

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 
Replies continue below

Recommended for you

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! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close