Hello Every One
I have created this macro to export values of X,Y & Z co ordinate value of points
i can print the X,Y & Z value as message
But i want to print the value of x y & z co ordinate value of all the points to excel sheet
its only printing X value of the last point how, do i print x value of all points
i cant use GetCoordinates or selectElement2,3 methods becoz they wont work vba environment
here is the VBSCRIPT
Option Explicit
Sub PointMain()
Dim myDoc As Document
Set myDoc = CATIA.ActiveDocument
On Error Resume Next
Dim myPart As Part
Set myPart = CATIA.ActiveDocument.Part
Dim partDoc As PartDocument
Set partDoc = CATIA.ActiveDocument
Dim hybBds As HybridBodies
Set hybBds = myPart.HybridBodies
Dim bodies As bodies
Set bodies = myPart.bodies
Dim hybBd As HybridBody
Set hybBd = hybBds.Item(1)
Dim body As body
Set body = bodies.Item(1)
MsgBox hybBd.Name & vbNewLine & body.Name, vbOKOnly, "Message"
Dim hybShapefact As HybridShapeFactory
Set hybShapefact = myPart.HybridShapeFactory
Dim hybShape As HybridShapes
Set hybShape = hybBd.HybridShapes
Dim hybPoint As HybridShapePointCoord
Dim i As Integer
For i = 1 To hybShape.Count
Set hybPoint = hybShape.Item(i)
MsgBox hybPoint.X.Value
Next
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
Dim xlbook As Workbook
Set xlbook = xlApp.Workbooks.Add
xlApp.Visible = True
Dim xlWorksSheet As Worksheet
Set xlWorksSheet = xlbook.Sheets.Item("Sheet1")
Dim j As Integer
For j = 1 To hybShape.Count
xlWorksSheet.Cells(j, 1).Value = hybPoint.X.Value
Next
End Sub
Here is the catpart files
I have created this macro to export values of X,Y & Z co ordinate value of points
i can print the X,Y & Z value as message
But i want to print the value of x y & z co ordinate value of all the points to excel sheet
its only printing X value of the last point how, do i print x value of all points
i cant use GetCoordinates or selectElement2,3 methods becoz they wont work vba environment
here is the VBSCRIPT
Option Explicit
Sub PointMain()
Dim myDoc As Document
Set myDoc = CATIA.ActiveDocument
On Error Resume Next
Dim myPart As Part
Set myPart = CATIA.ActiveDocument.Part
Dim partDoc As PartDocument
Set partDoc = CATIA.ActiveDocument
Dim hybBds As HybridBodies
Set hybBds = myPart.HybridBodies
Dim bodies As bodies
Set bodies = myPart.bodies
Dim hybBd As HybridBody
Set hybBd = hybBds.Item(1)
Dim body As body
Set body = bodies.Item(1)
MsgBox hybBd.Name & vbNewLine & body.Name, vbOKOnly, "Message"
Dim hybShapefact As HybridShapeFactory
Set hybShapefact = myPart.HybridShapeFactory
Dim hybShape As HybridShapes
Set hybShape = hybBd.HybridShapes
Dim hybPoint As HybridShapePointCoord
Dim i As Integer
For i = 1 To hybShape.Count
Set hybPoint = hybShape.Item(i)
MsgBox hybPoint.X.Value
Next
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
Dim xlbook As Workbook
Set xlbook = xlApp.Workbooks.Add
xlApp.Visible = True
Dim xlWorksSheet As Worksheet
Set xlWorksSheet = xlbook.Sheets.Item("Sheet1")
Dim j As Integer
For j = 1 To hybShape.Count
xlWorksSheet.Cells(j, 1).Value = hybPoint.X.Value
Next
End Sub
Here is the catpart files