Skip to content

Commit b025a6d

Browse files
all BHA changes
1 parent 8d079ce commit b025a6d

File tree

59 files changed

+4920
-971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4920
-971
lines changed

src/ifcbimtester/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Languages supported include (in alphabetical order):
3636

3737
If you are not a developer, we highly recommend simply installing an integrated version of BIMTester.
3838

39-
* If you use Blender, install the [Bonsai](https://bonsaibim.org)
39+
* If you use Blender, install the [BlenderBIM Add-on](https://blenderbim.org)
4040
* If you use FreeCAD, install the [FreeCAD BIMTester Workbench](https://github.com/bimtester/bimtesterfc)
4141

4242
If you are a developer, read on!
Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
from os.path import dirname
202
from os.path import realpath
213

22-
__version__ = version = "0.0.0"
234

245
package_path = dirname(realpath(__file__))

src/ifcbimtester/bimtester/clean.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
import ifcopenshell
202
import os
213
from pathlib import Path
Lines changed: 128 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
import os
202
from behave.model import Scenario
213

@@ -38,26 +20,55 @@ def before_all(context):
3820
if context.config.lang:
3921
switch_locale(context.locale_dir, context.config.lang)
4022

41-
continue_after_failed = userdata.getbool("runner.continue_after_failed_step", True)
42-
Scenario.continue_after_failed_step = continue_after_failed
23+
# continue_after_failed = userdata.getbool("runner.continue_after_failed_step", True)
24+
Scenario.continue_after_failed_step = False
25+
# for some Scenarios True would be better, may be dependend on the Scenario name as a workaround
4326

4427
# context.ifc_path = userdata.get("ifc", "")
45-
context.ifcfile_basename = os.path.basename(os.path.splitext(userdata["ifc"])[0])
28+
context.ifcfile_basename = os.path.basename(
29+
os.path.splitext(userdata["ifc"])[0]
30+
)
4631
context.outpath = os.path.join(this_path, "..")
47-
context.create_log = False
48-
context.create_smartview = False
32+
context.create_log = True
33+
context.create_smartview = True
4934

5035
if context.create_log is True:
5136
# set up log file
52-
context.thelogfile = os.path.join(context.outpath, context.ifcfile_basename + ".log")
37+
context.thelogfile = os.path.join(
38+
context.outpath,
39+
context.ifcfile_basename + ".log"
40+
)
5341
create_logfile(
5442
context.thelogfile,
5543
context.ifcfile_basename,
5644
)
5745

46+
# we have to use a dict to preserve the contents
47+
# https://stackoverflow.com/a/67606164
48+
context.skip_all_other_features = {"skip": False}
49+
50+
# elements count container
51+
context.elecount_data = []
52+
53+
54+
def after_all(context):
55+
import json
56+
# print(json.dumps(context.elecount_data, indent=4, ensure_ascii=False))
57+
import yaml
58+
yf = open(os.path.join(context.outpath, "elecount.yaml"), "w", encoding="utf-8")
59+
# yaml schreibt strings ohne quotes, heisst 1.0.0 wird dann als float wieder eingelesen
60+
# daher alle werte mit quote schreiben ... default_style='"'
61+
# https://stackoverflow.com/a/69850618
62+
yaml.safe_dump(context.elecount_data, yf, default_flow_style=False, allow_unicode=True, default_style='"')
63+
yaml.safe_dump(context.elecount_data, yf, default_flow_style=False, allow_unicode=True)
64+
yf.close()
65+
print("---E N D E---")
66+
5867

5968
def before_feature(context, feature):
6069

70+
print("Start feature: {}".format(feature.name))
71+
6172
# https://github.com/IfcOpenShell/IfcOpenShell/issues/1910#issuecomment-989732600
6273
# messages language, parsed by behaves lang argument
6374
print("Messages language: {}".format(context.config.lang))
@@ -74,19 +85,109 @@ def before_feature(context, feature):
7485
# TODO: refactor zoom smart view support into a decoupled module
7586
if context.create_smartview is True:
7687
smartview_name = context.ifcfile_basename + "_" + feature.name
77-
context.smview_file = os.path.join(context.outpath, smartview_name + ".bcsv")
88+
context.smview_file = os.path.join(
89+
context.outpath,
90+
smartview_name + ".bcsv"
91+
)
7892
# print("SmartView file: {}".format(context.smview_file))
7993
create_zoom_set_of_smartviews(
8094
context.smview_file,
8195
smartview_name,
8296
)
8397

98+
# print(context.skip_all_other_features)
99+
if context.skip_all_other_features["skip"] is True:
100+
feature.skip("Due to a failing feature all other features are skipped.")
101+
return
102+
# https://stackoverflow.com/a/42721605
103+
104+
105+
def after_feature(context, feature):
106+
print("After feature: {} --> {}".format(feature.name, feature.status))
107+
# print(str(feature.status))
108+
# print(context.skip_all_other_features)
109+
# TODO: mit userdata bei start bimtester uebergeben
110+
#
111+
# Wenn allplan feature nicht erfuellt ist, sofort abbruch
112+
#
113+
features_to_continue = [
114+
"681_Weitere",
115+
# "682_Modellpruefungen_FBJ_Weitere_allplan",
116+
"683_Modellpruefungen_FBJ_Weitere_bimtester",
117+
"684_Modellpruefungen_FBJ_Geomqualitaet_bimtester",
118+
"686_Modellpruefungen_TRW_Weitere_bimtester",
119+
"891_Projektpruefungen_Allg",
120+
# "892_Projektpruefungen_TRW_allplan",
121+
"893_Projektpruefungen_TRW_bimtester",
122+
# "899_Projektpruefungen_Name",
123+
]
124+
if str(feature.status) == "Status.failed" and feature.name not in features_to_continue:
125+
# print("set to skip all other features")
126+
context.skip_all_other_features["skip"] = True
127+
# print(context.skip_all_other_features)
128+
129+
130+
# workaround to finish specific scenarios
131+
finish_scenario = [
132+
"Geometrieabmessungen Mauerwerk",
133+
"Geometriefehler",
134+
"Geometriequalität",
135+
"Regextests",
136+
]
137+
def before_scenario(context, scenario):
138+
# print(scenario.name)
139+
if scenario.name in finish_scenario:
140+
Scenario.continue_after_failed_step = True
141+
context.open_step_counter = 0
142+
143+
144+
def after_scenario(context, scenario):
145+
# print(scenario.name)
146+
if scenario.name in finish_scenario:
147+
Scenario.continue_after_failed_step = False
148+
context.open_step_counter = 0
149+
150+
151+
def before_step(context, step):
152+
# print("{}".format(step.name))
153+
context.open_step_counter += 1
84154

85155
def after_step(context, step):
86156

87157
if step.status == "failed" and context.create_log is True:
88158
append_logfile(context, step)
89159

90-
if step.status == "failed" and context.create_smartview is True and hasattr(context, "falseguids"):
160+
# Workaround: introduce a open_step_counter
161+
# only if the counter of not finished steps is 1 create a smart view
162+
# see https://github.com/behave/behave/issues/992
163+
# the German step starts, calls the english step
164+
# the English starts, fails, closes,
165+
# than the German fails and closes
166+
# thus both steps fail, thus both are in the smart view file
167+
if (
168+
step.status == "failed"
169+
and context.create_smartview is True
170+
and hasattr(context, "falseguids")
171+
and context.open_step_counter == 1
172+
):
173+
# print("\nDBG: {}, {}\n".format(step.name, context.open_step_counter))
91174
# print(context.falseguids)
92-
add_smartview(context.smview_file, step.name, context.falseguids)
175+
add_smartview(
176+
context.smview_file,
177+
step.name,
178+
context.falseguids
179+
)
180+
181+
# elecount
182+
if hasattr(context, "elemcount"):
183+
count = context.elemcount
184+
else:
185+
count = None
186+
context.elecount_data.append([step.name, count])
187+
# zuordnung step json und step elecount anstatt ueber name auch mit location moeglich
188+
# siehe json und dort den location string
189+
# damit keine umlaute etc ...
190+
# print(step.location)
191+
192+
context.open_step_counter -= 1
193+
print("Finished step: {}".format(step.name))
Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
import json
202

213

@@ -38,7 +20,11 @@ def append_logfile(thecontext, step):
3820
logfile = open(thecontext.thelogfile, "a")
3921
logfile.write("\n\nStep '{}' failed\n".format(step.name))
4022
if hasattr(thecontext, "falseelems"):
41-
logfile.write("{}\n".format(json.dumps(thecontext.falseelems, indent=4)))
23+
logfile.write("{}\n".format(
24+
json.dumps(thecontext.falseelems, indent=4)
25+
))
4226
if hasattr(thecontext, "falseprops"):
43-
logfile.write("{}\n".format(json.dumps(thecontext.falseprops, indent=4)))
27+
logfile.write("{}\n".format(
28+
json.dumps(thecontext.falseprops, indent=4)
29+
))
4430
logfile.close()

src/ifcbimtester/bimtester/features/steps/aggregation/en.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
from behave import step, given, when, then, use_step_matcher
202

213
from bimtester import util
Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
1-
# BIMTester - OpenBIM Auditing Tool
2-
# Copyright (C) 2021 Dion Moult <[email protected]>
3-
#
4-
# This file is part of BIMTester.
5-
#
6-
# BIMTester is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
10-
#
11-
# BIMTester is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with BIMTester. If not, see <http://www.gnu.org/licenses/>.
18-
191
use_step_matcher("parse")
202
from bimtester.features.steps.aggregation import en
213

224
use_step_matcher("parse")
5+
from bimtester.features.steps.application import de
236
from bimtester.features.steps.application import en
247

258
use_step_matcher("parse")
26-
from bimtester.features.steps.attributes_eleclasses import de, en
9+
from bimtester.features.steps.attributes_eleclasses import de
10+
from bimtester.features.steps.attributes_eleclasses import en
2711

2812
use_step_matcher("parse")
29-
from bimtester.features.steps.attributes_psets import en, de
13+
from bimtester.features.steps.attributes_psets import de
14+
from bimtester.features.steps.attributes_psets import en
3015

3116
use_step_matcher("parse")
17+
from bimtester.features.steps.attributes_qsets import de
3218
from bimtester.features.steps.attributes_qsets import en
3319

3420
use_step_matcher("parse")
@@ -44,13 +30,30 @@
4430
from bimtester.features.steps.geolocation import en
4531

4632
use_step_matcher("parse")
47-
from bimtester.features.steps.geometric_detail import de, en
33+
from bimtester.features.steps.geometric_detail import de
34+
from bimtester.features.steps.geometric_detail import en
35+
36+
use_step_matcher("parse")
37+
from bimtester.features.steps.geometric_freecad import de
38+
from bimtester.features.steps.geometric_freecad import en
39+
40+
use_step_matcher("parse")
41+
from bimtester.features.steps.layer_and_style import de
42+
from bimtester.features.steps.layer_and_style import en
43+
44+
use_step_matcher("parse")
45+
from bimtester.features.steps.materials import de
46+
from bimtester.features.steps.materials import en
4847

4948
use_step_matcher("parse")
5049
from bimtester.features.steps.model_federation import en
5150

5251
use_step_matcher("parse")
53-
from bimtester.features.steps.project_setup import de, en, fr, it, nl
52+
from bimtester.features.steps.project_setup import de
53+
from bimtester.features.steps.project_setup import en
54+
from bimtester.features.steps.project_setup import fr
55+
from bimtester.features.steps.project_setup import it
56+
from bimtester.features.steps.project_setup import nl
5457

5558
use_step_matcher("parse")
5659
from bimtester.features.steps.spatial_structure import en
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from behave import step
2+
import ifcopenshell.util.element as eleutils
3+
4+
from behave import step
5+
from behave import use_step_matcher
6+
7+
from bimtester import util
8+
from bimtester.ifc import IfcStore
9+
from bimtester.lang import _
10+
11+
12+
@step('Die IFC-Datei wurde mit dem neuen Allplan Exporter erstellt. Das heisst der data header description hot folgenden Inhalt: "{target_header_file_description}"')
13+
def step_impl(context, target_header_file_description):
14+
context.execute_steps(f'* The ifc file has been exported with the new Allplan ifc exporter. This means the ifc file data header description is as follows: "{target_header_file_description}"')

0 commit comments

Comments
 (0)