From dd4902be1872dca8ddf7ce3e87ad6d97e5aca195 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 24 Nov 2020 06:25:57 +0100 Subject: [PATCH 1/3] bimtester: fix licence header --- src/ifcbimtester/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ifcbimtester/__init__.py b/src/ifcbimtester/__init__.py index 866cf19fa6..29bbd67ef2 100644 --- a/src/ifcbimtester/__init__.py +++ b/src/ifcbimtester/__init__.py @@ -1,8 +1,6 @@ # *************************************************************************** # * Copyright (c) 2020 Bernd Hahnebach * # * * -# * This file is part of the FreeCAD CAx development system. * -# * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * From b1c4481795445de3c91b2557048607ef269c4d6e Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 24 Nov 2020 16:58:05 +0100 Subject: [PATCH 2/3] Option to disable boolean results (sets result to first operand) --- src/ifcconvert/IfcConvert.cpp | 5 +++++ src/ifcgeom/IfcGeom.h | 10 ++++++++++ src/ifcgeom/IfcGeomFunctions.cpp | 5 +++++ src/ifcgeom/IfcGeomIteratorImplementation.h | 5 +++++ src/ifcgeom/IfcGeomIteratorSettings.h | 4 +++- src/ifcgeom/IfcGeomShapes.cpp | 5 +++++ src/ifcgeom_schema_agnostic/Kernel.h | 3 ++- 7 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index f5f6c44346..c75ce4ffd0 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -289,6 +289,9 @@ int main(int argc, char** argv) { ("disable-opening-subtractions", "Specifies whether to disable the boolean subtraction of " "IfcOpeningElement Representations from their RelatingElements.") + ("disable-boolean-results", + "Specifies whether to disable the boolean operation within representations " + "such as clippings by means of IfcBooleanResult and subtypes") ("enable-layerset-slicing", "Specifies whether to enable the slicing of products according " "to their associated IfcMaterialLayerSet.") @@ -445,6 +448,7 @@ int main(int argc, char** argv) { const bool merge_boolean_operands = vmap.count("merge-boolean-operands") != 0; #endif const bool disable_opening_subtractions = vmap.count("disable-opening-subtractions") != 0; + const bool disable_boolean_results = vmap.count("disable-boolean-results") != 0; 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; @@ -713,6 +717,7 @@ int main(int argc, char** argv) { settings.set(IfcGeom::IteratorSettings::FASTER_BOOLEANS, merge_boolean_operands); #endif settings.set(IfcGeom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS, disable_opening_subtractions); + settings.set(IfcGeom::IteratorSettings::DISABLE_BOOLEAN_RESULT, disable_boolean_results); 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); diff --git a/src/ifcgeom/IfcGeom.h b/src/ifcgeom/IfcGeom.h index a1852aab22..ada7140745 100644 --- a/src/ifcgeom/IfcGeom.h +++ b/src/ifcgeom/IfcGeom.h @@ -229,6 +229,8 @@ private: const IfcParse::declaration* placement_rel_to; faceset_helper* faceset_helper_; + double disable_boolean_result; + gp_Vec offset = gp_Vec{0.0, 0.0, 0.0}; gp_Quaternion rotation = gp_Quaternion{}; gp_Trsf offset_and_rotation = gp_Trsf(); @@ -252,6 +254,8 @@ public: , dimensionality(1.) , placement_rel_to(nullptr) , faceset_helper_(nullptr) + , layerset_first(-1.) + , disable_boolean_result(-1.) {} MAKE_TYPE_NAME(Kernel)(const MAKE_TYPE_NAME(Kernel)& other) @@ -265,6 +269,9 @@ public: , placement_rel_to(other.placement_rel_to) // @nb faceset_helper_ always initialized to 0 , faceset_helper_(nullptr) + , layerset_first(other.layerset_first) + , disable_boolean_result(other.disable_boolean_result) + , offset(other.offset) , rotation(other.rotation) , offset_and_rotation(other.offset_and_rotation) @@ -279,6 +286,9 @@ public: modelling_precision = other.modelling_precision; dimensionality = other.dimensionality; placement_rel_to = other.placement_rel_to; + layerset_first = other.layerset_first; + disable_boolean_result = other.disable_boolean_result; + offset = other.offset; rotation = other.rotation; offset_and_rotation = other.offset_and_rotation; diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 5444aa7a17..81385c8c5f 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -1412,6 +1412,9 @@ void IfcGeom::Kernel::setValue(GeomValue var, double value) { case GV_LAYERSET_FIRST: layerset_first = value; break; + case GV_DISABLE_BOOLEAN_RESULT: + disable_boolean_result = value; + break; default: throw std::runtime_error("Invalid setting"); } @@ -1439,6 +1442,8 @@ double IfcGeom::Kernel::getValue(GeomValue var) const { return max_faces_to_orient; case GV_LAYERSET_FIRST: return layerset_first; + case GV_DISABLE_BOOLEAN_RESULT: + return disable_boolean_result; } throw std::runtime_error("Invalid setting"); } diff --git a/src/ifcgeom/IfcGeomIteratorImplementation.h b/src/ifcgeom/IfcGeomIteratorImplementation.h index 172f19a837..590a2c16c5 100644 --- a/src/ifcgeom/IfcGeomIteratorImplementation.h +++ b/src/ifcgeom/IfcGeomIteratorImplementation.h @@ -1003,6 +1003,11 @@ namespace IfcGeom { ? +1.0 : -1.0 ); + kernel.setValue(IfcGeom::Kernel::GV_DISABLE_BOOLEAN_RESULT, + settings.get(IteratorSettings::DISABLE_BOOLEAN_RESULT) + ? +1.0 + : -1.0 + ); if (settings.get(IteratorSettings::BUILDING_LOCAL_PLACEMENT)) { if (settings.get(IteratorSettings::SITE_LOCAL_PLACEMENT)) { diff --git a/src/ifcgeom/IfcGeomIteratorSettings.h b/src/ifcgeom/IfcGeomIteratorSettings.h index 3de57e3c41..d0c57f6381 100644 --- a/src/ifcgeom/IfcGeomIteratorSettings.h +++ b/src/ifcgeom/IfcGeomIteratorSettings.h @@ -92,8 +92,10 @@ namespace IfcGeom LAYERSET_FIRST = 1 << 18, /// Adds arrow heads to edge segments to signify edge direction EDGE_ARROWS = 1 << 19, + /// Disables the evaluation of IfcBooleanResult and simply returns FirstOperand + DISABLE_BOOLEAN_RESULT = 1 << 20, /// Number of different setting flags. - NUM_SETTINGS = 19 + NUM_SETTINGS = 20 }; /// Used to store logical OR combination of setting flags. typedef unsigned SettingField; diff --git a/src/ifcgeom/IfcGeomShapes.cpp b/src/ifcgeom/IfcGeomShapes.cpp index e205ae0037..84fa4fea17 100644 --- a/src/ifcgeom/IfcGeomShapes.cpp +++ b/src/ifcgeom/IfcGeomShapes.cpp @@ -604,6 +604,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcBooleanResult* l, TopoDS_Shape return false; } + if (getValue(GV_DISABLE_BOOLEAN_RESULT) > 0.0) { + shape = s1; + return true; + } + const double first_operand_volume = shape_volume(s1); if (first_operand_volume <= ALMOST_ZERO) { Logger::Message(Logger::LOG_WARNING, "Empty solid for:", l->FirstOperand()); diff --git a/src/ifcgeom_schema_agnostic/Kernel.h b/src/ifcgeom_schema_agnostic/Kernel.h index 89795bc01f..cabe346f62 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.h +++ b/src/ifcgeom_schema_agnostic/Kernel.h @@ -53,7 +53,8 @@ namespace IfcGeom { GV_PRECISION, // Whether to process shapes of type Face or higher (1) Wire or lower (-1) or all (0) GV_DIMENSIONALITY, - GV_LAYERSET_FIRST + GV_LAYERSET_FIRST, + GV_DISABLE_BOOLEAN_RESULT }; Kernel(IfcParse::IfcFile* file_ = 0); From 7ec91728be629ac9ef5ec7233cbf94578c066cf1 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 24 Nov 2020 12:21:47 +0100 Subject: [PATCH 3/3] bimtester: remove the just added licence headers to avoid any confusion --- src/ifcbimtester/__init__.py | 21 --------------------- src/ifcbimtester/bimtester.py | 22 ---------------------- src/ifcbimtester/clean.py | 21 --------------------- src/ifcbimtester/guiwidget.py | 21 --------------------- src/ifcbimtester/reports.py | 22 ---------------------- src/ifcbimtester/run.py | 22 ---------------------- 6 files changed, 129 deletions(-) diff --git a/src/ifcbimtester/__init__.py b/src/ifcbimtester/__init__.py index 29bbd67ef2..6668cc83ff 100644 --- a/src/ifcbimtester/__init__.py +++ b/src/ifcbimtester/__init__.py @@ -1,24 +1,3 @@ -# *************************************************************************** -# * Copyright (c) 2020 Bernd Hahnebach * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - from os.path import dirname from os.path import realpath diff --git a/src/ifcbimtester/bimtester.py b/src/ifcbimtester/bimtester.py index 40be8598b6..8043d9040b 100644 --- a/src/ifcbimtester/bimtester.py +++ b/src/ifcbimtester/bimtester.py @@ -1,27 +1,5 @@ #!/usr/bin/env python3 -# *************************************************************************** -# * Copyright (c) 2020 Dion Moult <> * -# * Copyright (c) 2020 Bernd Hahnebach * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - # Bernd: IMHO, this should go one lever up, # or all other code should go one level down # https://stackoverflow.com/questions/16981921/relative-imports-in-python-3 diff --git a/src/ifcbimtester/clean.py b/src/ifcbimtester/clean.py index 2efe7d4f09..452698500f 100644 --- a/src/ifcbimtester/clean.py +++ b/src/ifcbimtester/clean.py @@ -1,24 +1,3 @@ -# *************************************************************************** -# * Copyright (c) 2020 Dion Moult <> * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - import ifcopenshell import os from pathlib import Path diff --git a/src/ifcbimtester/guiwidget.py b/src/ifcbimtester/guiwidget.py index 9fe2962e21..7115da342c 100644 --- a/src/ifcbimtester/guiwidget.py +++ b/src/ifcbimtester/guiwidget.py @@ -1,24 +1,3 @@ -# *************************************************************************** -# * Copyright (c) 2020 Bernd Hahnebach * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - # TODO: improve layout, start with feature file path and beside button !!!!! # TODO: if browse widgets will be canceled, last QLineEdit should be restored diff --git a/src/ifcbimtester/reports.py b/src/ifcbimtester/reports.py index 74f7482176..cc6a09373f 100644 --- a/src/ifcbimtester/reports.py +++ b/src/ifcbimtester/reports.py @@ -1,25 +1,3 @@ -# *************************************************************************** -# * Copyright (c) 2020 Dion Moult <> * -# * Copyright (c) 2020 Bernd Hahnebach * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - import datetime import json import os diff --git a/src/ifcbimtester/run.py b/src/ifcbimtester/run.py index 57f73a1c71..0673dec275 100644 --- a/src/ifcbimtester/run.py +++ b/src/ifcbimtester/run.py @@ -1,25 +1,3 @@ -# *************************************************************************** -# * Copyright (c) 2020 Dion Moult <> * -# * Copyright (c) 2020 Bernd Hahnebach * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - from behave.__main__ import main as behave_main import behave.formatter.pretty # Needed for pyinstaller to package it import os