NaWin55
Mechanical
- Mar 21, 2020
- 97
hello all.
i want to export X,Y & Z values of points to excel spreadsheet
i have created a macro where i can select X parameter but i am trying to export it to excel first column or any column, all the x values in one column
y & z
here is the macro
Option Explicit
Sub CATpoints()
Dim oDoc As Document
Set oDoc = CATIA.ActiveDocument
Dim rootPart As Part
Set rootPart = CATIA.ActiveDocument.Part
Dim partDoc As PartDocument
Set partDoc = CATIA.ActiveDocument
Dim oBodies As bodies
Set oBodies = rootPart.bodies
Dim oBody As Body
Set oBody = oBodies.Item(1)
Dim hyBShape As HybridShapes
Set hyBShape = oBody.HybridShapes
Dim oParam As Parameters
Set oParam = rootPart.Parameters
' MsgBox oParam.Count
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
Dim xPoint As Length
Set xPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\X")
Dim yPoint As Length
Set yPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\Y")
Dim zPoint As Length
Set zPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\Z")
Dim oCollection As Collection
Set oCollection = New Collection
oSel.Search ("Name = 'X', all")
MsgBox oSel.Count
oCollection.Add oSel
Dim oExcel As Object
Dim oWorkbook As Workbook
Dim oSheet As Sheets
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set oWorkbook = oExcel.workBooks.Add
Set oSheet = oWorkbook.Sheets
oSheet.Item(1).Name = "Points"
End Sub
i dont know how to loop and print the value of x parameter to excel cells
please help me this is very impotent
Thanks.
i want to export X,Y & Z values of points to excel spreadsheet
i have created a macro where i can select X parameter but i am trying to export it to excel first column or any column, all the x values in one column
y & z
here is the macro
Option Explicit
Sub CATpoints()
Dim oDoc As Document
Set oDoc = CATIA.ActiveDocument
Dim rootPart As Part
Set rootPart = CATIA.ActiveDocument.Part
Dim partDoc As PartDocument
Set partDoc = CATIA.ActiveDocument
Dim oBodies As bodies
Set oBodies = rootPart.bodies
Dim oBody As Body
Set oBody = oBodies.Item(1)
Dim hyBShape As HybridShapes
Set hyBShape = oBody.HybridShapes
Dim oParam As Parameters
Set oParam = rootPart.Parameters
' MsgBox oParam.Count
Dim oSel As Selection
Set oSel = CATIA.ActiveDocument.Selection
Dim xPoint As Length
Set xPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\X")
Dim yPoint As Length
Set yPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\Y")
Dim zPoint As Length
Set zPoint = oParam.Item("Part3\Geometrical Set.1\Point.1\Z")
Dim oCollection As Collection
Set oCollection = New Collection
oSel.Search ("Name = 'X', all")
MsgBox oSel.Count
oCollection.Add oSel
Dim oExcel As Object
Dim oWorkbook As Workbook
Dim oSheet As Sheets
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set oWorkbook = oExcel.workBooks.Add
Set oSheet = oWorkbook.Sheets
oSheet.Item(1).Name = "Points"
End Sub
i dont know how to loop and print the value of x parameter to excel cells
please help me this is very impotent
Thanks.