mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
Fix placements
This commit is contained in:
@@ -124,11 +124,15 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion* extrusion, TopoDS_Sha
|
|||||||
return false;
|
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;
|
gp_GTrsf gtrsf;
|
||||||
if (!convert(&extrusion->matrix, gtrsf)) {
|
if (!convert(&extrusion->matrix, gtrsf)) {
|
||||||
Logger::Error("Unable to move extrusion");
|
Logger::Error("Unable to move extrusion");
|
||||||
}
|
}
|
||||||
auto trsf = gtrsf.Trsf();
|
auto trsf = gtrsf.Trsf();
|
||||||
|
*/
|
||||||
|
|
||||||
auto fs = extrusion->direction.components.data();
|
auto fs = extrusion->direction.components.data();
|
||||||
gp_Dir dir(fs[0], fs[1], fs[2]);
|
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);
|
shape = BRepPrimAPI_MakePrism(face, height*dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (!shape.IsNull()) {
|
if (!shape.IsNull()) {
|
||||||
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
// IfcSweptAreaSolid.Position (trsf) is an IfcAxis2Placement3D
|
||||||
// and therefore has a unit scale factor
|
// and therefore has a unit scale factor
|
||||||
shape.Move(trsf);
|
shape.Move(trsf);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return !shape.IsNull();
|
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) {
|
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;
|
TopoDS_Shape shape;
|
||||||
if (!convert(extrusion, shape)) {
|
if (!convert(extrusion, shape)) {
|
||||||
return false;
|
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) {
|
bool OpenCascadeKernel::convert(const taxonomy::matrix4* matrix, gp_GTrsf& trsf) {
|
||||||
// @todo check
|
// @todo check
|
||||||
gp_Trsf t;
|
gp_Trsf tr;
|
||||||
t.SetValues(
|
const auto& m = matrix->components;
|
||||||
matrix->components(0, 0), matrix->components(1, 0), matrix->components(2, 0), matrix->components(3, 0),
|
tr.SetValues(
|
||||||
matrix->components(0, 1), matrix->components(1, 1), matrix->components(2, 1), matrix->components(3, 1),
|
m(0, 0), m(0, 1), m(0, 2), m(0, 3),
|
||||||
matrix->components(0, 2), matrix->components(1, 2), matrix->components(2, 2), matrix->components(3, 2)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(const settings& setti
|
|||||||
|
|
||||||
// @todo check
|
// @todo check
|
||||||
gp_GTrsf trsf;
|
gp_GTrsf trsf;
|
||||||
for (int i = 0; i < 3; ++i) {
|
gp_Trsf tr;
|
||||||
for (int j = 0; j < 4; ++j) {
|
const auto& m = place.components;
|
||||||
trsf.SetValue(i + 1, j + 1, place.components(i, j));
|
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
|
// Triangulate the shape
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -95,11 +95,14 @@ ifcopenshell::geometry::ConversionResultShape* ifcopenshell::geometry::Represent
|
|||||||
|
|
||||||
// @todo, check
|
// @todo, check
|
||||||
gp_GTrsf trsf;
|
gp_GTrsf trsf;
|
||||||
for (int i = 0; i < 3; ++i) {
|
gp_Trsf tr;
|
||||||
for (int j = 0; j < 4; ++j) {
|
const auto& m = it->Placement().components;
|
||||||
trsf.SetValue(i + 1, j + 1, it->Placement().components(i, j));
|
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)) {
|
if (!force_meters && settings().get(ifcopenshell::geometry::settings::CONVERT_BACK_UNITS)) {
|
||||||
gp_Trsf scale;
|
gp_Trsf scale;
|
||||||
@@ -240,11 +243,14 @@ bool ifcopenshell::geometry::Representation::BRep::calculate_projected_surface_a
|
|||||||
try {
|
try {
|
||||||
// @todo check
|
// @todo check
|
||||||
gp_GTrsf trsf;
|
gp_GTrsf trsf;
|
||||||
for (int i = 0; i < 3; ++i) {
|
gp_Trsf tr;
|
||||||
for (int j = 0; j < 4; ++j) {
|
const auto& m = place.components;
|
||||||
trsf.SetValue(i + 1, j + 1, place.components(i, j));
|
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_Mat mat = trsf.Trsf().HVectorialPart();
|
||||||
gp_Ax3 ax(trsf.TranslationPart(), mat.Column(3), mat.Column(1));
|
gp_Ax3 ax(trsf.TranslationPart(), mat.Column(3), mat.Column(1));
|
||||||
|
|||||||
Reference in New Issue
Block a user