Fixed #1173 (DXF reader compatibility issue with ezdxf) (#1174)

This commit is contained in:
Matthias Köfferlein 2022-11-01 14:28:51 +01:00 committed by GitHub
parent 8da373e9ad
commit c021a1834c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2907 additions and 7 deletions

View File

@ -1732,7 +1732,7 @@ DXFReader::read_entities (db::Layout &layout, db::Cell &cell, const db::DVector
std::vector<double> knots;
std::vector<std::pair<db::DPoint, double> > control_points;
db::DPoint pc;
std::vector<double> weights;
double ex = 0.0, ey = 0.0, ez = 1.0;
std::string layer;
@ -1771,12 +1771,7 @@ DXFReader::read_entities (db::Layout &layout, db::Cell &cell, const db::DVector
} else if (g == 40) {
knots.push_back (read_double ());
} else if (g == 41) {
// weight of the control point
if (! control_points.empty ()) {
control_points.back ().second = read_double ();
}
weights.push_back (read_double ());
} else if (g == 210) {
ex = read_double ();
} else if (g == 220) {
@ -1788,6 +1783,10 @@ DXFReader::read_entities (db::Layout &layout, db::Cell &cell, const db::DVector
}
}
for (size_t i = 0; i < weights.size () && i < control_points.size (); ++i) {
control_points [i].second = weights [i];
}
db::DCplxTrans tt = global_trans (offset, ex, ey, ez);
std::pair <bool, unsigned int> ll = open_layer (layout, layer);

View File

@ -506,3 +506,12 @@ TEST(33)
opt.polyline_mode = 2;
run_test (_this, "t33.dxf.gz", "t33e_au.gds.gz", opt);
}
// issue #1173
TEST(34)
{
db::DXFReaderOptions opt;
opt.polyline_mode = 3;
run_test_public (_this, "issue_1173.dxf", "issue_1173_au.gds.gz", opt);
}

2892
testdata/dxf/issue_1173.dxf vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
testdata/dxf/issue_1173_au.gds.gz vendored Normal file

Binary file not shown.