Ported binary STL file reader away from Qt

felipesanches-svg
Marius Kintel 2011-12-23 22:01:19 +01:00
parent 195137324a
commit dc4bc15925
6 changed files with 17 additions and 10 deletions

View File

@ -115,7 +115,7 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati
return node;
}
PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *evaluator) const
PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
{
PolySet *p = NULL;
@ -188,8 +188,8 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *evaluator) const
}
else
{
/*
f.read(80-5+4);
f.ignore(80-5+4);
int total = 84;
while (1) {
#ifdef _MSC_VER
#pragma pack(push,1)
@ -204,19 +204,18 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *evaluator) const
#ifdef __GNUC__
__attribute__ ((packed))
#endif
data;
stldata;
#ifdef _MSC_VER
#pragma pack(pop)
#endif
if (f.read((char*)&data, sizeof(data)) != sizeof(data))
break;
f.read((char*)&stldata, sizeof(stldata));
if (f.eof()) break;
p->append_poly();
p->append_vertex(data.x1, data.y1, data.z1);
p->append_vertex(data.x2, data.y2, data.z2);
p->append_vertex(data.x3, data.y3, data.z3);
p->append_vertex(stldata.x1, stldata.y1, stldata.z1);
p->append_vertex(stldata.x2, stldata.y2, stldata.z2);
p->append_vertex(stldata.x3, stldata.y3, stldata.z3);
}
*/
}
}

View File

@ -1 +1,3 @@
import_stl("import.stl");
translate([2,0,0]) import("import.stl");
translate([4,0,0]) import("import_bin.stl");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,2 +1,8 @@
import(file = "import.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
import(file = "import.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
}
multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
import(file = "import_bin.stl", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB