This is a code that takes from
https://modthemachine.typepad.com/my_weblog/2011/06/writing-work-points-to-an-excel-file.html
modified a bit, with only add the lines marked in red, jump to the point of work that is hidden.
Public Sub ExportWorkPoints()
' Get the active part document.
Dim partDoc As PartDocument
If ThisApplication.ActiveDocumentType = kPartDocumentObject Then
Set partDoc = ThisApplication.ActiveDocument
Else
MsgBox "A part must be active."
Exit Sub
End If
Dim partDef As PartComponentDefinition
Set partDef = partDoc.ComponentDefinition
' Get the filename to write to.
Dim dialog As FileDialog
Dim filename As String
Call ThisApplication.CreateFileDialog(dialog)
With dialog
.DialogTitle = "Specify Output .CSV File"
.Filter = "Comma delimited file (*.csv)|*.csv"
.FilterIndex = 0
.OptionsEnabled = False
.MultiSelectEnabled = False
.ShowSave
filename = .filename
End With
If filename <> "" Then
' Write the work point coordinates out to a csv file.
On Error Resume Next
Open filename For Output As #1
If Err.Number <> 0 Then
MsgBox "Unable to open the specified file. " & _
"It may be open by another process."
Exit Sub
End If
' Get a reference to the object to do unit conversions.
Dim uom As UnitsOfMeasure
Set uom = partDoc.UnitsOfMeasure
' Write the points
Dim i As Integer
For i = 1 To partDef.WorkPoints.Count
If partDef.WorkPoints.Item(i).Visible = True Then
Dim xCoord As Double
xCoord = uom.ConvertUnits(partDef.WorkPoints.Item(i).Point.X, _
kCentimeterLengthUnits, kDefaultDisplayLengthUnits)
Dim yCoord As String
yCoord = uom.ConvertUnits(partDef.WorkPoints.Item(i).Point.Y, _
kCentimeterLengthUnits, kDefaultDisplayLengthUnits)
Dim zCoord As String
zCoord = uom.ConvertUnits(partDef.WorkPoints.Item(i).Point.Z, _
kCentimeterLengthUnits, kDefaultDisplayLengthUnits)
Print #1, partDef.WorkPoints.Item(i).Name & "," & _
Format(xCoord, "0.00000000") & "," & _
Format(yCoord, "0.00000000") & "," & _
Format(zCoord, "0.00000000")
End If
Next
Close #1
MsgBox "Finished writing data to """ & filename & """"
End If
End Sub
I hope it will help you to give a path so that you can solve your problem. regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn