Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: WCrihfield

Weird.  I took the code from your latest post, pasted it into the iLogic rule editor window, made exactly two edits to the code (replaced the line identifying the Excel file to fit my circumstances, and replaced the last line of your For/Next loop to add the oPoint object to the oSkPoints collection, instead of oSkPt3d, and Voila, it worked.  The modified code is below.  I'll attach both the Excel file I used and the part file, which started out as a blank (mm) part file.

 

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
'Dim oXLFile As String = "S:\Engineering\SHARED\Tests\Points To Import.xlsx"
Dim oXLFile As String = "S:\Test\XYZ_Points_to_Import.xlsx"
Dim oSheet As String = "Sheet1"
GoExcel.Open(oXLFile, oSheet)
GoExcel.DisplayAlerts = False
GoExcel.TitleRow = 2
GoExcel.FindRowStart = 3
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oCoords(2) As Double
Dim oPoint As Point
Dim oSkPt3d As SketchPoint3D
Dim oPoints As ObjectCollection = oTO.CreateObjectCollection
Dim oSkPoints As ObjectCollection = oTO.CreateObjectCollection
Dim oSketch3d As Sketch3D = oPDef.Sketches3D.Add()
For i As Integer = 3 To 10
	oCoords(0) = GoExcel.CellValue("A" & i)
	oCoords(1) = GoExcel.CellValue("B" & i)
	oCoords(2) = GoExcel.CellValue("C" & i)
	oPoint = oTG.CreatePoint(oCoords(0), oCoords(1), oCoords(2))
	oPoints.Add(oPoint)
	oSkPt3d = oSketch3d.SketchPoints3D.Add(oPoint, True)
	'oSkPoints.Add(oSkPt3d)
	oSkPoints.Add(oPoint)
Next
System.Threading.Thread.Sleep(1000)
Dim oSpline As SketchSpline3D = oSketch3d.SketchSplines3D.Add(oPoints,SplineFitMethodEnum.kSmoothSplineFit)
'Dim oSpline As SketchControlPointSpline3D = oSketch3d.SketchControlPointSplines3D.Add(oPoints)