mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fix #63
This commit is contained in:
@@ -21,9 +21,6 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include <BRepBuilderAPI_GTransform.hxx>
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
|
||||||
|
|
||||||
#include <Standard_Version.hxx>
|
#include <Standard_Version.hxx>
|
||||||
|
|
||||||
#include "OpenCascadeBasedSerializer.h"
|
#include "OpenCascadeBasedSerializer.h"
|
||||||
@@ -49,18 +46,8 @@ void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
|||||||
gtrsf.PreMultiply(scale);
|
gtrsf.PreMultiply(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopoDS_Shape& s = it->Shape();
|
const TopoDS_Shape& s = it->Shape();
|
||||||
|
const TopoDS_Shape moved_shape = IfcGeom::Kernel::apply_transformation(s, gtrsf);
|
||||||
bool trsf_valid = false;
|
|
||||||
gp_Trsf trsf;
|
|
||||||
try {
|
|
||||||
trsf = gtrsf.Trsf();
|
|
||||||
trsf_valid = true;
|
|
||||||
} catch (...) {}
|
|
||||||
|
|
||||||
const TopoDS_Shape moved_shape = trsf_valid
|
|
||||||
? BRepBuilderAPI_Transform(s, trsf, true).Shape()
|
|
||||||
: BRepBuilderAPI_GTransform(s, gtrsf, true).Shape();
|
|
||||||
|
|
||||||
writeShape(moved_shape);
|
writeShape(moved_shape);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,6 @@
|
|||||||
#include <gp_Pln.hxx>
|
#include <gp_Pln.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <BRepBuilderAPI_GTransform.hxx>
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAlgo_Section.hxx>
|
#include <BRepAlgo_Section.hxx>
|
||||||
@@ -222,17 +220,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* o)
|
|||||||
gtrsf.PreMultiply(o_trsf);
|
gtrsf.PreMultiply(o_trsf);
|
||||||
|
|
||||||
const TopoDS_Shape& s = it->Shape();
|
const TopoDS_Shape& s = it->Shape();
|
||||||
|
const TopoDS_Shape moved_shape = IfcGeom::Kernel::apply_transformation(s, gtrsf);
|
||||||
bool trsf_valid = false;
|
|
||||||
gp_Trsf trsf;
|
|
||||||
try {
|
|
||||||
trsf = gtrsf.Trsf();
|
|
||||||
trsf_valid = true;
|
|
||||||
} catch (...) {}
|
|
||||||
|
|
||||||
const TopoDS_Shape moved_shape = trsf_valid
|
|
||||||
? BRepBuilderAPI_Transform(s, trsf, true).Shape()
|
|
||||||
: BRepBuilderAPI_GTransform(s, gtrsf, true).Shape();
|
|
||||||
|
|
||||||
const double inf = std::numeric_limits<double>::infinity();
|
const double inf = std::numeric_limits<double>::infinity();
|
||||||
double zmin = inf;
|
double zmin = inf;
|
||||||
|
|||||||
@@ -219,6 +219,9 @@ public:
|
|||||||
bool approximate_plane_through_wire(const TopoDS_Wire&, gp_Pln&);
|
bool approximate_plane_through_wire(const TopoDS_Wire&, gp_Pln&);
|
||||||
bool flatten_wire(TopoDS_Wire&);
|
bool flatten_wire(TopoDS_Wire&);
|
||||||
|
|
||||||
|
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_Trsf&);
|
||||||
|
static TopoDS_Shape apply_transformation(const TopoDS_Shape&, const gp_GTrsf&);
|
||||||
|
|
||||||
bool is_identity_transform(IfcUtil::IfcBaseClass*);
|
bool is_identity_transform(IfcUtil::IfcBaseClass*);
|
||||||
|
|
||||||
IfcSchema::IfcRelVoidsElement::list::ptr find_openings(IfcSchema::IfcProduct* product);
|
IfcSchema::IfcRelVoidsElement::list::ptr find_openings(IfcSchema::IfcProduct* product);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
#include <GProp_GProps.hxx>
|
#include <GProp_GProps.hxx>
|
||||||
#include <BRepGProp.hxx>
|
#include <BRepGProp.hxx>
|
||||||
|
|
||||||
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
#include <BRepBuilderAPI_GTransform.hxx>
|
#include <BRepBuilderAPI_GTransform.hxx>
|
||||||
|
|
||||||
#include <BRepCheck_Analyzer.hxx>
|
#include <BRepCheck_Analyzer.hxx>
|
||||||
@@ -231,13 +232,10 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
|
|||||||
TopoDS_Shape entity_shape_solid;
|
TopoDS_Shape entity_shape_solid;
|
||||||
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
||||||
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
||||||
TopoDS_Shape entity_shape;
|
|
||||||
if ( entity_shape_gtrsf.Form() == gp_Other ) {
|
if ( entity_shape_gtrsf.Form() == gp_Other ) {
|
||||||
Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to:",entity->entity);
|
Logger::Message(Logger::LOG_WARNING, "Applying non uniform transformation to:", entity->entity);
|
||||||
entity_shape = BRepBuilderAPI_GTransform(entity_shape_unlocated,entity_shape_gtrsf,true).Shape();
|
|
||||||
} else {
|
|
||||||
entity_shape = entity_shape_unlocated.Moved(entity_shape_gtrsf.Trsf());
|
|
||||||
}
|
}
|
||||||
|
TopoDS_Shape entity_shape = apply_transformation(entity_shape_unlocated, entity_shape_gtrsf);
|
||||||
|
|
||||||
// Iterate over the shapes of the IfcOpeningElements
|
// Iterate over the shapes of the IfcOpeningElements
|
||||||
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it4 = opening_shapes.begin(); it4 != opening_shapes.end(); ++ it4 ) {
|
for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it4 = opening_shapes.begin(); it4 != opening_shapes.end(); ++ it4 ) {
|
||||||
@@ -247,9 +245,7 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
|
|||||||
if ( opening_shape_gtrsf.Form() == gp_Other ) {
|
if ( opening_shape_gtrsf.Form() == gp_Other ) {
|
||||||
Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to opening of:",entity->entity);
|
Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to opening of:",entity->entity);
|
||||||
}
|
}
|
||||||
const TopoDS_Shape& opening_shape = opening_shape_gtrsf.Form() == gp_Other
|
TopoDS_Shape opening_shape = apply_transformation(opening_shape_unlocated, opening_shape_gtrsf);
|
||||||
? BRepBuilderAPI_GTransform(opening_shape_unlocated,opening_shape_gtrsf,true).Shape()
|
|
||||||
: opening_shape_unlocated.Moved(opening_shape_gtrsf.Trsf());
|
|
||||||
|
|
||||||
double opening_volume;
|
double opening_volume;
|
||||||
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
|
if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
|
||||||
@@ -397,10 +393,8 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
for ( unsigned int i = 0; i < opening_shapes.size(); ++ i ) {
|
for ( unsigned int i = 0; i < opening_shapes.size(); ++ i ) {
|
||||||
gp_GTrsf gtrsf = opening_shapes[i].Placement();
|
gp_GTrsf gtrsf = opening_shapes[i].Placement();
|
||||||
gtrsf.PreMultiply(opening_trsf);
|
gtrsf.PreMultiply(opening_trsf);
|
||||||
const TopoDS_Shape& opening_shape = gtrsf.Form() == gp_Other
|
TopoDS_Shape opening_shape = apply_transformation(opening_shapes[i].Shape(), gtrsf);
|
||||||
? BRepBuilderAPI_GTransform(opening_shapes[i].Shape(),gtrsf,true).Shape()
|
builder.Add(opening_compound, opening_shape);
|
||||||
: (opening_shapes[i].Shape()).Moved(gtrsf.Trsf());
|
|
||||||
builder.Add(opening_compound,opening_shape);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -411,13 +405,10 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
TopoDS_Shape entity_shape_solid;
|
TopoDS_Shape entity_shape_solid;
|
||||||
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
||||||
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
||||||
TopoDS_Shape entity_shape;
|
if (entity_shape_gtrsf.Form() == gp_Other) {
|
||||||
if ( entity_shape_gtrsf.Form() == gp_Other ) {
|
Logger::Message(Logger::LOG_WARNING, "Applying non uniform transformation to:", entity->entity);
|
||||||
Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to:",entity->entity);
|
|
||||||
entity_shape = BRepBuilderAPI_GTransform(entity_shape_unlocated,entity_shape_gtrsf,true).Shape();
|
|
||||||
} else {
|
|
||||||
entity_shape = entity_shape_unlocated.Moved(entity_shape_gtrsf.Trsf());
|
|
||||||
}
|
}
|
||||||
|
TopoDS_Shape entity_shape = apply_transformation(entity_shape_unlocated, entity_shape_gtrsf);
|
||||||
|
|
||||||
BRepAlgoAPI_Cut brep_cut(entity_shape,opening_compound);
|
BRepAlgoAPI_Cut brep_cut(entity_shape,opening_compound);
|
||||||
|
|
||||||
@@ -477,9 +468,7 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
for ( unsigned int i = 0; i < opening_shapes.size(); ++ i ) {
|
for ( unsigned int i = 0; i < opening_shapes.size(); ++ i ) {
|
||||||
gp_GTrsf gtrsf = opening_shapes[i].Placement();
|
gp_GTrsf gtrsf = opening_shapes[i].Placement();
|
||||||
gtrsf.PreMultiply(opening_trsf);
|
gtrsf.PreMultiply(opening_trsf);
|
||||||
const TopoDS_Shape& opening_shape = gtrsf.Form() == gp_Other
|
TopoDS_Shape opening_shape = apply_transformation(opening_shapes[i].Shape(), gtrsf);
|
||||||
? BRepBuilderAPI_GTransform(opening_shapes[i].Shape(),gtrsf,true).Shape()
|
|
||||||
: (opening_shapes[i].Shape()).Moved(gtrsf.Trsf());
|
|
||||||
opening_shapelist.Append(opening_shape);
|
opening_shapelist.Append(opening_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,14 +480,11 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
|
|||||||
TopoDS_Shape entity_shape_solid;
|
TopoDS_Shape entity_shape_solid;
|
||||||
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
const TopoDS_Shape& entity_shape_unlocated = ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
|
||||||
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
|
||||||
TopoDS_Shape entity_shape;
|
if (entity_shape_gtrsf.Form() == gp_Other) {
|
||||||
if ( entity_shape_gtrsf.Form() == gp_Other ) {
|
Logger::Message(Logger::LOG_WARNING, "Applying non uniform transformation to:", entity->entity);
|
||||||
Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to:",entity->entity);
|
|
||||||
entity_shape = BRepBuilderAPI_GTransform(entity_shape_unlocated,entity_shape_gtrsf,true).Shape();
|
|
||||||
} else {
|
|
||||||
entity_shape = entity_shape_unlocated.Moved(entity_shape_gtrsf.Trsf());
|
|
||||||
}
|
}
|
||||||
|
TopoDS_Shape entity_shape = apply_transformation(entity_shape_unlocated, entity_shape_gtrsf);
|
||||||
|
|
||||||
BRepAlgoAPI_Cut brep_cut;
|
BRepAlgoAPI_Cut brep_cut;
|
||||||
TopTools_ListOfShape s1s;
|
TopTools_ListOfShape s1s;
|
||||||
s1s.Append(entity_shape);
|
s1s.Append(entity_shape);
|
||||||
@@ -921,20 +907,7 @@ bool IfcGeom::Kernel::flatten_shape_list(const IfcGeom::IfcRepresentationShapeIt
|
|||||||
merged = s;
|
merged = s;
|
||||||
}
|
}
|
||||||
const gp_GTrsf& trsf = it->Placement();
|
const gp_GTrsf& trsf = it->Placement();
|
||||||
bool trsf_valid = false;
|
const TopoDS_Shape moved_shape = apply_transformation(merged, trsf);
|
||||||
gp_Trsf _trsf;
|
|
||||||
try {
|
|
||||||
_trsf = trsf.Trsf();
|
|
||||||
trsf_valid = true;
|
|
||||||
} catch (...) {}
|
|
||||||
|
|
||||||
const TopoDS_Shape moved_shape = trsf.Form() == gp_Identity
|
|
||||||
? merged
|
|
||||||
: (
|
|
||||||
trsf_valid
|
|
||||||
? merged.Moved(_trsf)
|
|
||||||
: BRepBuilderAPI_GTransform(merged,trsf,true).Shape()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (shapes.size() == 1) {
|
if (shapes.size() == 1) {
|
||||||
result = moved_shape;
|
result = moved_shape;
|
||||||
@@ -1772,6 +1745,8 @@ bool IfcGeom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const IfcRepre
|
|||||||
TopoDS_Shape axis_shape;
|
TopoDS_Shape axis_shape;
|
||||||
flatten_shape_list(axis_items, axis_shape, false);
|
flatten_shape_list(axis_items, axis_shape, false);
|
||||||
|
|
||||||
|
// local and other are IfcLocalPlacements and therefore have a unit
|
||||||
|
// scale factor that can be applied by means of TopoDS_Shape::Move()
|
||||||
axis_shape.Move(other);
|
axis_shape.Move(other);
|
||||||
axis_shape.Move(local);
|
axis_shape.Move(local);
|
||||||
|
|
||||||
@@ -2410,3 +2385,27 @@ bool IfcGeom::Kernel::flatten_wire(TopoDS_Wire& wire) {
|
|||||||
wire = TopoDS::Wire(list.First());
|
wire = TopoDS::Wire(list.First());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TopoDS_Shape IfcGeom::Kernel::apply_transformation(const TopoDS_Shape& s, const gp_Trsf& t) {
|
||||||
|
if (t.Form() == gp_Identity) {
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
/// @todo set to 1. and exactly 1. or use epsilon?
|
||||||
|
if (t.ScaleFactor() != 1.) {
|
||||||
|
return BRepBuilderAPI_Transform(s, t, true);
|
||||||
|
} else {
|
||||||
|
return s.Moved(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Shape IfcGeom::Kernel::apply_transformation(const TopoDS_Shape& s, const gp_GTrsf& t) {
|
||||||
|
if (t.Form() == gp_Other) {
|
||||||
|
return BRepBuilderAPI_GTransform(s, t, true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return apply_transformation(s, t.Trsf());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <BRepBuilderAPI_GTransform.hxx>
|
|
||||||
|
|
||||||
#include "../ifcgeom/IfcGeom.h"
|
#include "../ifcgeom/IfcGeom.h"
|
||||||
|
|
||||||
@@ -60,15 +59,10 @@ IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
|
|||||||
scale.SetScaleFactor(1.0 / settings().unit_magnitude());
|
scale.SetScaleFactor(1.0 / settings().unit_magnitude());
|
||||||
trsf.PreMultiply(scale);
|
trsf.PreMultiply(scale);
|
||||||
}
|
}
|
||||||
bool trsf_valid = false;
|
|
||||||
gp_Trsf _trsf;
|
const TopoDS_Shape moved_shape = IfcGeom::Kernel::apply_transformation(s, trsf);
|
||||||
try {
|
|
||||||
_trsf = trsf.Trsf();
|
builder.Add(compound, moved_shape);
|
||||||
trsf_valid = true;
|
|
||||||
} catch (...) {}
|
|
||||||
const TopoDS_Shape moved_shape = trsf_valid ? s.Moved(_trsf) :
|
|
||||||
BRepBuilderAPI_GTransform(s,trsf,true).Shape();
|
|
||||||
builder.Add(compound,moved_shape);
|
|
||||||
}
|
}
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
BRepTools::Write(compound,sstream);
|
BRepTools::Write(compound,sstream);
|
||||||
|
|||||||
@@ -146,7 +146,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcExtrudedAreaSolid* l, TopoDS_S
|
|||||||
shape = BRepPrimAPI_MakePrism(face, height*dir);
|
shape = BRepPrimAPI_MakePrism(face, height*dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
||||||
|
// and therefore has a unit scale factor
|
||||||
shape.Move(trsf);
|
shape.Move(trsf);
|
||||||
|
|
||||||
return ! shape.IsNull();
|
return ! shape.IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +169,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSurfaceOfLinearExtrusion* l, T
|
|||||||
convert(l->ExtrudedDirection(),dir);
|
convert(l->ExtrudedDirection(),dir);
|
||||||
|
|
||||||
shape = BRepPrimAPI_MakePrism(wire, height*dir);
|
shape = BRepPrimAPI_MakePrism(wire, height*dir);
|
||||||
|
|
||||||
|
// IfcSweptSurface.Position (trsf) is an IfcAxis2Placement3D
|
||||||
|
// and therefore has a unit scale factor
|
||||||
shape.Move(trsf);
|
shape.Move(trsf);
|
||||||
|
|
||||||
return !shape.IsNull();
|
return !shape.IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +194,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSurfaceOfRevolution* l, TopoDS
|
|||||||
|
|
||||||
shape = BRepPrimAPI_MakeRevol(wire, ax1);
|
shape = BRepPrimAPI_MakeRevol(wire, ax1);
|
||||||
|
|
||||||
|
// IfcSweptSurface.Position (trsf) is an IfcAxis2Placement3D
|
||||||
|
// and therefore has a unit scale factor
|
||||||
shape.Move(trsf);
|
shape.Move(trsf);
|
||||||
|
|
||||||
return !shape.IsNull();
|
return !shape.IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +219,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcRevolvedAreaSolid* l, TopoDS_S
|
|||||||
shape = BRepPrimAPI_MakeRevol(face, ax1, ang);
|
shape = BRepPrimAPI_MakeRevol(face, ax1, ang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
||||||
|
// and therefore has a unit scale factor
|
||||||
shape.Move(trsf);
|
shape.Move(trsf);
|
||||||
|
|
||||||
return !shape.IsNull();
|
return !shape.IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +282,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalBoundedHalfSpace* l,
|
|||||||
|
|
||||||
TopoDS_Shape prism = BRepPrimAPI_MakePrism(BRepBuilderAPI_MakeFace(wire),gp_Vec(0,0,200));
|
TopoDS_Shape prism = BRepPrimAPI_MakePrism(BRepBuilderAPI_MakeFace(wire),gp_Vec(0,0,200));
|
||||||
gp_Trsf down; down.SetTranslation(gp_Vec(0,0,-100.0));
|
gp_Trsf down; down.SetTranslation(gp_Vec(0,0,-100.0));
|
||||||
prism.Move(trsf*down);
|
|
||||||
|
// `trsf` and `down` both have a unit scale factor
|
||||||
|
prism.Move(trsf*down);
|
||||||
|
|
||||||
shape = BRepAlgoAPI_Common(halfspace,prism);
|
shape = BRepAlgoAPI_Common(halfspace,prism);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -608,7 +624,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBlock* l, TopoDS_Shape& shape)
|
|||||||
BRepPrimAPI_MakeBox builder(dx, dy, dz);
|
BRepPrimAPI_MakeBox builder(dx, dy, dz);
|
||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
IfcGeom::Kernel::convert(l->Position(),trsf);
|
IfcGeom::Kernel::convert(l->Position(),trsf);
|
||||||
|
|
||||||
|
// IfcCsgPrimitive3D.Position has unit scale factor
|
||||||
shape = builder.Solid().Moved(trsf);
|
shape = builder.Solid().Moved(trsf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +660,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcRightCircularCylinder* l, Topo
|
|||||||
BRepPrimAPI_MakeCylinder builder(r, h);
|
BRepPrimAPI_MakeCylinder builder(r, h);
|
||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
IfcGeom::Kernel::convert(l->Position(),trsf);
|
IfcGeom::Kernel::convert(l->Position(),trsf);
|
||||||
|
|
||||||
|
// IfcCsgPrimitive3D.Position has unit scale factor
|
||||||
shape = builder.Solid().Moved(trsf);
|
shape = builder.Solid().Moved(trsf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +674,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcRightCircularCone* l, TopoDS_S
|
|||||||
BRepPrimAPI_MakeCone builder(r, 0., h);
|
BRepPrimAPI_MakeCone builder(r, 0., h);
|
||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
IfcGeom::Kernel::convert(l->Position(),trsf);
|
IfcGeom::Kernel::convert(l->Position(),trsf);
|
||||||
|
|
||||||
|
// IfcCsgPrimitive3D.Position has unit scale factor
|
||||||
shape = builder.Solid().Moved(trsf);
|
shape = builder.Solid().Moved(trsf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +687,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSphere* l, TopoDS_Shape& shape
|
|||||||
BRepPrimAPI_MakeSphere builder(r);
|
BRepPrimAPI_MakeSphere builder(r);
|
||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
IfcGeom::Kernel::convert(l->Position(),trsf);
|
IfcGeom::Kernel::convert(l->Position(),trsf);
|
||||||
|
|
||||||
|
// IfcCsgPrimitive3D.Position has unit scale factor
|
||||||
shape = builder.Solid().Moved(trsf);
|
shape = builder.Solid().Moved(trsf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,6 +722,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCurveBoundedPlane* l, TopoDS_S
|
|||||||
|
|
||||||
ShapeFix_Shape sfs(mf.Face());
|
ShapeFix_Shape sfs(mf.Face());
|
||||||
sfs.Perform();
|
sfs.Perform();
|
||||||
|
|
||||||
|
// `trsf` consitutes the placement of the plane and therefore has unit scale factor
|
||||||
face = TopoDS::Face(sfs.Shape()).Moved(trsf);
|
face = TopoDS::Face(sfs.Shape()).Moved(trsf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -782,6 +812,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSurfaceCurveSweptAreaSolid* l,
|
|||||||
builder.Build();
|
builder.Build();
|
||||||
builder.MakeSolid();
|
builder.MakeSolid();
|
||||||
shape = builder.Shape();
|
shape = builder.Shape();
|
||||||
|
|
||||||
|
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
||||||
|
// and therefore has a unit scale factor
|
||||||
shape.Move(position);
|
shape.Move(position);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -873,6 +906,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCylindricalSurface* l, TopoDS_
|
|||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
IfcGeom::Kernel::convert(l->Position(),trsf);
|
IfcGeom::Kernel::convert(l->Position(),trsf);
|
||||||
|
|
||||||
|
// IfcElementarySurface.Position has unit scale factor
|
||||||
#if OCC_VERSION_HEX < 0x60502
|
#if OCC_VERSION_HEX < 0x60502
|
||||||
face = BRepBuilderAPI_MakeFace(new Geom_CylindricalSurface(gp::XOY(), l->Radius())).Face().Moved(trsf);
|
face = BRepBuilderAPI_MakeFace(new Geom_CylindricalSurface(gp::XOY(), l->Radius())).Face().Moved(trsf);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user