I was hoping someone could help me finish this script. I can't get it to limit the out put to only a 4 place decimal
thanks in advance
I'm trying to make a script to output points to a txt file, I would like to have it output x,y,z locations to a 4 place decimal can someone look at this and help me with a solution??
Thanks in advance
Language = "VBSCRIPT"
Sub CATMain()
Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Set fs = CreateObject("Scripting.FileSystemObject"
Set A = fs.CreateTextFile("c:\temp\ponits.txt", True)
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Points"
Dim hybridShapes1 As hybridShapes
Set hybridShapes1 = hybridBody1.hybridShapes
Dim Number
Number = hybridBody1.hybridShapes.Count
'MsgBox (Number)
For i = 1 To Number
Dim hybridShapePointCoord1 As HybridShape
Set hybridShapePointCoord1 = hybridShapes1.Item(i)
Dim length2 As Length
Set length2 = hybridShapePointCoord1.X
Set length2 = hybridShapePointCoord1.Y
Set length2 = hybridShapePointCoord1.Z
xCoord = (hybridShapePointCoord1.X.Value / 25.4)
yCoord = (hybridShapePointCoord1.Y.Value / 25.4)
zCoord = (hybridShapePointCoord1.Z.Value / 25.4)
A.WriteLine (xCoord & ", " & yCoord & ", " & zCoord)
Next
'part1.Update
A.Close
MsgBox "File Writen"
End Sub
thanks in advance
I'm trying to make a script to output points to a txt file, I would like to have it output x,y,z locations to a 4 place decimal can someone look at this and help me with a solution??
Thanks in advance
Language = "VBSCRIPT"
Sub CATMain()
Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Set fs = CreateObject("Scripting.FileSystemObject"
Set A = fs.CreateTextFile("c:\temp\ponits.txt", True)
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Points"
Dim hybridShapes1 As hybridShapes
Set hybridShapes1 = hybridBody1.hybridShapes
Dim Number
Number = hybridBody1.hybridShapes.Count
'MsgBox (Number)
For i = 1 To Number
Dim hybridShapePointCoord1 As HybridShape
Set hybridShapePointCoord1 = hybridShapes1.Item(i)
Dim length2 As Length
Set length2 = hybridShapePointCoord1.X
Set length2 = hybridShapePointCoord1.Y
Set length2 = hybridShapePointCoord1.Z
xCoord = (hybridShapePointCoord1.X.Value / 25.4)
yCoord = (hybridShapePointCoord1.Y.Value / 25.4)
zCoord = (hybridShapePointCoord1.Z.Value / 25.4)
A.WriteLine (xCoord & ", " & yCoord & ", " & zCoord)
Next
'part1.Update
A.Close
MsgBox "File Writen"
End Sub