Skip to content

Commit afb05f4

Browse files
committed
Merge branch 'master' into v0.6.0
2 parents c8cca08 + 2a42a58 commit afb05f4

9 files changed

Lines changed: 42 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Instructions in a nutshell (**assuming Visual Studio 2015 x64 environment variab
4646
> build-deps.cmd
4747
> run-cmake.bat
4848

49+
NB: `build-deps.cmd` need to be ran from the directory containing it, i.e. the `./win` folder.
50+
4951
You can now open and build the solution file in Visual Studio:
5052

5153
> ..\build-vs2015-x64\IfcOpenShell.sln

src/ifcconvert/IfcConvert.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ int main(int argc, char** argv) {
269269
("enable-layerset-slicing",
270270
"Specifies whether to enable the slicing of products according "
271271
"to their associated IfcMaterialLayerSet.")
272+
("layerset-first", "Assigns the first layer material of the layerset "
273+
"to the complete product.")
272274
("include", po::value<inclusion_filter>(&include_filter)->multitoken(),
273275
"Specifies that the instances that match a specific filtering criteria are to be included in the geometrical output:\n"
274276
"1) 'entities': the following list of types should be included. SVG output defaults "
@@ -406,6 +408,7 @@ int main(int argc, char** argv) {
406408
const bool include_plan = vmap.count("plan") != 0;
407409
const bool include_model = vmap.count("model") != 0 || (!include_plan);
408410
const bool enable_layerset_slicing = vmap.count("enable-layerset-slicing") != 0;
411+
const bool layerset_first = vmap.count("layerset-first") != 0;
409412
const bool use_element_names = vmap.count("use-element-names") != 0;
410413
const bool use_element_guids = vmap.count("use-element-guids") != 0;
411414
const bool use_material_names = vmap.count("use-material-names") != 0;
@@ -644,6 +647,7 @@ int main(int argc, char** argv) {
644647
settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, include_plan);
645648
settings.set(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES, !include_model);
646649
settings.set(IfcGeom::IteratorSettings::APPLY_LAYERSETS, enable_layerset_slicing);
650+
settings.set(IfcGeom::IteratorSettings::LAYERSET_FIRST, layerset_first);
647651
settings.set(IfcGeom::IteratorSettings::NO_NORMALS, no_normals);
648652
settings.set(IfcGeom::IteratorSettings::GENERATE_UVS, generate_uvs);
649653
settings.set(IfcGeom::IteratorSettings::SEARCH_FLOOR, use_element_hierarchy || output_extension == SVG);

src/ifcgeom/IfcGeom.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ class IFC_GEOM_API MAKE_TYPE_NAME(Kernel) : public IfcGeom::Kernel {
221221
double ifc_planeangle_unit;
222222
double modelling_precision;
223223
double dimensionality;
224-
224+
double layerset_first;
225+
225226
#ifndef NO_CACHE
226227
MAKE_TYPE_NAME(Cache) cache;
227228
#endif
@@ -259,7 +260,7 @@ class IFC_GEOM_API MAKE_TYPE_NAME(Kernel) : public IfcGeom::Kernel {
259260
setValue(GV_PLANEANGLE_UNIT, other.getValue(GV_PLANEANGLE_UNIT));
260261
setValue(GV_PRECISION, other.getValue(GV_PRECISION));
261262
setValue(GV_DIMENSIONALITY, other.getValue(GV_DIMENSIONALITY));
262-
setValue(GV_DEFLECTION_TOLERANCE, other.getValue(GV_DEFLECTION_TOLERANCE));
263+
setValue(GV_LAYERSET_FIRST, other.getValue(GV_LAYERSET_FIRST));
263264
return *this;
264265
}
265266

src/ifcgeom/IfcGeomFunctions.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) {
13171317
case GV_MAX_FACES_TO_ORIENT:
13181318
max_faces_to_orient = value;
13191319
break;
1320+
case GV_LAYERSET_FIRST:
1321+
layerset_first = value;
1322+
break;
13201323
default:
13211324
throw std::runtime_error("Invalid setting");
13221325
}
@@ -1342,6 +1345,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const {
13421345
return dimensionality;
13431346
case GV_MAX_FACES_TO_ORIENT:
13441347
return max_faces_to_orient;
1348+
case GV_LAYERSET_FIRST:
1349+
return layerset_first;
13451350
}
13461351
throw std::runtime_error("Invalid setting");
13471352
}
@@ -1644,11 +1649,11 @@ const IfcSchema::IfcMaterial* IfcGeom::Kernel::get_single_material_association(c
16441649
IfcSchema::IfcMaterialSelect* associated_material = (*associated_materials->begin())->RelatingMaterial();
16451650
single_material = associated_material->as<IfcSchema::IfcMaterial>();
16461651

1647-
// NB: Single-layer layersets are also considered, regardless of --enable-layerset-slicing, this
1648-
// in accordance with other viewers.
1652+
// NB: IfcMaterialLayerSets are also considered, regardless of --enable-layerset-slicing. Picking
1653+
// the first material (in accordance with other viewers) when layerset-slicing is disabled.
16491654
if (!single_material && associated_material->as<IfcSchema::IfcMaterialLayerSetUsage>()) {
16501655
IfcSchema::IfcMaterialLayerSet* layerset = associated_material->as<IfcSchema::IfcMaterialLayerSetUsage>()->ForLayerSet();
1651-
if (layerset->MaterialLayers()->size() == 1) {
1656+
if (getValue(GV_LAYERSET_FIRST) > 0.0 ? layerset->MaterialLayers()->size() >= 1 : layerset->MaterialLayers()->size() == 1) {
16521657
IfcSchema::IfcMaterialLayer* layer = (*layerset->MaterialLayers()->begin());
16531658
if (layer->hasMaterial()) {
16541659
single_material = layer->Material();

src/ifcgeom/IfcGeomIteratorImplementation.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,12 @@ namespace IfcGeom {
971971
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_ORIENT, settings.get(IteratorSettings::SEW_SHELLS) ? std::numeric_limits<double>::infinity() : -1);
972972
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get(IteratorSettings::INCLUDE_CURVES)
973973
? (settings.get(IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1. : 0.) : +1.));
974+
kernel.setValue(IfcGeom::Kernel::GV_LAYERSET_FIRST,
975+
settings.get(IteratorSettings::LAYERSET_FIRST)
976+
? +1.0
977+
: -1.0
978+
);
979+
974980
if (settings.get(IteratorSettings::BUILDING_LOCAL_PLACEMENT)) {
975981
if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) {
976982
Logger::Message(Logger::LOG_WARNING, "building-local-placement takes precedence over site-local-placement");

src/ifcgeom/IfcGeomIteratorSettings.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ namespace IfcGeom
8686
BUILDING_LOCAL_PLACEMENT = 1 << 16,
8787
///
8888
VALIDATE_QUANTITIES = 1 << 17,
89+
/// Assigns the first layer material to the entire product
90+
LAYERSET_FIRST = 1 << 18,
8991
/// Number of different setting flags.
90-
NUM_SETTINGS = 17
92+
NUM_SETTINGS = 18
9193
};
9294
/// Used to store logical OR combination of setting flags.
9395
typedef unsigned SettingField;

src/ifcgeom_schema_agnostic/Kernel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ namespace IfcGeom {
4949
// Default: 0.00001 (obtained from IfcGeometricRepresentationContext if available)
5050
GV_PRECISION,
5151
// Whether to process shapes of type Face or higher (1) Wire or lower (-1) or all (0)
52-
GV_DIMENSIONALITY
52+
GV_DIMENSIONALITY,
53+
GV_LAYERSET_FIRST
5354
};
5455

5556
Kernel(IfcParse::IfcFile* file_ = 0);

src/ifcwrap/IfcGeomWrapper.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
325325
IfcGeom::Kernel kernel(file);
326326
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_ORIENT, settings.get(IfcGeom::IteratorSettings::SEW_SHELLS) ? std::numeric_limits<double>::infinity() : -1);
327327
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get(IfcGeom::IteratorSettings::INCLUDE_CURVES) ? (settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1. : 0.) : +1.));
328+
kernel.setValue(IfcGeom::Kernel::GV_LAYERSET_FIRST,
329+
settings.get(IteratorSettings::LAYERSET_FIRST)
330+
? +1.0
331+
: -1.0
332+
);
328333

329334
if (instance->declaration().is(Schema::IfcProduct::Class())) {
330335
if (representation) {

win/build-deps.cmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
@echo off
2525
echo.
2626

27+
for %%Q in ("%~dp0\.") DO set "batpath=%%~fQ"
28+
29+
if NOT "%CD%" == "%batpath%" (
30+
GOTO :ErrorAndPrintUsage
31+
)
32+
33+
2734
set PROJECT_NAME=IfcOpenShell
2835
call utils\cecho.cmd 15 0 "This script fetches and builds all %PROJECT_NAME% dependencies"
2936
echo.
@@ -535,3 +542,5 @@ echo - https://www.visualstudio.com/
535542
echo 5. Run this batch script with Visual Studio environment variables set.
536543
echo - https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx
537544
echo.
545+
echo NB: This script needs to be ran from the directory directly containing it.
546+
echo.

0 commit comments

Comments
 (0)