mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix placements
This commit is contained in:
@@ -124,12 +124,16 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion* extrusion, TopoDS_Sha
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// @todo we need to decide whether the matrix is kept on the taxonomy node or
|
||||
// move the TopoDS_Shape, but obviously not both.
|
||||
gp_GTrsf gtrsf;
|
||||
if (!convert(&extrusion->matrix, gtrsf)) {
|
||||
Logger::Error("Unable to move extrusion");
|
||||
}
|
||||
auto trsf = gtrsf.Trsf();
|
||||
|
||||
*/
|
||||
|
||||
auto fs = extrusion->direction.components.data();
|
||||
gp_Dir dir(fs[0], fs[1], fs[2]);
|
||||
|
||||
@@ -161,11 +165,13 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion* extrusion, TopoDS_Sha
|
||||
shape = BRepPrimAPI_MakePrism(face, height*dir);
|
||||
}
|
||||
|
||||
/*
|
||||
if (!shape.IsNull()) {
|
||||
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
||||
// and therefore has a unit scale factor
|
||||
shape.Move(trsf);
|
||||
}
|
||||
*/
|
||||
|
||||
return !shape.IsNull();
|
||||
}
|
||||
@@ -831,6 +837,9 @@ bool OpenCascadeKernel::convert(const taxonomy::loop* loop, TopoDS_Wire& wire) {
|
||||
}
|
||||
|
||||
bool OpenCascadeKernel::convert_impl(const taxonomy::extrusion* extrusion, ifcopenshell::geometry::ConversionResults& results) {
|
||||
if (((IfcUtil::IfcBaseEntity*)extrusion->instance)->data().id() == 5722) {
|
||||
std::wcerr << 1;
|
||||
}
|
||||
TopoDS_Shape shape;
|
||||
if (!convert(extrusion, shape)) {
|
||||
return false;
|
||||
@@ -860,13 +869,14 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::shell *shell, ifcopenshell:
|
||||
|
||||
bool OpenCascadeKernel::convert(const taxonomy::matrix4* matrix, gp_GTrsf& trsf) {
|
||||
// @todo check
|
||||
gp_Trsf t;
|
||||
t.SetValues(
|
||||
matrix->components(0, 0), matrix->components(1, 0), matrix->components(2, 0), matrix->components(3, 0),
|
||||
matrix->components(0, 1), matrix->components(1, 1), matrix->components(2, 1), matrix->components(3, 1),
|
||||
matrix->components(0, 2), matrix->components(1, 2), matrix->components(2, 2), matrix->components(3, 2)
|
||||
gp_Trsf tr;
|
||||
const auto& m = matrix->components;
|
||||
tr.SetValues(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
|
||||
);
|
||||
trsf = t;
|
||||
trsf = tr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,14 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(const settings& setti
|
||||
|
||||
// @todo check
|
||||
gp_GTrsf trsf;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
trsf.SetValue(i + 1, j + 1, place.components(i, j));
|
||||
}
|
||||
}
|
||||
gp_Trsf tr;
|
||||
const auto& m = place.components;
|
||||
tr.SetValues(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
|
||||
);
|
||||
trsf = tr;
|
||||
|
||||
// Triangulate the shape
|
||||
try {
|
||||
|
||||
@@ -95,11 +95,14 @@ ifcopenshell::geometry::ConversionResultShape* ifcopenshell::geometry::Represent
|
||||
|
||||
// @todo, check
|
||||
gp_GTrsf trsf;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
trsf.SetValue(i + 1, j + 1, it->Placement().components(i, j));
|
||||
}
|
||||
}
|
||||
gp_Trsf tr;
|
||||
const auto& m = it->Placement().components;
|
||||
tr.SetValues(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
|
||||
);
|
||||
trsf = tr;
|
||||
|
||||
if (!force_meters && settings().get(ifcopenshell::geometry::settings::CONVERT_BACK_UNITS)) {
|
||||
gp_Trsf scale;
|
||||
@@ -240,11 +243,14 @@ bool ifcopenshell::geometry::Representation::BRep::calculate_projected_surface_a
|
||||
try {
|
||||
// @todo check
|
||||
gp_GTrsf trsf;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
trsf.SetValue(i + 1, j + 1, place.components(i, j));
|
||||
}
|
||||
}
|
||||
gp_Trsf tr;
|
||||
const auto& m = place.components;
|
||||
tr.SetValues(
|
||||
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||
m(1, 0), m(1, 1), m(1, 2), m(1, 3),
|
||||
m(2, 0), m(2, 1), m(2, 2), m(2, 3)
|
||||
);
|
||||
trsf = tr;
|
||||
|
||||
gp_Mat mat = trsf.Trsf().HVectorialPart();
|
||||
gp_Ax3 ax(trsf.TranslationPart(), mat.Column(3), mat.Column(1));
|
||||
|
||||
Reference in New Issue
Block a user