Exporting points in catia into .txt file or to Excel sheet
2016-12-25 09:45
3039 查看
Exporting points in catia into .txt file or to Excel sheet
https://grabcad.com/questions/how-to-export-points-in-catia-into-txt-file-or-to-excel-sheet
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
'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
https://grabcad.com/questions/how-to-export-points-in-catia-into-txt-file-or-to-excel-sheet
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
'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
相关文章推荐
- SQLite Tutorial 5 : How to Import CSV or Excel file into SQLite database
- How to create an Excel sheet or chart in VC?
- How to create an Excel sheet or chart in VC?
- Read a Text File with VBA in Excel, and Write the Text to a Spreadsheet
- SQLite Tutorial 4 : How to export SQLite file into CSV or Excel file
- JSP中出现According to TLD or attribute directive in tag file
- 使用JSTL 报According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- How to generate a log file in VC++ or Embedded VC++ (For Pocket PC or WinCE devices)
- According to TLD or attribute directive in tag file, attribute items does not accep t any expressions
- How To Enable or Disable Simple File Sharing in Windows XP
- JSTL:JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- How to use an ActiveX script task to import data into a new Excel file
- JSP中出现According to TLD or attribute directive in tag file
- JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- Simple VBScript program to extract data from all worksheets in an Excel spreadsheet
- According to TLD or attribute directive in tag file, attribute test does not accept any expressions
- JSTL的问题(According to TLD or attribute directive in tag file, attribute value does not accept any expressions)
- 使用JSTL tag时出现错误:According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions(转贴)
- Simple VBScript program to extract data from all worksheets in an Excel spreadsheet