mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Merge remote-tracking branch 'refs/remotes/origin/v0.6.0' into v0.6.0
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ script:
|
|||||||
- /usr/local/bin/IfcConvert -yv acad2010_walls.ifc acad2010_walls.glb
|
- /usr/local/bin/IfcConvert -yv acad2010_walls.ifc acad2010_walls.glb
|
||||||
- gltf_validator acad2010_walls.glb
|
- gltf_validator acad2010_walls.glb
|
||||||
|
|
||||||
- python -c "from __future__ import print_function; from io import open; import ifcopenshell; f = ifcopenshell.open('encoding.ifc'); print(f[1][0], file=open('encoding.txt', 'w', encoding='utf-8'))" && grep "'a' 1m³ ≤ 5m³ ≥ 10m³" encoding.txt
|
- /usr/bin/python2.7 -c "from __future__ import print_function; from io import open; import ifcopenshell; f = ifcopenshell.open('encoding.ifc'); print(f[1][0], file=open('encoding.txt', 'w', encoding='utf-8'))" && grep "'a' 1m³ ≤ 5m³ ≥ 10m³" encoding.txt
|
||||||
|
|
||||||
- |
|
- |
|
||||||
(for i in *.ifc; do \
|
(for i in *.ifc; do \
|
||||||
|
|||||||
@@ -216,12 +216,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
double deflection_tolerance;
|
double deflection_tolerance;
|
||||||
|
double max_faces_to_orient;
|
||||||
double ifc_length_unit;
|
double ifc_length_unit;
|
||||||
double ifc_planeangle_unit;
|
double ifc_planeangle_unit;
|
||||||
double modelling_precision;
|
double modelling_precision;
|
||||||
double dimensionality;
|
double dimensionality;
|
||||||
double max_faces_to_orient;
|
|
||||||
|
|
||||||
#ifndef NO_CACHE
|
#ifndef NO_CACHE
|
||||||
MAKE_TYPE_NAME(Cache) cache;
|
MAKE_TYPE_NAME(Cache) cache;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ namespace IfcGeom {
|
|||||||
class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation<P, PP> {
|
class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation<P, PP> {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int num_threads_;
|
|
||||||
std::atomic<int> progress_;
|
std::atomic<int> progress_;
|
||||||
std::vector<geometry_conversion_task<P, PP>> tasks_;
|
std::vector<geometry_conversion_task<P, PP>> tasks_;
|
||||||
std::vector<IfcGeom::Element<P, PP>*> all_processed_elements_;
|
std::vector<IfcGeom::Element<P, PP>*> all_processed_elements_;
|
||||||
@@ -190,9 +189,12 @@ namespace IfcGeom {
|
|||||||
MAKE_TYPE_NAME(IteratorImplementation_)& operator=(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I
|
MAKE_TYPE_NAME(IteratorImplementation_)& operator=(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I
|
||||||
|
|
||||||
MAKE_TYPE_NAME(Kernel) kernel;
|
MAKE_TYPE_NAME(Kernel) kernel;
|
||||||
IteratorSettings settings;
|
|
||||||
|
|
||||||
|
IteratorSettings settings;
|
||||||
IfcParse::IfcFile* ifc_file;
|
IfcParse::IfcFile* ifc_file;
|
||||||
|
std::vector<filter_t> filters_;
|
||||||
|
bool owns_ifc_file;
|
||||||
|
int num_threads_;
|
||||||
|
|
||||||
// A container and iterator for IfcRepresentations
|
// A container and iterator for IfcRepresentations
|
||||||
IfcSchema::IfcRepresentation::list::ptr representations;
|
IfcSchema::IfcRepresentation::list::ptr representations;
|
||||||
@@ -219,8 +221,6 @@ namespace IfcGeom {
|
|||||||
gp_XYZ bounds_min_;
|
gp_XYZ bounds_min_;
|
||||||
gp_XYZ bounds_max_;
|
gp_XYZ bounds_max_;
|
||||||
|
|
||||||
std::vector<filter_t> filters_;
|
|
||||||
|
|
||||||
struct filter_match
|
struct filter_match
|
||||||
{
|
{
|
||||||
filter_match(IfcSchema::IfcProduct *prod) : product(prod) {}
|
filter_match(IfcSchema::IfcProduct *prod) : product(prod) {}
|
||||||
@@ -952,8 +952,7 @@ namespace IfcGeom {
|
|||||||
kernel.set_conversion_placement_rel_to(&IfcSchema::IfcSite::Class());
|
kernel.set_conversion_placement_rel_to(&IfcSchema::IfcSite::Class());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool owns_ifc_file;
|
|
||||||
public:
|
public:
|
||||||
MAKE_TYPE_NAME(IteratorImplementation_)(const IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads)
|
MAKE_TYPE_NAME(IteratorImplementation_)(const IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads)
|
||||||
: settings(settings)
|
: settings(settings)
|
||||||
|
|||||||
@@ -1165,7 +1165,7 @@ namespace {
|
|||||||
// @todo we could be extruding the wire only when we know this is an intermediate edge.
|
// @todo we could be extruding the wire only when we know this is an intermediate edge.
|
||||||
const double depth = std::abs(u - v);
|
const double depth = std::abs(u - v);
|
||||||
TopoDS_Face face = BRepBuilderAPI_MakeFace(section).Face();
|
TopoDS_Face face = BRepBuilderAPI_MakeFace(section).Face();
|
||||||
result = BRepPrimAPI_MakeRevol(section, circ->Axis(), v - u).Shape();
|
result = BRepPrimAPI_MakeRevol(section, circ->Axis(), depth).Shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_sweep_as_pipe(const TopoDS_Wire& wire, const TopoDS_Wire& section, TopoDS_Shape& result) {
|
void process_sweep_as_pipe(const TopoDS_Wire& wire, const TopoDS_Wire& section, TopoDS_Shape& result) {
|
||||||
@@ -1563,7 +1563,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
|
|||||||
BRep_Builder compound_builder;
|
BRep_Builder compound_builder;
|
||||||
compound_builder.MakeCompound(all_faces);
|
compound_builder.MakeCompound(all_faces);
|
||||||
|
|
||||||
for (int i = 0; i < polygonal_faces->size(); i++) {
|
for (unsigned i = 0; i < polygonal_faces->size(); i++) {
|
||||||
IfcSchema::IfcIndexedPolygonalFace* la = (IfcSchema::IfcIndexedPolygonalFace*)*(polygonal_faces->begin() + i);
|
IfcSchema::IfcIndexedPolygonalFace* la = (IfcSchema::IfcIndexedPolygonalFace*)*(polygonal_faces->begin() + i);
|
||||||
TopoDS_Face face;
|
TopoDS_Face face;
|
||||||
// Gives the indexed points defining the face
|
// Gives the indexed points defining the face
|
||||||
@@ -1573,8 +1573,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
|
|||||||
// points, sorted in order (cf BuildingSmart https://urlz.fr/aXN6)
|
// points, sorted in order (cf BuildingSmart https://urlz.fr/aXN6)
|
||||||
std::vector<gp_Pnt> face_points;
|
std::vector<gp_Pnt> face_points;
|
||||||
BRepBuilderAPI_MakePolygon wire_builder = BRepBuilderAPI_MakePolygon();
|
BRepBuilderAPI_MakePolygon wire_builder = BRepBuilderAPI_MakePolygon();
|
||||||
for (std::vector<int>::size_type i = 0; i != test.size(); i++) {
|
for (std::vector<int>::size_type j = 0; j != test.size(); j++) {
|
||||||
const gp_Pnt& point = points[test[i] - 1];
|
const gp_Pnt& point = points[test[j] - 1];
|
||||||
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(point);
|
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(point);
|
||||||
wire_builder.Add(vertex);
|
wire_builder.Add(vertex);
|
||||||
}
|
}
|
||||||
@@ -1591,8 +1591,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
|
|||||||
for (std::vector<std::vector<int> >::const_iterator it = innercoordinates.begin(); it != innercoordinates.end(); ++it) {
|
for (std::vector<std::vector<int> >::const_iterator it = innercoordinates.begin(); it != innercoordinates.end(); ++it) {
|
||||||
std::vector<int> mycoords = *it;
|
std::vector<int> mycoords = *it;
|
||||||
BRepBuilderAPI_MakePolygon inner_wire_builder = BRepBuilderAPI_MakePolygon();
|
BRepBuilderAPI_MakePolygon inner_wire_builder = BRepBuilderAPI_MakePolygon();
|
||||||
for (std::vector<int>::size_type i = 0; i != mycoords.size(); i++) {
|
for (std::vector<int>::size_type j = 0; j != mycoords.size(); j++) {
|
||||||
gp_Pnt apoint = points[mycoords[i] - 1];
|
gp_Pnt apoint = points[mycoords[j] - 1];
|
||||||
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(apoint);
|
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(apoint);
|
||||||
inner_wire_builder.Add(vertex);
|
inner_wire_builder.Add(vertex);
|
||||||
}
|
}
|
||||||
@@ -1621,8 +1621,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
|
|||||||
|
|
||||||
if (faces.empty()) return false;
|
if (faces.empty()) return false;
|
||||||
|
|
||||||
bool valid_shell = false;
|
|
||||||
|
|
||||||
TopTools_ListOfShape faces_list;
|
TopTools_ListOfShape faces_list;
|
||||||
for (std::vector<TopoDS_Face>::const_iterator it = faces.begin(); it != faces.end(); ++it) {
|
for (std::vector<TopoDS_Face>::const_iterator it = faces.begin(); it != faces.end(); ++it) {
|
||||||
faces_list.Append(*it);
|
faces_list.Append(*it);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
: OpenCascadeBasedSerializer(out_filename, settings)
|
: OpenCascadeBasedSerializer(out_filename, settings)
|
||||||
{}
|
{}
|
||||||
virtual ~IgesSerializer() {}
|
virtual ~IgesSerializer() {}
|
||||||
void writeShape(const TopoDS_Shape& shape) {
|
void writeShape(const std::string&, const TopoDS_Shape& shape) {
|
||||||
writer.AddShape(shape);
|
writer.AddShape(shape);
|
||||||
}
|
}
|
||||||
void finalize() {
|
void finalize() {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
|||||||
if (settings.get(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS) && settings.unit_magnitude() != 1.0) {
|
if (settings.get(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS) && settings.unit_magnitude() != 1.0) {
|
||||||
trsf.SetTranslationPart(trsf.TranslationPart() / settings.unit_magnitude());
|
trsf.SetTranslationPart(trsf.TranslationPart() / settings.unit_magnitude());
|
||||||
}
|
}
|
||||||
writeShape(compound.Moved(trsf));
|
writeShape(object_id(o), compound.Moved(trsf));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RATHER_SMALL (1e-3)
|
#define RATHER_SMALL (1e-3)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
virtual ~OpenCascadeBasedSerializer() {}
|
virtual ~OpenCascadeBasedSerializer() {}
|
||||||
void writeHeader() {}
|
void writeHeader() {}
|
||||||
bool ready();
|
bool ready();
|
||||||
virtual void writeShape(const TopoDS_Shape& shape) = 0;
|
virtual void writeShape(const std::string& name, const TopoDS_Shape& shape) = 0;
|
||||||
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
||||||
void write(const IfcGeom::BRepElement<real_t>* o);
|
void write(const IfcGeom::BRepElement<real_t>* o);
|
||||||
bool isTesselated() const { return false; }
|
bool isTesselated() const { return false; }
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ public:
|
|||||||
: OpenCascadeBasedSerializer(out_filename, settings)
|
: OpenCascadeBasedSerializer(out_filename, settings)
|
||||||
{}
|
{}
|
||||||
virtual ~StepSerializer() {}
|
virtual ~StepSerializer() {}
|
||||||
void writeShape(const TopoDS_Shape& shape) {
|
void writeShape(const std::string& name, const TopoDS_Shape& shape) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
std::streambuf *sb = std::cout.rdbuf(ss.rdbuf());
|
std::streambuf *sb = std::cout.rdbuf(ss.rdbuf());
|
||||||
|
Interface_Static::SetCVal("write.step.product.name", name.c_str());
|
||||||
writer.Transfer(shape, STEPControl_AsIs);
|
writer.Transfer(shape, STEPControl_AsIs);
|
||||||
std::cout.rdbuf(sb);
|
std::cout.rdbuf(sb);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user