mirror of https://github.com/vitalif/openscad
fixup issue 593
parent
d9432d76e7
commit
b3a946bd92
|
@ -175,7 +175,7 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
in_blocks_section = iddata == "BLOCKS";
|
in_blocks_section = iddata == "BLOCKS";
|
||||||
}
|
}
|
||||||
else if (mode == "LINE") {
|
else if (mode == "LINE") {
|
||||||
ADD_LINE(xverts[0], yverts[0], xverts[1], yverts[1]);
|
ADD_LINE(xverts.at(0), yverts.at(0), xverts.at(1), yverts.at(1));
|
||||||
}
|
}
|
||||||
else if (mode == "LWPOLYLINE") {
|
else if (mode == "LWPOLYLINE") {
|
||||||
assert(xverts.size() == yverts.size());
|
assert(xverts.size() == yverts.size());
|
||||||
|
@ -185,12 +185,12 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
ADD_LINE(xverts[i-1], yverts[i-1], xverts[i%numverts], yverts[i%numverts]);
|
ADD_LINE(xverts[i-1], yverts[i-1], xverts[i%numverts], yverts[i%numverts]);
|
||||||
}
|
}
|
||||||
if (dimtype & 0x01) { // closed polyline
|
if (dimtype & 0x01) { // closed polyline
|
||||||
ADD_LINE(xverts[numverts-1], yverts[numverts-1], xverts[0], yverts[0]);
|
ADD_LINE(xverts.at(numverts-1), yverts.at(numverts-1), xverts.at(0), yverts.at(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == "CIRCLE") {
|
else if (mode == "CIRCLE") {
|
||||||
int n = Calc::get_fragments_from_r(radius, fn, fs, fa);
|
int n = Calc::get_fragments_from_r(radius, fn, fs, fa);
|
||||||
Vector2d center(xverts[0], yverts[0]);
|
Vector2d center(xverts.at(0), yverts.at(0));
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
double a1 = (2*M_PI*i)/n;
|
double a1 = (2*M_PI*i)/n;
|
||||||
double a2 = (2*M_PI*(i+1))/n;
|
double a2 = (2*M_PI*(i+1))/n;
|
||||||
|
@ -199,7 +199,7 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == "ARC") {
|
else if (mode == "ARC") {
|
||||||
Vector2d center(xverts[0], yverts[0]);
|
Vector2d center(xverts.at(0), yverts.at(0));
|
||||||
int n = Calc::get_fragments_from_r(radius, fn, fs, fa);
|
int n = Calc::get_fragments_from_r(radius, fn, fs, fa);
|
||||||
while (arc_start_angle > arc_stop_angle)
|
while (arc_start_angle > arc_stop_angle)
|
||||||
arc_stop_angle += 360.0;
|
arc_stop_angle += 360.0;
|
||||||
|
@ -217,9 +217,9 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
// Commented code is meant as documentation of vector math
|
// Commented code is meant as documentation of vector math
|
||||||
while (ellipse_start_angle > ellipse_stop_angle) ellipse_stop_angle += 2 * M_PI;
|
while (ellipse_start_angle > ellipse_stop_angle) ellipse_stop_angle += 2 * M_PI;
|
||||||
// Vector2d center(xverts[0], yverts[0]);
|
// Vector2d center(xverts[0], yverts[0]);
|
||||||
Vector2d center(xverts[0], yverts[0]);
|
Vector2d center(xverts.at(0), yverts.at(0));
|
||||||
// Vector2d ce(xverts[1], yverts[1]);
|
// Vector2d ce(xverts[1], yverts[1]);
|
||||||
Vector2d ce(xverts[1], yverts[1]);
|
Vector2d ce(xverts.at(1), yverts.at(1));
|
||||||
// double r_major = ce.length();
|
// double r_major = ce.length();
|
||||||
double r_major = sqrt(ce[0]*ce[0] + ce[1]*ce[1]);
|
double r_major = sqrt(ce[0]*ce[0] + ce[1]*ce[1]);
|
||||||
// double rot_angle = ce.angle();
|
// double rot_angle = ce.angle();
|
||||||
|
@ -270,10 +270,10 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
double ly1 = this->points[blockdata[iddata][i].idx[0]][1] * ellipse_stop_angle;
|
double ly1 = this->points[blockdata[iddata][i].idx[0]][1] * ellipse_stop_angle;
|
||||||
double lx2 = this->points[blockdata[iddata][i].idx[1]][0] * ellipse_start_angle;
|
double lx2 = this->points[blockdata[iddata][i].idx[1]][0] * ellipse_start_angle;
|
||||||
double ly2 = this->points[blockdata[iddata][i].idx[1]][1] * ellipse_stop_angle;
|
double ly2 = this->points[blockdata[iddata][i].idx[1]][1] * ellipse_stop_angle;
|
||||||
double px1 = (cos(a)*lx1 - sin(a)*ly1) * scale + xverts[0];
|
double px1 = (cos(a)*lx1 - sin(a)*ly1) * scale + xverts.at(0);
|
||||||
double py1 = (sin(a)*lx1 + cos(a)*ly1) * scale + yverts[0];
|
double py1 = (sin(a)*lx1 + cos(a)*ly1) * scale + yverts.at(0);
|
||||||
double px2 = (cos(a)*lx2 - sin(a)*ly2) * scale + xverts[0];
|
double px2 = (cos(a)*lx2 - sin(a)*ly2) * scale + xverts.at(0);
|
||||||
double py2 = (sin(a)*lx2 + cos(a)*ly2) * scale + yverts[0];
|
double py2 = (sin(a)*lx2 + cos(a)*ly2) * scale + yverts.at(0);
|
||||||
ADD_LINE(px1, py1, px2, py2);
|
ADD_LINE(px1, py1, px2, py2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,6 +385,9 @@ DxfData::DxfData(double fn, double fs, double fa,
|
||||||
catch (boost::bad_lexical_cast &blc) {
|
catch (boost::bad_lexical_cast &blc) {
|
||||||
PRINTB("WARNING: Illegal value %s in '%s'", data % filename);
|
PRINTB("WARNING: Illegal value %s in '%s'", data % filename);
|
||||||
}
|
}
|
||||||
|
catch (const std::out_of_range& oor) {
|
||||||
|
PRINTB("WARNING: not enough input values for %s in '%s'", data % filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const EntityList::value_type &i, unsupported_entities_list) {
|
BOOST_FOREACH(const EntityList::value_type &i, unsupported_entities_list) {
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
999
|
||||||
|
This tests should not crash but produce no visible result, see former issue 593.
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
HEADER
|
||||||
|
9
|
||||||
|
$EXTMIN
|
||||||
|
10
|
||||||
|
-6,63671875
|
||||||
|
20
|
||||||
|
-0,0244140625
|
||||||
|
30
|
||||||
|
0,5
|
||||||
|
9
|
||||||
|
$EXTMAX
|
||||||
|
10
|
||||||
|
7,1357421875
|
||||||
|
20
|
||||||
|
0,921875
|
||||||
|
30
|
||||||
|
0,5
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
TABLES
|
||||||
|
0
|
||||||
|
TABLE
|
||||||
|
2
|
||||||
|
VPORT
|
||||||
|
0
|
||||||
|
VPORT
|
||||||
|
2
|
||||||
|
*ACTIVE
|
||||||
|
41
|
||||||
|
1.000000
|
||||||
|
0
|
||||||
|
ENDTAB
|
||||||
|
0
|
||||||
|
TABLE
|
||||||
|
2
|
||||||
|
LAYER
|
||||||
|
0
|
||||||
|
LAYER
|
||||||
|
2
|
||||||
|
0
|
||||||
|
62
|
||||||
|
0
|
||||||
|
0
|
||||||
|
ENDTAB
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
BLOCKS
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
ENTITIES
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
62
|
||||||
|
0
|
||||||
|
10
|
||||||
|
0,1
|
||||||
|
20
|
||||||
|
0,1
|
||||||
|
30
|
||||||
|
0
|
||||||
|
11
|
||||||
|
2,5
|
||||||
|
21
|
||||||
|
0
|
||||||
|
31
|
||||||
|
0
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
62
|
||||||
|
0
|
||||||
|
10
|
||||||
|
2,5
|
||||||
|
20
|
||||||
|
0
|
||||||
|
30
|
||||||
|
0
|
||||||
|
11
|
||||||
|
2,5
|
||||||
|
21
|
||||||
|
2,5
|
||||||
|
31
|
||||||
|
0
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
62
|
||||||
|
0
|
||||||
|
10
|
||||||
|
2,5
|
||||||
|
20
|
||||||
|
2,5
|
||||||
|
30
|
||||||
|
0
|
||||||
|
11
|
||||||
|
0
|
||||||
|
21
|
||||||
|
2,5
|
||||||
|
31
|
||||||
|
0
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
62
|
||||||
|
0
|
||||||
|
10
|
||||||
|
0
|
||||||
|
20
|
||||||
|
2,5
|
||||||
|
30
|
||||||
|
0
|
||||||
|
11
|
||||||
|
0,1
|
||||||
|
21
|
||||||
|
0,1
|
||||||
|
31
|
||||||
|
0
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
EOF
|
|
@ -0,0 +1,2 @@
|
||||||
|
// This tests should not crash but produce no visible result, see former issue 593.
|
||||||
|
import("../../nothing-decimal-comma-separated.dxf");
|
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue