mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
IfcAxis1Placement.Axis is optional #7728
This commit is contained in:
@@ -43,11 +43,20 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid* inst) {
|
||||
angle = ang;
|
||||
}
|
||||
|
||||
taxonomy::direction3::ptr axis;
|
||||
if (inst->Axis()->Axis()) {
|
||||
axis = taxonomy::cast<taxonomy::direction3>(map(inst->Axis()->Axis()));
|
||||
} else {
|
||||
// IfcAxis1Placement.Axis is optional, and defaults to (0, 0, 1) if not provided.
|
||||
axis = taxonomy::make<taxonomy::direction3>(0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
return taxonomy::make<taxonomy::revolve>(
|
||||
matrix,
|
||||
taxonomy::cast<taxonomy::face>(map(inst->SweptArea())),
|
||||
taxonomy::cast<taxonomy::point3>(map(inst->Axis()->Location())),
|
||||
taxonomy::cast<taxonomy::direction3>(map(inst->Axis()->Axis())),
|
||||
axis,
|
||||
angle
|
||||
);
|
||||
|
||||
|
||||
@@ -31,11 +31,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceOfRevolution* inst) {
|
||||
matrix = taxonomy::cast<taxonomy::matrix4>(map(inst->Position()));
|
||||
}
|
||||
|
||||
taxonomy::direction3::ptr axis;
|
||||
if (inst->AxisPosition()->Axis()) {
|
||||
axis = taxonomy::cast<taxonomy::direction3>(map(inst->AxisPosition()->Axis()));
|
||||
} else {
|
||||
// IfcAxis1Placement.Axis is optional, and defaults to (0, 0, 1) if not provided.
|
||||
axis = taxonomy::make<taxonomy::direction3>(0, 0, 1);
|
||||
}
|
||||
|
||||
return taxonomy::make<taxonomy::revolve>(
|
||||
matrix,
|
||||
taxonomy::cast<taxonomy::loop>(map(inst->SweptCurve())),
|
||||
taxonomy::cast<taxonomy::point3>(map(inst->AxisPosition()->Location())),
|
||||
taxonomy::cast<taxonomy::direction3>(map(inst->AxisPosition()->Axis())),
|
||||
axis,
|
||||
boost::none
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,16 +24,11 @@ using namespace ifcopenshell::geometry;
|
||||
#ifdef SCHEMA_HAS_IfcToroidalSurface
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcToroidalSurface* inst) {
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
gp_Trsf trsf;
|
||||
IfcGeom::Kernel::convert(inst->Position(), trsf);
|
||||
|
||||
// IfcElementarySurface.Position has unit scale factor
|
||||
face = BRepBuilderAPI_MakeFace(new Geom_ToroidalSurface(gp::XOY(), inst->MajorRadius() * length_unit_, inst->MinorRadius() * length_unit_), getValue(GV_PRECISION)).Face().Moved(trsf);
|
||||
return true;
|
||||
*/
|
||||
auto c = taxonomy::make<taxonomy::torus>();
|
||||
c->radius1 = inst->MajorRadius() * length_unit_;
|
||||
c->radius2 = inst->MinorRadius() * length_unit_;
|
||||
c->matrix = taxonomy::cast<taxonomy::matrix4>(map(inst->Position()));
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -691,6 +691,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceStyle* style) {
|
||||
}
|
||||
|
||||
taxonomy::ptr mapping::map(const IfcBaseInterface* inst) {
|
||||
if (inst == nullptr) {
|
||||
Logger::Error("Warning nullptr passed to map() function");
|
||||
return nullptr;
|
||||
}
|
||||
auto iden = inst->as<IfcUtil::IfcBaseClass>()->identity();
|
||||
if (use_caching_) {
|
||||
std::lock_guard<std::mutex> guard(cache_guard_);
|
||||
|
||||
Reference in New Issue
Block a user