diff --git a/src/ifcgeom/mapping/IfcCircle.cpp b/src/ifcgeom/mapping/IfcCircle.cpp index 6693cd18ca..82a822e34c 100644 --- a/src/ifcgeom/mapping/IfcCircle.cpp +++ b/src/ifcgeom/mapping/IfcCircle.cpp @@ -34,5 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle* inst) { auto c = taxonomy::make(); c->radius = r; c->matrix = taxonomy::cast(map(placement)); - return c; + + auto e = taxonomy::make(); + e->basis = c; + e->start = 0.; + e->end = 2 * boost::math::constants::pi(); + + return e; } diff --git a/src/ifcgeom/mapping/IfcEllipse.cpp b/src/ifcgeom/mapping/IfcEllipse.cpp index 1d1e70e303..dfde1c2128 100644 --- a/src/ifcgeom/mapping/IfcEllipse.cpp +++ b/src/ifcgeom/mapping/IfcEllipse.cpp @@ -51,5 +51,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse* inst) { el->radius = x; el->radius2 = y; - return el; + auto e = taxonomy::make(); + e->basis = el; + e->start = 0.; + e->end = 2 * boost::math::constants::pi(); + + return e; } diff --git a/src/ifcopenshell-python/test/geom/geometry_tests.py b/src/ifcopenshell-python/test/geom/geometry_tests.py new file mode 100644 index 0000000000..1ecfa35b4b --- /dev/null +++ b/src/ifcopenshell-python/test/geom/geometry_tests.py @@ -0,0 +1,42 @@ +# IfcOpenShell - IFC toolkit and geometry engine +# Copyright (C) 2021 Dion Moult +# +# 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 . + +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