0% found this document useful (0 votes)
291 views2 pages

Export Point To CATIA

This document provides code to export points from a CATIA model into an Excel spreadsheet. It uses VBA macros to start Excel, create a new workbook, and add a worksheet. The CATIA model's points are then looped through and their name, x, y, and z coordinates are written to the Excel sheet. The macro searches the CATIA document for all points, gets the coordinate values of each, and writes them to the sheet in separate cells. This allows points from a CATIA model to be exported to Excel for further analysis or documentation.

Uploaded by

Sreeja Sunder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
291 views2 pages

Export Point To CATIA

This document provides code to export points from a CATIA model into an Excel spreadsheet. It uses VBA macros to start Excel, create a new workbook, and add a worksheet. The CATIA model's points are then looped through and their name, x, y, and z coordinates are written to the Excel sheet. The macro searches the CATIA document for all points, gets the coordinate values of each, and writes them to the sheet in separate cells. This allows points from a CATIA model to be exported to Excel for further analysis or documentation.

Uploaded by

Sreeja Sunder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

30/10/2015 how to export points in catia into .txt file or to excel sheet?

 ­ GrabCAD

I got this from some user in some forum. Did some modification in it as well. You may try to find out if its working.

Dim objGEXCELapp As Object 
Dim objGEXCELwkBks As Object 
Dim objGEXCELwkBk As Object 
Dim objGEXCELwkShs As Object 
Dim objGEXCELSh As Object 
Dim fs, f, f1, fc, s 
Dim coords(2) As Integer 
Dim PartDocument1

Sub CATMain()

CATIA.ActiveDocument.Selection.Search "CATGmoSearch.Point,all"

StartEXCEL

ExportPoint

'objGEXCELSh.Application.ActiveWorkbook.SaveAs (ExcelFolder &
Left(CATIA.ActiveDocument.Name,Len(CATIA.ActiveDocument.Name)­8) & ".xls") 
'objGEXCELSh.Application.ActiveWorkbook.Close

End Sub

'****************************************************************************** 
Sub StartEXCEL() 
'****************************************************************************** 
Err.Clear 
On Error Resume Next 
Set objGEXCELapp = GetObject (,"EXCEL.Application") 

If Err.Number <> 0 Then 
Err.Clear 
Set objGEXCELapp = CreateObject ("EXCEL.Application") 
End If

objGEXCELapp.Application.Visible = TRUE 
Set objGEXCELwkBks = objGEXCELapp.Application.WorkBooks 
Set objGEXCELwkBk = objGEXCELwkBks.Add 
Set objGEXCELwkShs = objGEXCELwkBk.Worksheets(1) 
Set objGEXCELSh = objGEXCELwkBk.Sheets (1) 
objGEXCELSh.Cells (1,"A") = "Name" 
objGEXCELSh.Cells (1,"B") = "X" 
objGEXCELSh.Cells (1,"C") = "Y" 
objGEXCELSh.Cells (1,"D") = "Z"

End Sub

'****************************************************************************** 
Sub ExportPoint() 
'****************************************************************************** 
For i = 1 To CATIA.ActiveDocument.Selection.Count 
Set selection = CATIA.ActiveDocument.Selection 
Set element = selection.Item(i) 
Set point = element.value

data:text/html;charset=utf­8,%3Cp%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%200px%2016px%3B%20border%3A%200px%3B%20f… 1/2
30/10/2015 how to export points in catia into .txt file or to excel sheet? ­ GrabCAD

'Write PointData to Excel Sheet 
point.GetCoordinates(coords)

objGEXCELSh.Cells (i+1,"A") = point.name 
objGEXCELSh.Cells (i+1,"B") = coords(0) 
objGEXCELSh.Cells (i+1,"C") = coords(1) 
objGEXCELSh.Cells (i+1,"D") = coords(2)

Next

End Sub

data:text/html;charset=utf­8,%3Cp%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%200px%2016px%3B%20border%3A%200px%3B%20f… 2/2

You might also like