mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Small changes to curve segment handling for purpose of wrapper
This commit is contained in:
committed by
Richard Brice
parent
909978c941
commit
c1a6d8f347
@@ -75,3 +75,9 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonom
|
||||
}
|
||||
return r.size() > s;
|
||||
}
|
||||
|
||||
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs) {
|
||||
auto expl = item->evaluate();
|
||||
expl->instance = item->instance;
|
||||
return convert(expl, cs);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ifcopenshell { namespace geometry { namespace kernels {
|
||||
virtual bool convert_impl(const taxonomy::surface_curve_sweep::ptr, IfcGeom::ConversionResults&) { throw std::runtime_error("Not implemented"); }
|
||||
virtual bool convert_impl(const taxonomy::loft::ptr, IfcGeom::ConversionResults&) { throw std::runtime_error("Not implemented"); }
|
||||
virtual bool convert_impl(const taxonomy::collection::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs) { return convert(item->evaluate(), cs); }
|
||||
virtual bool convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs);
|
||||
|
||||
/*
|
||||
virtual void set_offset(const std::array<double, 3> &p_offset);
|
||||
|
||||
@@ -356,6 +356,21 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
|
||||
);
|
||||
}
|
||||
|
||||
IfcGeom::ConversionResults ifcopenshell::geometry::Converter::convert(IfcUtil::IfcBaseClass * item)
|
||||
{
|
||||
std::clock_t map_start = std::clock();
|
||||
auto geom_item = mapping_->map(item);
|
||||
IfcGeom::ConversionResults results;
|
||||
if (geom_item) {
|
||||
std::clock_t geom_start = std::clock();
|
||||
kernel_->convert(geom_item, results);
|
||||
std::clock_t geom_end = std::clock();
|
||||
total_map_time += (geom_start - map_start) / (double) CLOCKS_PER_SEC;
|
||||
total_geom_time += (geom_end - geom_start) / (double) CLOCKS_PER_SEC;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
//#include "../../ifcparse/Ifc2x3.h"
|
||||
//#include "../../ifcparse/Ifc4.h"
|
||||
//
|
||||
|
||||
+1
-11
@@ -44,17 +44,7 @@ namespace ifcopenshell { namespace geometry {
|
||||
double total_map_time = 0.;
|
||||
double total_geom_time = 0.;
|
||||
|
||||
IfcGeom::ConversionResults convert(IfcUtil::IfcBaseClass* item) {
|
||||
std::clock_t map_start = std::clock();
|
||||
auto geom_item = mapping_->map(item);
|
||||
std::clock_t geom_start = std::clock();
|
||||
IfcGeom::ConversionResults results;
|
||||
kernel_->convert(geom_item, results);
|
||||
std::clock_t geom_end = std::clock();
|
||||
total_map_time += (geom_start - map_start) / (double) CLOCKS_PER_SEC;
|
||||
total_geom_time += (geom_end - geom_start) / (double) CLOCKS_PER_SEC;
|
||||
return results;
|
||||
}
|
||||
IfcGeom::ConversionResults convert(IfcUtil::IfcBaseClass* item);
|
||||
|
||||
IfcGeom::BRepElement* create_brep_for_representation_and_product(const IfcUtil::IfcBaseEntity* representation, const IfcUtil::IfcBaseEntity* product);
|
||||
// IfcGeom::BRepElement* create_brep_for_processed_representation(const IfcUtil::IfcBaseEntity* representation, const IfcUtil::IfcBaseEntity* product, IfcGeom::BRepElement* brep);
|
||||
|
||||
@@ -138,6 +138,7 @@ public:
|
||||
bool convert(const taxonomy::solid::ptr, TopoDS_Shape&);
|
||||
bool convert(const taxonomy::bspline_surface::ptr bs, Handle(Geom_Surface) surf);
|
||||
|
||||
virtual bool convert_impl(const taxonomy::loop::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::face::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::solid::ptr, IfcGeom::ConversionResults&);
|
||||
virtual bool convert_impl(const taxonomy::shell::ptr, IfcGeom::ConversionResults&);
|
||||
|
||||
@@ -240,4 +240,18 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
|
||||
wire = bld.wire();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenCascadeKernel::convert_impl(const taxonomy::loop::ptr loop, IfcGeom::ConversionResults& results) {
|
||||
TopoDS_Wire shape;
|
||||
if (!convert(loop, shape)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
results.emplace_back(ConversionResult(
|
||||
loop->instance->data().id(),
|
||||
new OpenCascadeShape(shape),
|
||||
loop->surface_style
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,9 +88,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* inst) {
|
||||
aggregate_of_instance::ptr profile = inst->data().getInverse(&IfcSchema::IfcProfileDef::Class(), -1);
|
||||
const bool force_close = profile && profile->size() > 0;
|
||||
loop->closed = force_close;
|
||||
loop->instance = inst;
|
||||
return loop;
|
||||
}
|
||||
else {
|
||||
pwf->instance = inst;
|
||||
return pwf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +455,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCurveSegment* inst) {
|
||||
// @todo it might be suboptimal that we no longer have the spans now
|
||||
auto pwf = taxonomy::make<taxonomy::piecewise_function>();
|
||||
pwf->spans.push_back({ length, fn_transformed });
|
||||
pwf->instance = inst;
|
||||
return pwf;
|
||||
|
||||
/*
|
||||
|
||||
@@ -70,6 +70,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve* inst) {
|
||||
|
||||
auto pwf = taxonomy::make<taxonomy::piecewise_function>();
|
||||
pwf->spans.emplace_back( min_length, composition );
|
||||
pwf->instance = inst;
|
||||
return pwf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user