mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Merge branch 'v0.6.0' of github.com:IfcOpenShell/IfcOpenShell into v0.6.0
This commit is contained in:
@@ -1,26 +1,3 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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 *
|
||||
# * 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
|
||||
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Dion Moult <> *
|
||||
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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
|
||||
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Dion Moult <> *
|
||||
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Dion Moult <> *
|
||||
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user