Hello!
I am
designing 3D KiCAD PCB parts using OpenSCAD and Wings3D
When I import an OpenSCAD STL file in Wings3D, the program always crashes,
after repairing the file using
meshconv, the STL file no longer crashes Wings3D.
Meshconv only changed the normal and vertex locations to floating point values...
The
STL file format specifies:
Quote
The numerical data in the facet normal and vertex lines are single precision floats, for example, 1.23456E+789.
Currently the STL file contains only integers when testing with a cube(10);
I made the following changes in /src/export_stl.cc:
std::string toString(const Vector3d &v)
- return OSS(v[0] << " " << v[1] << " " << v[2]);
+ return OSS(std::scientific << v[0] << " " << v[1] << " " << v[2]);
void append_stl(const PolySet &ps, std:: ostream &output)
if (is_finite(normal) && !is_nan(normal)) {
- output << normal[0] << " " << normal[1] << " " << normal[2] << "\n";
+ output << std::scientific << normal[0] << " " << normal[1] << " " << normal[2] << "\n";
}
else {
- output << "0 0 0\n";
+ output << "0.000000e+00 0.000000e+00 0.000000e+00\n";
}
After these changes Wings3D accepts (my very simple) OpenSCAD STL files.
Should the code be changed (this way or another) or is there a reason things are this way?
RS-Online Ormerod #263, Kossel mini with Minitronics, Prusa i3 MK2