' Set a reference to the part component definition. ' This assumes that a part document is active. Dim oCompDef As PartComponentDefinition oCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Set a reference to the transient geometry collection. Dim oTransGeom As TransientGeometry oTransGeom = ThisApplication.TransientGeometry ' Create the collection that will contain the fit points for the regular spline. Dim oFitPoints As ObjectCollection oFitPoints = ThisApplication.TransientObjects.CreateObjectCollection '[Open dialog box 'Load points from Excel Dim oFileDlg As Inventor.FileDialog = Nothing InventorVb.Application.CreateFileDialog(oFileDlg) Dim Lista() As String oFileDlg.Filter = "Excel Files (*.xls;*.xlsx)|*.xls;*.xlsx|All Files (*.*)|*.*" oFileDlg.InitialDirectory = ThisDoc.Path oFileDlg.CancelError = True On Error Resume Next oFileDlg.MultiSelectEnabled=True oFileDlg.ShowOpen() If Err.Number <> 0 Then MessageBox.Show("File not chosen.", "Dialog Cancellation") ElseIf oFileDlg.FileName <> "" Then Lista = oFileDlg.FileName.Split("|") End If '] '[Genereate splines from xls For Each ExFile In Lista GoExcel.Open(ExFile, "Arcs") i = 1 'Read excel rows until empty cell Do Until String.IsNullOrEmpty(GoExcel.CellValue("A" & i)) x = GoExcel.CellValue("A"& i) y = GoExcel.CellValue("B" & i) z = GoExcel.CellValue("C" & i) Call oFitPoints.Add(oTransGeom.CreatePoint(x, y, z)) i=i+1 Loop oSketch3d = oCompDef.Sketches3D.Add oSketch3d.SketchSplines3D.Add(oFitPoints) oFitPoints.Clear GoExcel.Close Next ']