mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Skeleton for IfcExtrudedAreaSolid
This commit is contained in:
@@ -23,8 +23,57 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcRepresentation* l, Convers
|
|||||||
return part_succes;
|
return part_succes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid*, cgal_shape_t&) {
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcExtrudedAreaSolid *l, cgal_shape_t &shape) {
|
||||||
throw std::runtime_error("Not implemented IfcExtrudedAreaSolid");
|
const double height = l->Depth() * getValue(GV_LENGTH_UNIT);
|
||||||
|
if (height < getValue(GV_PRECISION)) {
|
||||||
|
Logger::Message(Logger::LOG_ERROR, "Non-positive extrusion height encountered for:", l->entity);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cgal_face_t face;
|
||||||
|
if ( !convert_face(l->SweptArea(),face) ) return false;
|
||||||
|
|
||||||
|
cgal_placement_t trsf;
|
||||||
|
bool has_position = true;
|
||||||
|
#ifdef USE_IFC4
|
||||||
|
has_position = l->hasPosition();
|
||||||
|
#endif
|
||||||
|
if (has_position) {
|
||||||
|
IfcGeom::CgalKernel::convert(l->Position(), trsf);
|
||||||
|
}
|
||||||
|
|
||||||
|
cgal_direction_t dir;
|
||||||
|
convert(l->ExtrudedDirection(),dir);
|
||||||
|
|
||||||
|
std::list<cgal_face_t> face_list;
|
||||||
|
face_list.push_back(face);
|
||||||
|
|
||||||
|
cgal_face_t top_face;
|
||||||
|
for (auto const &vertex: face.outer) {
|
||||||
|
top_face.outer.push_back(vertex+dir);
|
||||||
|
} face_list.push_back(top_face);
|
||||||
|
|
||||||
|
for (std::vector<Kernel::Point_3>::const_iterator current_vertex = face.outer.begin();
|
||||||
|
current_vertex != face.outer.end();
|
||||||
|
++current_vertex) {
|
||||||
|
std::vector<Kernel::Point_3>::const_iterator next_vertex = current_vertex;
|
||||||
|
++next_vertex;
|
||||||
|
if (next_vertex == face.outer.end()) {
|
||||||
|
next_vertex = face.outer.begin();
|
||||||
|
} cgal_face_t side_face;
|
||||||
|
side_face.outer.push_back(*current_vertex);
|
||||||
|
side_face.outer.push_back(*next_vertex);
|
||||||
|
side_face.outer.push_back(*next_vertex+dir);
|
||||||
|
side_face.outer.push_back(*current_vertex+dir);
|
||||||
|
face_list.push_back(side_face);
|
||||||
|
}
|
||||||
|
|
||||||
|
cgal_shape_t polyhedron = CGAL::Polyhedron_3<Kernel>();
|
||||||
|
PolyhedronBuilder builder(&face_list);
|
||||||
|
polyhedron.delegate(builder);
|
||||||
|
|
||||||
|
shape = polyhedron;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcCartesianPoint* l, cgal_point_t& point) {
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcCartesianPoint* l, cgal_point_t& point) {
|
||||||
@@ -113,3 +162,30 @@ bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcObjectPlacement* l, cgal_p
|
|||||||
// CACHE(IfcObjectPlacement,l,trsf)
|
// CACHE(IfcObjectPlacement,l,trsf)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IfcGeom::CgalKernel::convert(const IfcSchema::IfcRectangleProfileDef* l, cgal_face_t& face) {
|
||||||
|
const double x = l->XDim() / 2.0f * getValue(GV_LENGTH_UNIT);
|
||||||
|
const double y = l->YDim() / 2.0f * getValue(GV_LENGTH_UNIT);
|
||||||
|
|
||||||
|
if ( x < ALMOST_ZERO || y < ALMOST_ZERO ) {
|
||||||
|
Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l->entity);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cgal_placement_t trsf2d;
|
||||||
|
bool has_position = true;
|
||||||
|
#ifdef USE_IFC4
|
||||||
|
has_position = l->hasPosition();
|
||||||
|
#endif
|
||||||
|
if (has_position) {
|
||||||
|
IfcGeom::CgalKernel::convert(l->Position(), trsf2d);
|
||||||
|
}
|
||||||
|
|
||||||
|
face = cgal_face_t();
|
||||||
|
face.outer.push_back(Kernel::Point_3(-x, -y, 0.0));
|
||||||
|
face.outer.push_back(Kernel::Point_3( x, -y, 0.0));
|
||||||
|
face.outer.push_back(Kernel::Point_3( x, y, 0.0));
|
||||||
|
face.outer.push_back(Kernel::Point_3(-x, y, 0.0));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ SHAPE(IfcExtrudedAreaSolid);
|
|||||||
SHAPE(IfcConnectedFaceSet);
|
SHAPE(IfcConnectedFaceSet);
|
||||||
|
|
||||||
FACE(IfcFace);
|
FACE(IfcFace);
|
||||||
|
FACE(IfcRectangleProfileDef);
|
||||||
|
|
||||||
WIRE(IfcPolyLoop);
|
WIRE(IfcPolyLoop);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user