mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Get BrepElement to triangulate + serialize from it
This commit is contained in:
@@ -806,6 +806,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
else if (output_extension == HDF) {
|
||||
const path_t mtl_filename = change_extension(output_filename, MTL);
|
||||
settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
|
||||
serializer = boost::make_shared<HdfSerializer>(IfcUtil::path::to_utf8(output_temp_filename), IfcUtil::path::to_utf8(output_filename), settings);
|
||||
}
|
||||
|
||||
@@ -1034,13 +1035,6 @@ int main(int argc, char** argv) {
|
||||
|
||||
IfcGeom::Element<real_t> *geom_object = context_iterator.get();
|
||||
|
||||
IfcGeom::Element<real_t> *open_object = context_iterator.get_native();
|
||||
IfcGeom::BRepElement<real_t>*elem = static_cast<IfcGeom::BRepElement<real_t>*>(open_object);
|
||||
const IfcGeom::Representation::BRep& brepmesh = elem->geometry();
|
||||
const IfcGeom::Representation::Serialization *serialization = new IfcGeom::Representation::Serialization(brepmesh);
|
||||
std::string dat = serialization->brep_data();
|
||||
|
||||
|
||||
if (is_tesselated)
|
||||
{
|
||||
serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object));
|
||||
|
||||
@@ -93,7 +93,7 @@ void HdfSerializer::writeHeader() {
|
||||
}
|
||||
|
||||
|
||||
void HdfSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
|
||||
void HdfSerializer::write(const IfcGeom::BRepElement<real_t>* o) {
|
||||
|
||||
std::string guid = o->guid();
|
||||
//Logger::Status(guid);
|
||||
@@ -101,13 +101,25 @@ void HdfSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
|
||||
//Logger::Status("\n");
|
||||
|
||||
H5::Group elementGroup;
|
||||
|
||||
H5::Group meshGroup;
|
||||
H5::DataSet positionsDataset;
|
||||
H5::DataSet normalsDataset;
|
||||
H5::DataSet indicesDataset;
|
||||
|
||||
H5::Group OCCTGroup;
|
||||
|
||||
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
|
||||
//const IfcGeom::BRepElement<real_t>*elem = static_cast<IfcGeom::BRepElement<real_t>*>(o);
|
||||
|
||||
|
||||
const IfcGeom::Representation::BRep& brepmesh = o->geometry();
|
||||
const IfcGeom::Representation::Serialization *serialization = new IfcGeom::Representation::Serialization(brepmesh);
|
||||
std::string brep_data = serialization->brep_data();
|
||||
|
||||
/*Logger::Status(brep_data);*/
|
||||
|
||||
const IfcGeom::TriangulationElement<real_t>*triangular_element = new IfcGeom::TriangulationElement<real_t>(*o);
|
||||
const IfcGeom::Representation::Triangulation<real_t>& mesh = triangular_element->geometry();
|
||||
const int vcount = (int)mesh.verts().size() / 3;
|
||||
const int fcount = (int)mesh.faces().size() / 3;
|
||||
const bool isyup = settings().get(SerializerSettings::USE_Y_UP);
|
||||
|
||||
@@ -54,10 +54,10 @@ public:
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void writeMaterial(const IfcGeom::Material& style);
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
void write(const IfcGeom::BRepElement<real_t>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<real_t>* o);
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
|
||||
void finalize() {}
|
||||
bool isTesselated() const { return true; }
|
||||
bool isTesselated() const { return false; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
void setFile(IfcParse::IfcFile*) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user