mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Fix error processing IfcCircle/IfcEllipse #5352
This commit is contained in:
@@ -34,5 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle* inst) {
|
|||||||
auto c = taxonomy::make<taxonomy::circle>();
|
auto c = taxonomy::make<taxonomy::circle>();
|
||||||
c->radius = r;
|
c->radius = r;
|
||||||
c->matrix = taxonomy::cast<taxonomy::matrix4>(map(placement));
|
c->matrix = taxonomy::cast<taxonomy::matrix4>(map(placement));
|
||||||
return c;
|
|
||||||
|
auto e = taxonomy::make<taxonomy::edge>();
|
||||||
|
e->basis = c;
|
||||||
|
e->start = 0.;
|
||||||
|
e->end = 2 * boost::math::constants::pi<double>();
|
||||||
|
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse* inst) {
|
|||||||
el->radius = x;
|
el->radius = x;
|
||||||
el->radius2 = y;
|
el->radius2 = y;
|
||||||
|
|
||||||
return el;
|
auto e = taxonomy::make<taxonomy::edge>();
|
||||||
|
e->basis = el;
|
||||||
|
e->start = 0.;
|
||||||
|
e->end = 2 * boost::math::constants::pi<double>();
|
||||||
|
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# IfcOpenShell - IFC toolkit and geometry engine
|
||||||
|
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of IfcOpenShell.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# IfcOpenShell is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import ifcopenshell
|
||||||
|
import ifcopenshell.geom
|
||||||
|
import test.bootstrap
|
||||||
|
from ifcopenshell.util.shape_builder import ShapeBuilder, V
|
||||||
|
|
||||||
|
|
||||||
|
class TestCreatingShapes(test.bootstrap.IFC4):
|
||||||
|
def test_create_IfcCirle(self):
|
||||||
|
builder = ShapeBuilder(self.file)
|
||||||
|
item = builder.circle(radius=1.0)
|
||||||
|
settings = ifcopenshell.geom.settings()
|
||||||
|
shape = ifcopenshell.geom.create_shape(settings, item)
|
||||||
|
assert shape.verts
|
||||||
|
|
||||||
|
def test_create_IfcEllipse(self):
|
||||||
|
ifc_position = self.file.create_entity(
|
||||||
|
"IfcAxis2Placement2D",
|
||||||
|
self.file.create_entity("IfcCartesianPoint", V(0, 0)),
|
||||||
|
RefDirection=self.file.create_entity("IfcDirection", V(1, 0)),
|
||||||
|
)
|
||||||
|
item = self.file.create_entity("IfcEllipse", Position=ifc_position, SemiAxis1=1.0, SemiAxis2=0.5)
|
||||||
|
settings = ifcopenshell.geom.settings()
|
||||||
|
shape = ifcopenshell.geom.create_shape(settings, item)
|
||||||
|
assert shape.verts
|
||||||
Reference in New Issue
Block a user