mirror of https://github.com/vitalif/openscad
Be compatible with existing behavior: close open paths in DXF files
parent
bc4fae0d85
commit
db7da052a3
|
@ -589,9 +589,11 @@ Polygon2d *DxfData::toPolygon2d() const
|
||||||
Polygon2d *poly = new Polygon2d();
|
Polygon2d *poly = new Polygon2d();
|
||||||
for (size_t i = 0; i < this->paths.size(); i++) {
|
for (size_t i = 0; i < this->paths.size(); i++) {
|
||||||
const DxfData::Path &path = this->paths[i];
|
const DxfData::Path &path = this->paths[i];
|
||||||
if (!path.is_closed) continue; // We don't support open paths for now
|
|
||||||
Outline2d outline;
|
Outline2d outline;
|
||||||
for (size_t j = 1; j < path.indices.size(); j++) {
|
size_t endidx = path.indices.size();
|
||||||
|
// We don't support open paths; closing them to be compatible with existing behavior
|
||||||
|
if (!path.is_closed) endidx++;
|
||||||
|
for (size_t j = 1; j < endidx; j++) {
|
||||||
outline.vertices.push_back(Vector2d(this->points[path.indices[path.indices.size()-j]]));
|
outline.vertices.push_back(Vector2d(this->points[path.indices[path.indices.size()-j]]));
|
||||||
}
|
}
|
||||||
poly->addOutline(outline);
|
poly->addOutline(outline);
|
||||||
|
|
Loading…
Reference in New Issue