Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
TableData Reading First Element as String
anthony_pisano
Member Posts: 1 EDU
I'm writing a feature to read in a CSV of airfoil data points and plot them on a plane. When reading my CSV the import appears to be formatting the first element of the file as a sting. I have looked at the file, it's not formatted that way in excel or .txt editors. It seems to be local to this. Generically my code is:
annotation { "Name" : "Airfoil points" }<br> definition.AFfile is TableData;
debug(context, definition.AFfile, DebugColor.RED);<br>const points = mapArray(definition.AFfile.csvData, function(row) {<br> // map CSV columns 0, 1 to a vector of X, Y<br> return vector(row[0], row[1]);<br> });<br> debug(context, points, DebugColor.RED);Both debug points show the element being a string. I cannot figure out why!
I apologize for the formatting of the code snippet. I also can't seem to change that using the formatting choice so here it is again as basic text.
annotation { "Name" : "Airfoil points" }
definition.AFfile is TableData;
definition.AFfile is TableData;
debug(context, definition.AFfile, DebugColor.RED);
const points = mapArray(definition.AFfile.csvData, function(row) {// map CSV columns 0, 1 to a vector of X, Y
return vector(row[0], row[1]);
});
debug(context, points, DebugColor.RED);
Tagged:
0