Merge remote-tracking branch 'refs/remotes/origin/v0.6.0' into v0.6.0

This commit is contained in:
Dion Moult
2020-03-19 10:35:07 +11:00
8 changed files with 19 additions and 21 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ script:
- /usr/local/bin/IfcConvert -yv acad2010_walls.ifc 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 \
+2 -2
View File
@@ -216,12 +216,12 @@ private:
};
double deflection_tolerance;
double max_faces_to_orient;
double ifc_length_unit;
double ifc_planeangle_unit;
double modelling_precision;
double dimensionality;
double max_faces_to_orient;
#ifndef NO_CACHE
MAKE_TYPE_NAME(Cache) cache;
#endif
+5 -6
View File
@@ -178,7 +178,6 @@ namespace IfcGeom {
class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation<P, PP> {
private:
int num_threads_;
std::atomic<int> progress_;
std::vector<geometry_conversion_task<P, PP>> tasks_;
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(Kernel) kernel;
IteratorSettings settings;
IteratorSettings settings;
IfcParse::IfcFile* ifc_file;
std::vector<filter_t> filters_;
bool owns_ifc_file;
int num_threads_;
// A container and iterator for IfcRepresentations
IfcSchema::IfcRepresentation::list::ptr representations;
@@ -219,8 +221,6 @@ namespace IfcGeom {
gp_XYZ bounds_min_;
gp_XYZ bounds_max_;
std::vector<filter_t> filters_;
struct filter_match
{
filter_match(IfcSchema::IfcProduct *prod) : product(prod) {}
@@ -952,8 +952,7 @@ namespace IfcGeom {
kernel.set_conversion_placement_rel_to(&IfcSchema::IfcSite::Class());
}
}
bool owns_ifc_file;
public:
MAKE_TYPE_NAME(IteratorImplementation_)(const IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads)
: settings(settings)
+6 -8
View File
@@ -1165,7 +1165,7 @@ namespace {
// @todo we could be extruding the wire only when we know this is an intermediate edge.
const double depth = std::abs(u - v);
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) {
@@ -1563,7 +1563,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
BRep_Builder compound_builder;
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);
TopoDS_Face 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)
std::vector<gp_Pnt> face_points;
BRepBuilderAPI_MakePolygon wire_builder = BRepBuilderAPI_MakePolygon();
for (std::vector<int>::size_type i = 0; i != test.size(); i++) {
const gp_Pnt& point = points[test[i] - 1];
for (std::vector<int>::size_type j = 0; j != test.size(); j++) {
const gp_Pnt& point = points[test[j] - 1];
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(point);
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) {
std::vector<int> mycoords = *it;
BRepBuilderAPI_MakePolygon inner_wire_builder = BRepBuilderAPI_MakePolygon();
for (std::vector<int>::size_type i = 0; i != mycoords.size(); i++) {
gp_Pnt apoint = points[mycoords[i] - 1];
for (std::vector<int>::size_type j = 0; j != mycoords.size(); j++) {
gp_Pnt apoint = points[mycoords[j] - 1];
TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(apoint);
inner_wire_builder.Add(vertex);
}
@@ -1621,8 +1621,6 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolygonalFaceSet* pfs, TopoDS_
if (faces.empty()) return false;
bool valid_shell = false;
TopTools_ListOfShape faces_list;
for (std::vector<TopoDS_Face>::const_iterator it = faces.begin(); it != faces.end(); ++it) {
faces_list.Append(*it);
+1 -1
View File
@@ -42,7 +42,7 @@ public:
: OpenCascadeBasedSerializer(out_filename, settings)
{}
virtual ~IgesSerializer() {}
void writeShape(const TopoDS_Shape& shape) {
void writeShape(const std::string&, const TopoDS_Shape& shape) {
writer.AddShape(shape);
}
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) {
trsf.SetTranslationPart(trsf.TranslationPart() / settings.unit_magnitude());
}
writeShape(compound.Moved(trsf));
writeShape(object_id(o), compound.Moved(trsf));
}
#define RATHER_SMALL (1e-3)
+1 -1
View File
@@ -38,7 +38,7 @@ public:
virtual ~OpenCascadeBasedSerializer() {}
void writeHeader() {}
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::BRepElement<real_t>* o);
bool isTesselated() const { return false; }
+2 -1
View File
@@ -36,9 +36,10 @@ public:
: OpenCascadeBasedSerializer(out_filename, settings)
{}
virtual ~StepSerializer() {}
void writeShape(const TopoDS_Shape& shape) {
void writeShape(const std::string& name, const TopoDS_Shape& shape) {
std::stringstream ss;
std::streambuf *sb = std::cout.rdbuf(ss.rdbuf());
Interface_Static::SetCVal("write.step.product.name", name.c_str());
writer.Transfer(shape, STEPControl_AsIs);
std::cout.rdbuf(sb);
}