I'm going to guess that you should move this block of code to be outside your loop, ie. before the Do While objSR.Peek <> -1
. In the loop it will do all these things for each line in your file. I would think you would only want to do this stuff once.
'connect to a Solid Edge file.
' Connect to a running instance of Solid Edge
objApp = Marshal.GetActiveObject("SolidEdge.Application")
' Get a reference to the documents collection
objDocuments = objApp.Documents
' Create a new part document
objPart = objDocuments.Add("SolidEdge.PartDocument")
' Get a reference to the profile sets collection
objProfileSets = objPart.ProfileSets
' Add a new profile set
objProfileSet = objProfileSets.Add()
' Get a reference to the profiles collection
objProfiles = objProfileSet.Profiles
' Get a reference to the ref planes collection
objRefplanes = objPart.RefPlanes
'open a new sketch
objsketch = objPart.Sketches.Add
' Add a new profile
objProfile = objProfiles.Add(objRefplanes.Item(3))
'Gat a reference to spline curve collection
objBSplines = objProfile.BSplineCurves2d
' Get a reference to the lines2d collection
objLines2d = objProfile.Lines2d
Then you would probably have to move this to after your loop,
' Close the profile
objProfile.End( _
SolidEdgePart.ProfileValidationType.igProfileClosed)
Just a tip, you should remove this line
Catch ex As Exception
If you have an empty catch
block, you will just hide any errors from yourself.