mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
Support for --deflection-tolerance
This commit is contained in:
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
|
|||||||
("output-file", boost::program_options::value<std::string>(), "output geometry file");
|
("output-file", boost::program_options::value<std::string>(), "output geometry file");
|
||||||
|
|
||||||
std::vector<std::string> entity_vector/*, names*/;
|
std::vector<std::string> entity_vector/*, names*/;
|
||||||
//double deflection_tolerance;
|
double deflection_tolerance;
|
||||||
boost::program_options::options_description geom_options;
|
boost::program_options::options_description geom_options;
|
||||||
geom_options.add_options()
|
geom_options.add_options()
|
||||||
("plan",
|
("plan",
|
||||||
@@ -181,8 +181,8 @@ int main(int argc, char** argv) {
|
|||||||
"Disables computation of normals. Saves time and file size and is useful "
|
"Disables computation of normals. Saves time and file size and is useful "
|
||||||
"in instances where you're going to recompute normals for the exported "
|
"in instances where you're going to recompute normals for the exported "
|
||||||
"model in other modelling application in any case.")
|
"model in other modelling application in any case.")
|
||||||
/*("deflection-tolerance", boost::program_options::value<double>(&deflection_tolerance),
|
("deflection-tolerance", boost::program_options::value<double>(&deflection_tolerance),
|
||||||
"Sets the deflection tolerance of the mesher, 1e-3 by default if not specified.")*/;
|
"Sets the deflection tolerance of the mesher, 1e-3 by default if not specified.");
|
||||||
|
|
||||||
std::string bounds;
|
std::string bounds;
|
||||||
boost::program_options::options_description serializer_options;
|
boost::program_options::options_description serializer_options;
|
||||||
@@ -264,7 +264,7 @@ int main(int argc, char** argv) {
|
|||||||
const bool no_normals = vmap.count("no-normals") != 0 ;
|
const bool no_normals = vmap.count("no-normals") != 0 ;
|
||||||
bool center_model = vmap.count("center-model") != 0 ;
|
bool center_model = vmap.count("center-model") != 0 ;
|
||||||
//const bool generate_uvs = vmap.count("generate-uvs") != 0 ;
|
//const bool generate_uvs = vmap.count("generate-uvs") != 0 ;
|
||||||
//const bool deflection_tolerance_specified = vmap.count("deflection-tolerance") != 0 ;
|
const bool deflection_tolerance_specified = vmap.count("deflection-tolerance") != 0 ;
|
||||||
boost::optional<int> bounding_width, bounding_height;
|
boost::optional<int> bounding_width, bounding_height;
|
||||||
if (vmap.count("bounds") == 1) {
|
if (vmap.count("bounds") == 1) {
|
||||||
int w, h;
|
int w, h;
|
||||||
@@ -347,8 +347,9 @@ int main(int argc, char** argv) {
|
|||||||
settings.set(IfcGeom::IteratorSettings::NO_NORMALS, no_normals);
|
settings.set(IfcGeom::IteratorSettings::NO_NORMALS, no_normals);
|
||||||
settings.set(IfcGeom::IteratorSettings::CENTER_MODEL, center_model);
|
settings.set(IfcGeom::IteratorSettings::CENTER_MODEL, center_model);
|
||||||
//settings.set(IfcGeom::IteratorSettings::GENERATE_UVS, generate_uvs);
|
//settings.set(IfcGeom::IteratorSettings::GENERATE_UVS, generate_uvs);
|
||||||
//if (deflection_tolerance_specified)
|
if (deflection_tolerance_specified) {
|
||||||
// settings.set_deflection_tolerance(deflection_tolerance);
|
settings.set_deflection_tolerance(deflection_tolerance);
|
||||||
|
}
|
||||||
|
|
||||||
GeometrySerializer* serializer;
|
GeometrySerializer* serializer;
|
||||||
if (output_extension == ".obj") {
|
if (output_extension == ".obj") {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define IFCGEOMITERATORSETTINGS_H
|
#define IFCGEOMITERATORSETTINGS_H
|
||||||
|
|
||||||
#include "../ifcparse/IfcException.h"
|
#include "../ifcparse/IfcException.h"
|
||||||
|
#include "../ifcparse/IfcUtil.h"
|
||||||
|
|
||||||
namespace IfcGeom
|
namespace IfcGeom
|
||||||
{
|
{
|
||||||
@@ -103,8 +104,17 @@ namespace IfcGeom
|
|||||||
|
|
||||||
/// Note that this is independent of the IFC length unit, one millimeter by default.
|
/// Note that this is independent of the IFC length unit, one millimeter by default.
|
||||||
double deflection_tolerance() const { return deflection_tolerance_; }
|
double deflection_tolerance() const { return deflection_tolerance_; }
|
||||||
/// @todo Sanity check for the value
|
|
||||||
void set_deflection_tolerance(double value) { deflection_tolerance_ = value; }
|
void set_deflection_tolerance(double value)
|
||||||
|
{
|
||||||
|
/// @todo Using deflection tolerance of 1e-6 or smaller hangs the conversion, research more in-depth.
|
||||||
|
/// This bug can be reproduced e.g. with the Duplex model that can be found from http://www.nibs.org/?page=bsa_commonbimfiles#project1
|
||||||
|
deflection_tolerance_ = value;
|
||||||
|
if (deflection_tolerance_ <= 1e-6) {
|
||||||
|
Logger::Message(Logger::LOG_WARNING, "Deflection tolerance cannot be set to <= 1e-6, using default 1e-3");
|
||||||
|
deflection_tolerance_ = 1e-3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get boolean value for a single settings or for a combination of settings.
|
/// Get boolean value for a single settings or for a combination of settings.
|
||||||
bool get(SettingField setting) const
|
bool get(SettingField setting) const
|
||||||
|
|||||||
Reference in New Issue
Block a user