The other day I got one of those questions. "I got a question, Bob. Can you take the points from a spline and save them out to a text file?" I was good up to the save them out to a text file. My brain threw the parking brake, "Ok say that again". You should always ask someone to repeat themselves when you think they are asking a stupid question. “So the real question was, “The user needs to get captured points along a curve or line into excel for a project.”
So we started to work on the issue. First off, there isn’t a save selected points to excel. This is going to need a work around. What formats can I save out of SOLIDWORKS and can I read them in a tool like notepad or notepad++ easily. Take a look.
After saying out each one of these file formats, the one I thought of first was the best answer, IGES. IGES development began in late 1979 due to an increasing need to share data between CAD systems. While the IGES format is not the most powerful method for transferring CAD data, it is very common because it was one of the first detailed systems. This format was designed to be very open, and the data can be read in any text reader program. To learn more about the IGES format you can look at the Wiki page about it.
Armed with this information I went add saved my part as IGES file. But the spline points didn’t show up in the IGES file the way I expected. In the IGES format the designation of 116 at the beginning of a line is a point. But I was looking for a line that had an X,Y,&Z values, but I was getting more than that. Going back to the model I created a new sketch and added points on top of the points of the spline on the original sketch. I resaved the IGES file and got much better results, which I copied to my clip board.
Now let’s get it into Excel. I pasted the data from the clip board onto a new text document. Excel can import a text file as a delimited file, where commas and colons with separate the data into cells. So there you go.
Bob McGaughey, CSWE