Skip to content
TheChatArchiveThe Chat Archive
Amazon Novaamazon-nova-experimental-chat-05-14· AmazonHugging Face LMArena Human Preference 140K

is it possible to export points coordinates from sketch in catia v5?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash’s answer.
  1. User

    is it possible to export points coordinates from sketch in catia v5?

  2. Amazon Nova Assistant

    Yes, it is possible to export point coordinates from a sketch in CATIA V5. There are several methods to achieve this, depending on your specific needs and the format in which you want to export the coordinates. Here are a few common methods:

    Method 1: Using CATScript

    CATScript is CATIA V5's scripting language, and you can use it to automate the process of extracting point coordinates from a sketch.

    1. Open the Sketch: Open the CATIA V5 part containing the sketch from which you want to export points.

    2. Open CATScript Editor:

      • Go to Tools > Macro > Macros...
      • Click New to create a new macro.
      • Select CATScript as the language and click OK.
      • The CATScript editor will open.
    3. Write the Script: Copy and paste the following script into the CATScript editor. This script will extract the coordinates of all points in the active sketch and print them to the message box. You can modify it to write to a file instead.

      Sub CATMain()
         ' Get the active document
         Dim document As Document
         Set document = CATIA.ActiveDocument
      
         ' Get the first part in the document
         Dim part As Part
         Set part = document.Part
      
         ' Get the hybrid bodies
         Dim hybridBodies As HybridBodies
         Set hybridBodies = part.HybridBodies
      
         ' Get the first hybrid body (assuming the sketch is here, adjust if necessary)
         Dim hybridBody As HybridBody
         Set hybridBody = hybridBodies.Item(1)
      
         ' Get the hybrid shapes in the hybrid body
         Dim hybridShapes As HybridShapes
         Set hybridShapes = hybridBody.HybridShapes
      
         ' Loop through the hybrid shapes to find the sketch
         Dim hybridShape As HybridShape
         Dim sketch As Sketch
         For i = 1 To hybridShapes.Count
      	   Set hybridShape = hybridShapes.Item(i)
      	   If hybridShape.Type = catSketch Then
      		   Set sketch = hybridShape.GetItems(1)
      		   Exit For
      	   End If
         Next
      
         If sketch Is Nothing Then
      	   MsgBox "No sketch found in the hybrid body."
      	   Exit Sub
         End If
      
         ' Get the geometric elements in the sketch
         Dim geometricElements As GeometricElements
         Set geometricElements = sketch.GeometricElements
      
         ' Initialise the coordinate string
         Dim coordinates As String
         coordinates = "Point Coordinates:" & vbCrLf
      
         ' Loop through the geometric elements
         Dim geometricElement As GeometricElement
         For i = 1 To geometricElements.Count
      	   Set geometricElement = geometricElements.Item(i)
      	   If geometricElement.Type = catPoint then
      			Dim point as Point
      			set point = geometricElement
      			coordinates = coordinates & "Point " & i & ": (" & point.X & ", " & point.Y & ", " & point.Z & ")" & vbCrLf
      	   End If
         Next
      
         ' Display the coordinates
         MsgBox coordinates
      
      End Sub
      
      
    4. Run the Script:

      • Save the script.
      • Go to Tools > Macro > Macros...
      • Select the macro you just created and click Run.

    This script will display a message box with the coordinates of all points in the sketch. To export these coordinates to a file, you can modify the script to write to a text file using the FileSystemObject.

    Method 2: Using Knowledge Advisor (KBEs)

    1. Open the Sketch: Open the CATIA V5 part containing the sketch.

    2. Open Knowledge Advisor:

      • Go to Tools > Knowledge Advisor > Open Editor.
    3. Create a New Formula:

      • In the Knowledge Advisor, create a new formula.
      • Use the catia.activeeditor.selection.item(1).value.get() method to access the sketch elements.
      • Extract the coordinates and store them in parameters.
    4. Export Parameters:

      • Use the ExportParameters function to export the parameters to a text file.
      • Go to Tools > Knowledge Advisor > Export Parameters... and save the file.

    Method 3: Manual Export Using Coordinates Display

    1. Open the Sketch: Open the CATIA V5 part containing the sketch.

    2. Display Coordinates:

      • Select the points in the sketch.
      • Go to Tools > Annotations > Measure > Coordinates.
      • The coordinates will be displayed in the measurement dialog.
    3. Manually Record Coordinates:

      • Manually record the coordinates displayed in the measurement dialog.
      • Copy them to a text file or spreadsheet.

    Method 4: Using DMU Reviewer

    1. Open the Part in DMU Reviewer:

      • Open the part containing the sketch in DMU Reviewer.
    2. Measure Points:

      • Use the measurement tools in DMU Reviewer to get the coordinates of the points.
    3. Export Measurements:

      • DMU Reviewer allows you to export measurements to a file.
      • Go to Tools > Export > Export Measurements and save the file.

    Choosing the Right Method

    • CATScript: Best for automated, repeated tasks. Requires scripting knowledge.
    • Knowledge Advisor: Useful for integrating with other CATIA functions and parameters.
    • Manual Export: Quick for one-time, small tasks but time-consuming for large numbers of points.
    • DMU Reviewer: Useful if you already use DMU Reviewer for other tasks.

    Choose the method that best fits your skill set and the complexity of your task.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.