Merge branch 'master' into v0.6.0

This commit is contained in:
Thomas Krijnen
2020-06-07 20:23:00 +02:00
9 changed files with 42 additions and 7 deletions
+4
View File
@@ -269,6 +269,8 @@ int main(int argc, char** argv) {
("enable-layerset-slicing",
"Specifies whether to enable the slicing of products according "
"to their associated IfcMaterialLayerSet.")
("layerset-first", "Assigns the first layer material of the layerset "
"to the complete product.")
("include", po::value<inclusion_filter>(&include_filter)->multitoken(),
"Specifies that the instances that match a specific filtering criteria are to be included in the geometrical output:\n"
"1) 'entities': the following list of types should be included. SVG output defaults "
@@ -406,6 +408,7 @@ int main(int argc, char** argv) {
const bool include_plan = vmap.count("plan") != 0;
const bool include_model = vmap.count("model") != 0 || (!include_plan);
const bool enable_layerset_slicing = vmap.count("enable-layerset-slicing") != 0;
const bool layerset_first = vmap.count("layerset-first") != 0;
const bool use_element_names = vmap.count("use-element-names") != 0;
const bool use_element_guids = vmap.count("use-element-guids") != 0;
const bool use_material_names = vmap.count("use-material-names") != 0;
@@ -644,6 +647,7 @@ int main(int argc, char** argv) {
settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, include_plan);
settings.set(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES, !include_model);
settings.set(IfcGeom::IteratorSettings::APPLY_LAYERSETS, enable_layerset_slicing);
settings.set(IfcGeom::IteratorSettings::LAYERSET_FIRST, layerset_first);
settings.set(IfcGeom::IteratorSettings::NO_NORMALS, no_normals);
settings.set(IfcGeom::IteratorSettings::GENERATE_UVS, generate_uvs);
settings.set(IfcGeom::IteratorSettings::SEARCH_FLOOR, use_element_hierarchy || output_extension == SVG);
+3 -2
View File
@@ -221,7 +221,8 @@ private:
double ifc_planeangle_unit;
double modelling_precision;
double dimensionality;
double layerset_first;
#ifndef NO_CACHE
MAKE_TYPE_NAME(Cache) cache;
#endif
@@ -259,7 +260,7 @@ public:
setValue(GV_PLANEANGLE_UNIT, other.getValue(GV_PLANEANGLE_UNIT));
setValue(GV_PRECISION, other.getValue(GV_PRECISION));
setValue(GV_DIMENSIONALITY, other.getValue(GV_DIMENSIONALITY));
setValue(GV_DEFLECTION_TOLERANCE, other.getValue(GV_DEFLECTION_TOLERANCE));
setValue(GV_LAYERSET_FIRST, other.getValue(GV_LAYERSET_FIRST));
return *this;
}
+8 -3
View File
@@ -1317,6 +1317,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) {
case GV_MAX_FACES_TO_ORIENT:
max_faces_to_orient = value;
break;
case GV_LAYERSET_FIRST:
layerset_first = value;
break;
default:
throw std::runtime_error("Invalid setting");
}
@@ -1342,6 +1345,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
return dimensionality;
case GV_MAX_FACES_TO_ORIENT:
return max_faces_to_orient;
case GV_LAYERSET_FIRST:
return layerset_first;
}
throw std::runtime_error("Invalid setting");
}
@@ -1644,11 +1649,11 @@ const IfcSchema::IfcMaterial* IfcGeom::Kernel::get_single_material_association(c
IfcSchema::IfcMaterialSelect* associated_material = (*associated_materials->begin())->RelatingMaterial();
single_material = associated_material->as<IfcSchema::IfcMaterial>();
// NB: Single-layer layersets are also considered, regardless of --enable-layerset-slicing, this
// in accordance with other viewers.
// NB: IfcMaterialLayerSets are also considered, regardless of --enable-layerset-slicing. Picking
// the first material (in accordance with other viewers) when layerset-slicing is disabled.
if (!single_material && associated_material->as<IfcSchema::IfcMaterialLayerSetUsage>()) {
IfcSchema::IfcMaterialLayerSet* layerset = associated_material->as<IfcSchema::IfcMaterialLayerSetUsage>()->ForLayerSet();
if (layerset->MaterialLayers()->size() == 1) {
if (getValue(GV_LAYERSET_FIRST) > 0.0 ? layerset->MaterialLayers()->size() >= 1 : layerset->MaterialLayers()->size() == 1) {
IfcSchema::IfcMaterialLayer* layer = (*layerset->MaterialLayers()->begin());
if (layer->hasMaterial()) {
single_material = layer->Material();
@@ -971,6 +971,12 @@ namespace IfcGeom {
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_ORIENT, settings.get(IteratorSettings::SEW_SHELLS) ? std::numeric_limits<double>::infinity() : -1);
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get(IteratorSettings::INCLUDE_CURVES)
? (settings.get(IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1. : 0.) : +1.));
kernel.setValue(IfcGeom::Kernel::GV_LAYERSET_FIRST,
settings.get(IteratorSettings::LAYERSET_FIRST)
? +1.0
: -1.0
);
if (settings.get(IteratorSettings::BUILDING_LOCAL_PLACEMENT)) {
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
Logger::Message(Logger::LOG_WARNING, "building-local-placement takes precedence over site-local-placement");
+3 -1
View File
@@ -86,8 +86,10 @@ namespace IfcGeom
BUILDING_LOCAL_PLACEMENT = 1 << 16,
///
VALIDATE_QUANTITIES = 1 << 17,
/// Assigns the first layer material to the entire product
LAYERSET_FIRST = 1 << 18,
/// Number of different setting flags.
NUM_SETTINGS = 17
NUM_SETTINGS = 18
};
/// Used to store logical OR combination of setting flags.
typedef unsigned SettingField;
+2 -1
View File
@@ -49,7 +49,8 @@ namespace IfcGeom {
// Default: 0.00001 (obtained from IfcGeometricRepresentationContext if available)
GV_PRECISION,
// Whether to process shapes of type Face or higher (1) Wire or lower (-1) or all (0)
GV_DIMENSIONALITY
GV_DIMENSIONALITY,
GV_LAYERSET_FIRST
};
Kernel(IfcParse::IfcFile* file_ = 0);
+5
View File
@@ -325,6 +325,11 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
IfcGeom::Kernel kernel(file);
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_ORIENT, settings.get(IfcGeom::IteratorSettings::SEW_SHELLS) ? std::numeric_limits<double>::infinity() : -1);
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get(IfcGeom::IteratorSettings::INCLUDE_CURVES) ? (settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1. : 0.) : +1.));
kernel.setValue(IfcGeom::Kernel::GV_LAYERSET_FIRST,
settings.get(IteratorSettings::LAYERSET_FIRST)
? +1.0
: -1.0
);
if (instance->declaration().is(Schema::IfcProduct::Class())) {
if (representation) {