2012-07-19 18:26:47 +00:00
|
|
|
/********************************************************************************
|
2011-07-25 14:56:40 +00:00
|
|
|
* *
|
|
|
|
|
* This file is part of IfcOpenShell. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3.0 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 *
|
|
|
|
|
* Lesser GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
/********************************************************************************
|
|
|
|
|
* *
|
|
|
|
|
* Implementations of the various conversion functions defined in IfcRegister.h *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <gp_Pnt.hxx>
|
|
|
|
|
#include <gp_Vec.hxx>
|
|
|
|
|
#include <gp_Dir.hxx>
|
|
|
|
|
#include <gp_Pnt2d.hxx>
|
|
|
|
|
#include <gp_Vec2d.hxx>
|
|
|
|
|
#include <gp_Dir2d.hxx>
|
2011-10-23 17:11:06 +00:00
|
|
|
#include <gp_Mat.hxx>
|
|
|
|
|
#include <gp_Mat2d.hxx>
|
|
|
|
|
#include <gp_GTrsf.hxx>
|
|
|
|
|
#include <gp_GTrsf2d.hxx>
|
2011-07-25 14:56:40 +00:00
|
|
|
#include <gp_Trsf.hxx>
|
|
|
|
|
#include <gp_Trsf2d.hxx>
|
|
|
|
|
#include <gp_Ax3.hxx>
|
|
|
|
|
#include <gp_Ax2d.hxx>
|
|
|
|
|
#include <gp_Pln.hxx>
|
|
|
|
|
#include <gp_Circ.hxx>
|
|
|
|
|
|
|
|
|
|
#include <TColgp_Array1OfPnt.hxx>
|
|
|
|
|
#include <TColgp_Array1OfPnt2d.hxx>
|
|
|
|
|
#include <TColStd_Array1OfReal.hxx>
|
|
|
|
|
#include <TColStd_Array1OfInteger.hxx>
|
|
|
|
|
#include <Geom_Line.hxx>
|
|
|
|
|
#include <Geom_Circle.hxx>
|
|
|
|
|
#include <Geom_Ellipse.hxx>
|
|
|
|
|
#include <Geom_TrimmedCurve.hxx>
|
|
|
|
|
|
|
|
|
|
#include <BRepOffsetAPI_Sewing.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeFace.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeWire.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakePolygon.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
|
|
|
|
|
|
|
|
|
#include <TopoDS.hxx>
|
|
|
|
|
#include <TopoDS_Wire.hxx>
|
|
|
|
|
#include <TopoDS_Face.hxx>
|
|
|
|
|
#include <TopExp_Explorer.hxx>
|
|
|
|
|
|
|
|
|
|
#include <BRepPrimAPI_MakePrism.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeShell.hxx>
|
|
|
|
|
#include <BRepBuilderAPI_MakeSolid.hxx>
|
|
|
|
|
#include <BRepPrimAPI_MakeHalfSpace.hxx>
|
|
|
|
|
#include <BRepAlgoAPI_Cut.hxx>
|
|
|
|
|
|
|
|
|
|
#include <ShapeFix_Shape.hxx>
|
|
|
|
|
#include <ShapeFix_ShapeTolerance.hxx>
|
|
|
|
|
#include <ShapeFix_Solid.hxx>
|
|
|
|
|
|
|
|
|
|
#include <TopLoc_Location.hxx>
|
|
|
|
|
|
2012-03-13 11:56:52 +00:00
|
|
|
#include <BRepCheck_Analyzer.hxx>
|
|
|
|
|
#include <BRepAlgoAPI_Common.hxx>
|
|
|
|
|
|
2011-08-24 12:21:07 +00:00
|
|
|
#include "../ifcgeom/IfcGeom.h"
|
2011-07-25 14:56:40 +00:00
|
|
|
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcExtrudedAreaSolid::ptr l, TopoDS_Shape& shape) {
|
2011-07-25 14:56:40 +00:00
|
|
|
TopoDS_Face face;
|
|
|
|
|
if ( ! IfcGeom::convert_face(l->SweptArea(),face) ) return false;
|
2012-08-11 13:24:08 +00:00
|
|
|
const double height = l->Depth() * IfcGeom::GetValue(GV_LENGTH_UNIT);
|
2011-07-25 14:56:40 +00:00
|
|
|
gp_Trsf trsf;
|
|
|
|
|
IfcGeom::convert(l->Position(),trsf);
|
|
|
|
|
|
|
|
|
|
gp_Dir dir;
|
|
|
|
|
convert(l->ExtrudedDirection(),dir);
|
2012-03-13 11:56:52 +00:00
|
|
|
|
2011-07-25 14:56:40 +00:00
|
|
|
shape = BRepPrimAPI_MakePrism(face,height*dir);
|
|
|
|
|
shape.Move(trsf);
|
|
|
|
|
return ! shape.IsNull();
|
|
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcFacetedBrep::ptr l, IfcRepresentationShapeItems& shape) {
|
2011-10-23 17:11:06 +00:00
|
|
|
TopoDS_Shape s;
|
2013-05-05 08:49:25 +00:00
|
|
|
if (IfcGeom::convert_shape(l->Outer(),s) ) {
|
|
|
|
|
shape.push_back(IfcRepresentationShapeItem(s, get_style(l->Outer())));
|
2011-10-23 17:11:06 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcFaceBasedSurfaceModel::ptr l, IfcRepresentationShapeItems& shapes) {
|
2011-07-25 14:56:40 +00:00
|
|
|
Ifc2x3::IfcConnectedFaceSet::list facesets = l->FbsmFaces();
|
2013-05-05 08:49:25 +00:00
|
|
|
const SurfaceStyle* collective_style = get_style(l);
|
2011-07-25 14:56:40 +00:00
|
|
|
for( Ifc2x3::IfcConnectedFaceSet::it it = facesets->begin(); it != facesets->end(); ++ it ) {
|
|
|
|
|
TopoDS_Shape s;
|
2013-05-05 08:49:25 +00:00
|
|
|
const SurfaceStyle* shell_style = get_style(*it);
|
|
|
|
|
if (IfcGeom::convert_shape(*it,s)) {
|
|
|
|
|
shapes.push_back(IfcRepresentationShapeItem(s, shell_style ? shell_style : collective_style));
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcHalfSpaceSolid::ptr l, TopoDS_Shape& shape) {
|
2011-07-25 14:56:40 +00:00
|
|
|
Ifc2x3::IfcSurface::ptr surface = l->BaseSurface();
|
|
|
|
|
if ( ! surface->is(Ifc2x3::Type::IfcPlane) ) {
|
|
|
|
|
// Not implemented
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
gp_Pln pln;
|
|
|
|
|
IfcGeom::convert(reinterpret_pointer_cast<Ifc2x3::IfcSurface,Ifc2x3::IfcPlane>(surface),pln);
|
2012-03-13 11:56:52 +00:00
|
|
|
const gp_Pnt pnt = pln.Location().Translated( l->AgreementFlag() ? -pln.Axis().Direction() : pln.Axis().Direction());
|
2011-07-25 14:56:40 +00:00
|
|
|
shape = BRepPrimAPI_MakeHalfSpace(BRepBuilderAPI_MakeFace(pln),pnt).Solid();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcPolygonalBoundedHalfSpace::ptr l, TopoDS_Shape& shape) {
|
2011-07-25 14:56:40 +00:00
|
|
|
TopoDS_Shape halfspace;
|
|
|
|
|
if ( ! IfcGeom::convert(reinterpret_pointer_cast<Ifc2x3::IfcPolygonalBoundedHalfSpace,Ifc2x3::IfcHalfSpaceSolid>(l),halfspace) ) return false;
|
|
|
|
|
TopoDS_Wire wire;
|
2011-10-12 16:43:29 +00:00
|
|
|
if ( ! IfcGeom::convert_wire(l->PolygonalBoundary(),wire) || ! wire.Closed() ) return false;
|
2011-07-25 14:56:40 +00:00
|
|
|
gp_Trsf trsf;
|
|
|
|
|
convert(l->Position(),trsf);
|
2012-03-13 11:56:52 +00:00
|
|
|
TopoDS_Shape prism = BRepPrimAPI_MakePrism(BRepBuilderAPI_MakeFace(wire),gp_Vec(0,0,200));
|
2012-03-01 21:17:06 +00:00
|
|
|
gp_Trsf down; down.SetTranslation(gp_Vec(0,0,-100.0));
|
2013-08-09 05:13:02 +00:00
|
|
|
prism.Move(trsf*down);
|
2012-03-13 11:56:52 +00:00
|
|
|
shape = BRepAlgoAPI_Common(halfspace,prism);
|
2011-07-25 14:56:40 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcShellBasedSurfaceModel::ptr l, IfcRepresentationShapeItems& shapes) {
|
2011-07-25 14:56:40 +00:00
|
|
|
IfcUtil::IfcAbstractSelect::list shells = l->SbsmBoundary();
|
2013-05-05 08:49:25 +00:00
|
|
|
const SurfaceStyle* collective_style = get_style(l);
|
2011-07-25 14:56:40 +00:00
|
|
|
for( IfcUtil::IfcAbstractSelect::it it = shells->begin(); it != shells->end(); ++ it ) {
|
|
|
|
|
TopoDS_Shape s;
|
2013-05-05 08:49:25 +00:00
|
|
|
const SurfaceStyle* shell_style = 0;
|
|
|
|
|
if ((*it)->is(Ifc2x3::Type::IfcRepresentationItem)) {
|
|
|
|
|
shell_style = get_style((Ifc2x3::IfcRepresentationItem*)*it);
|
|
|
|
|
}
|
|
|
|
|
if (IfcGeom::convert_shape(*it,s)) {
|
|
|
|
|
shapes.push_back(IfcRepresentationShapeItem(s, shell_style ? shell_style : collective_style));
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcBooleanClippingResult::ptr l, TopoDS_Shape& shape) {
|
2011-07-25 14:56:40 +00:00
|
|
|
TopoDS_Shape s1, s2;
|
2012-03-13 11:56:52 +00:00
|
|
|
TopoDS_Wire boundary_wire;
|
2013-08-09 05:13:02 +00:00
|
|
|
Ifc2x3::IfcBooleanOperand operand1 = l->FirstOperand();
|
2012-03-13 11:56:52 +00:00
|
|
|
Ifc2x3::IfcBooleanOperand operand2 = l->SecondOperand();
|
|
|
|
|
bool is_halfspace = operand2->is(Ifc2x3::Type::IfcHalfSpaceSolid);
|
2011-10-12 16:43:29 +00:00
|
|
|
|
2013-08-12 00:26:15 +00:00
|
|
|
if ( ! IfcGeom::convert_shape(operand1,s1) )
|
2011-07-25 14:56:40 +00:00
|
|
|
return false;
|
2012-03-13 11:56:52 +00:00
|
|
|
|
|
|
|
|
const double first_operand_volume = shape_volume(s1);
|
2011-10-12 16:43:29 +00:00
|
|
|
if ( first_operand_volume <= ALMOST_ZERO )
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_WARNING,"Empty solid for:",l->FirstOperand()->entity);
|
2012-03-13 11:56:52 +00:00
|
|
|
|
|
|
|
|
if ( !IfcGeom::convert_shape(l->SecondOperand(),s2) ) {
|
2011-10-12 16:43:29 +00:00
|
|
|
shape = s1;
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"Failed to convert SecondOperand of:",l->entity);
|
2011-10-12 16:43:29 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-13 11:56:52 +00:00
|
|
|
if ( ! is_halfspace ) {
|
|
|
|
|
const double second_operand_volume = shape_volume(s2);
|
2012-01-31 17:30:46 +00:00
|
|
|
if ( second_operand_volume <= ALMOST_ZERO )
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_WARNING,"Empty solid for:",operand2->entity);
|
2012-01-31 17:30:46 +00:00
|
|
|
}
|
2011-10-12 16:43:29 +00:00
|
|
|
|
2012-03-13 11:56:52 +00:00
|
|
|
bool valid_cut = false;
|
2013-11-24 15:44:27 +00:00
|
|
|
BRepAlgoAPI_Cut brep_cut(s1,s2);
|
|
|
|
|
if ( brep_cut.IsDone() ) {
|
|
|
|
|
TopoDS_Shape result = brep_cut;
|
|
|
|
|
|
|
|
|
|
ShapeFix_Shape fix(result);
|
|
|
|
|
fix.Perform();
|
|
|
|
|
result = fix.Shape();
|
|
|
|
|
|
|
|
|
|
bool is_valid = BRepCheck_Analyzer(result).IsValid() != 0;
|
|
|
|
|
if ( is_valid ) {
|
|
|
|
|
shape = result;
|
|
|
|
|
valid_cut = true;
|
|
|
|
|
}
|
2012-03-13 11:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( valid_cut ) {
|
|
|
|
|
const double volume_after_subtraction = shape_volume(shape);
|
|
|
|
|
if ( ALMOST_THE_SAME(first_operand_volume,volume_after_subtraction) )
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_WARNING,"Subtraction yields unchanged volume:",l->entity);
|
2012-03-13 11:56:52 +00:00
|
|
|
} else {
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"Failed to process subtraction:",l->entity);
|
2012-03-13 11:56:52 +00:00
|
|
|
shape = s1;
|
|
|
|
|
}
|
2011-10-12 16:43:29 +00:00
|
|
|
|
2011-07-25 14:56:40 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcConnectedFaceSet::ptr l, TopoDS_Shape& shape) {
|
2011-07-25 14:56:40 +00:00
|
|
|
Ifc2x3::IfcFace::list faces = l->CfsFaces();
|
|
|
|
|
bool facesAdded = false;
|
2012-03-23 17:38:44 +00:00
|
|
|
const unsigned int num_faces = faces->Size();
|
2012-08-11 13:24:08 +00:00
|
|
|
if ( num_faces < GetValue(GV_MAX_FACES_TO_SEW) ) {
|
2012-03-23 17:38:44 +00:00
|
|
|
BRepOffsetAPI_Sewing builder;
|
2012-06-25 15:08:58 +00:00
|
|
|
builder.SetTolerance(GetValue(GV_POINT_EQUALITY_TOLERANCE));
|
|
|
|
|
builder.SetMaxTolerance(GetValue(GV_POINT_EQUALITY_TOLERANCE));
|
|
|
|
|
builder.SetMinTolerance(GetValue(GV_POINT_EQUALITY_TOLERANCE));
|
2012-03-23 17:38:44 +00:00
|
|
|
for( Ifc2x3::IfcFace::it it = faces->begin(); it != faces->end(); ++ it ) {
|
|
|
|
|
TopoDS_Face face;
|
2012-06-25 15:08:58 +00:00
|
|
|
if ( IfcGeom::convert_face(*it,face) && face_area(face) > GetValue(GV_MINIMAL_FACE_AREA) ) {
|
2012-03-23 17:38:44 +00:00
|
|
|
builder.Add(face);
|
|
|
|
|
facesAdded = true;
|
|
|
|
|
} else {
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_WARNING,"Invalid face:",(*it)->entity);
|
2012-03-23 17:38:44 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( ! facesAdded ) return false;
|
|
|
|
|
builder.Perform();
|
|
|
|
|
shape = builder.SewedShape();
|
|
|
|
|
try {
|
|
|
|
|
ShapeFix_Solid solid;
|
2012-06-25 15:08:58 +00:00
|
|
|
solid.LimitTolerance(GetValue(GV_POINT_EQUALITY_TOLERANCE));
|
2012-03-23 17:38:44 +00:00
|
|
|
shape = solid.SolidFromShell(TopoDS::Shell(shape));
|
|
|
|
|
} catch(...) {}
|
|
|
|
|
} else {
|
|
|
|
|
TopoDS_Compound compound;
|
|
|
|
|
BRep_Builder builder;
|
|
|
|
|
builder.MakeCompound(compound);
|
|
|
|
|
for( Ifc2x3::IfcFace::it it = faces->begin(); it != faces->end(); ++ it ) {
|
|
|
|
|
TopoDS_Face face;
|
2012-06-25 15:08:58 +00:00
|
|
|
if ( IfcGeom::convert_face(*it,face) && face_area(face) > GetValue(GV_MINIMAL_FACE_AREA) ) {
|
2012-03-23 17:38:44 +00:00
|
|
|
builder.Add(compound,face);
|
|
|
|
|
facesAdded = true;
|
|
|
|
|
} else {
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_WARNING,"Invalid face:",(*it)->entity);
|
2012-03-23 17:38:44 +00:00
|
|
|
}
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
2012-03-23 17:38:44 +00:00
|
|
|
if ( ! facesAdded ) return false;
|
|
|
|
|
shape = compound;
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcMappedItem::ptr l, IfcRepresentationShapeItems& shapes) {
|
2011-10-23 17:11:06 +00:00
|
|
|
gp_GTrsf gtrsf;
|
2011-07-25 14:56:40 +00:00
|
|
|
Ifc2x3::IfcCartesianTransformationOperator::ptr transform = l->MappingTarget();
|
2011-10-23 17:11:06 +00:00
|
|
|
if ( transform->is(Ifc2x3::Type::IfcCartesianTransformationOperator3DnonUniform) ) {
|
2011-07-25 14:56:40 +00:00
|
|
|
IfcGeom::convert(reinterpret_pointer_cast<Ifc2x3::IfcCartesianTransformationOperator,
|
2011-10-23 17:11:06 +00:00
|
|
|
Ifc2x3::IfcCartesianTransformationOperator3DnonUniform>(transform),gtrsf);
|
|
|
|
|
} else if ( transform->is(Ifc2x3::Type::IfcCartesianTransformationOperator2DnonUniform) ) {
|
2012-03-13 11:56:52 +00:00
|
|
|
return false;
|
|
|
|
|
} else if ( transform->is(Ifc2x3::Type::IfcCartesianTransformationOperator3D) ) {
|
2011-10-23 17:11:06 +00:00
|
|
|
gp_Trsf trsf;
|
|
|
|
|
IfcGeom::convert(reinterpret_pointer_cast<Ifc2x3::IfcCartesianTransformationOperator,
|
|
|
|
|
Ifc2x3::IfcCartesianTransformationOperator3D>(transform),trsf);
|
|
|
|
|
gtrsf = trsf;
|
2011-07-25 14:56:40 +00:00
|
|
|
} else if ( transform->is(Ifc2x3::Type::IfcCartesianTransformationOperator2D) ) {
|
2011-10-23 17:11:06 +00:00
|
|
|
gp_Trsf2d trsf_2d;
|
2011-07-25 14:56:40 +00:00
|
|
|
IfcGeom::convert(reinterpret_pointer_cast<Ifc2x3::IfcCartesianTransformationOperator,
|
2011-10-23 17:11:06 +00:00
|
|
|
Ifc2x3::IfcCartesianTransformationOperator2D>(transform),trsf_2d);
|
|
|
|
|
gtrsf = (gp_Trsf) trsf_2d;
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
|
|
|
|
Ifc2x3::IfcRepresentationMap::ptr map = l->MappingSource();
|
|
|
|
|
Ifc2x3::IfcAxis2Placement placement = map->MappingOrigin();
|
2011-10-23 17:11:06 +00:00
|
|
|
gp_Trsf trsf;
|
2011-07-25 14:56:40 +00:00
|
|
|
if (placement->is(Ifc2x3::Type::IfcAxis2Placement3D)) {
|
2011-10-23 17:11:06 +00:00
|
|
|
IfcGeom::convert((Ifc2x3::IfcAxis2Placement3D*)placement,trsf);
|
2011-07-25 14:56:40 +00:00
|
|
|
} else {
|
2011-10-23 17:11:06 +00:00
|
|
|
gp_Trsf2d trsf_2d;
|
|
|
|
|
IfcGeom::convert((Ifc2x3::IfcAxis2Placement2D*)placement,trsf_2d);
|
|
|
|
|
trsf = trsf_2d;
|
|
|
|
|
}
|
|
|
|
|
gtrsf.Multiply(trsf);
|
|
|
|
|
const unsigned int previous_size = (const unsigned int) shapes.size();
|
|
|
|
|
bool b = IfcGeom::convert_shapes(map->MappedRepresentation(),shapes);
|
|
|
|
|
for ( unsigned int i = previous_size; i < shapes.size(); ++ i ) {
|
2013-07-20 22:12:40 +00:00
|
|
|
shapes[i].append(gtrsf);
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
2011-10-23 17:11:06 +00:00
|
|
|
return b;
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
|
|
|
|
|
bool IfcGeom::convert(const Ifc2x3::IfcShapeRepresentation::ptr l, IfcRepresentationShapeItems& shapes) {
|
2011-07-25 14:56:40 +00:00
|
|
|
Ifc2x3::IfcRepresentationItem::list items = l->Items();
|
|
|
|
|
if ( ! items->Size() ) return false;
|
|
|
|
|
for ( Ifc2x3::IfcRepresentationItem::it it = items->begin(); it != items->end(); ++ it ) {
|
2013-05-05 08:49:25 +00:00
|
|
|
Ifc2x3::IfcRepresentationItem* representation_item = *it;
|
|
|
|
|
if ( IfcGeom::is_shape_collection(representation_item) ) IfcGeom::convert_shapes(*it,shapes);
|
2011-10-23 17:11:06 +00:00
|
|
|
else {
|
|
|
|
|
TopoDS_Shape s;
|
2013-05-05 08:49:25 +00:00
|
|
|
if (IfcGeom::convert_shape(representation_item,s)) {
|
|
|
|
|
shapes.push_back(IfcRepresentationShapeItem(s, get_style(representation_item)));
|
|
|
|
|
}
|
2011-10-23 17:11:06 +00:00
|
|
|
}
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|
2011-10-23 17:11:06 +00:00
|
|
|
return true;
|
2011-07-25 14:56:40 +00:00
|
|
|
}
|