Hello,
I have many text files, each containing XYZ points. I need help creating a script that imports each text file as a 3D sketch with lines connecting the points.
I was able to use the code from this thread to import the points as curves, but based on the way I need to generate lofted surfaces, I need to import each text file as a 3D sketch. I was able to find this thread, with code that lets you convert cell values from Excel to a 3D sketch, but I need to be able to do this without going through Excel and instead, with a text file.
If not, would anyone know how to convert every imported curve into individual 3D sketches (one for each curve?) I would prefer not to do it this way as it means another step to get the sketches.
Thanks in advance for the help!
You can read text files or excel files. It's just a matter of whether you are reading one by or orlooping through everything in a folder. Google is your friend on this one. There are many examples. I believe you will need to reference Microsoft Scripting Runtime in your project. Below is just a single text file example, but you could write a loop to cycle through all text files in a folder.
Dim strFilename As String: strFilename = "C:\temp\yourfile.txt"
Dim strFileContent As String
Dim iFile As Integer: iFile = FreeFile
Open strFilename For Input As #iFile
strFileContent = Input(LOF(iFile), iFile)
'do SW work here.
Close #iFile