mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
bimtester: example steps, delete the ones which are implemented already
This commit is contained in:
@@ -3,13 +3,6 @@ from behave import step, given, when, then, use_step_matcher
|
|||||||
use_step_matcher("parse")
|
use_step_matcher("parse")
|
||||||
|
|
||||||
|
|
||||||
@step("There must be exactly {number} {ifc_class} element")
|
|
||||||
@step("There must be exactly {number} {ifc_class} elements")
|
|
||||||
def step_impl(context, number, ifc_class):
|
|
||||||
num = len(IfcStore.file.by_type(ifc_class))
|
|
||||||
assert num == int(number), "Could not find {} elements of {}. Found {} element(s).".format(number, ifc_class, num)
|
|
||||||
|
|
||||||
|
|
||||||
@given("a set of specific related elements")
|
@given("a set of specific related elements")
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
model = getattr(context, "model", None)
|
model = getattr(context, "model", None)
|
||||||
|
|||||||
@@ -9,34 +9,6 @@ from utils import switch_locale
|
|||||||
the_lang = "en"
|
the_lang = "en"
|
||||||
|
|
||||||
|
|
||||||
@step("All elements must be under {number} polygons")
|
|
||||||
def step_impl(context, number):
|
|
||||||
number = int(number)
|
|
||||||
errors = []
|
|
||||||
for element in IfcFile.get().by_type("IfcElement"):
|
|
||||||
if not element.Representation:
|
|
||||||
continue
|
|
||||||
total_polygons = 0
|
|
||||||
tree = IfcFile.get().traverse(element.Representation)
|
|
||||||
for e in tree:
|
|
||||||
if e.is_a("IfcFace"):
|
|
||||||
total_polygons += 1
|
|
||||||
elif e.is_a("IfcPolygonalFaceSet"):
|
|
||||||
total_polygons += len(e.Faces)
|
|
||||||
elif e.is_a("IfcTriangulatedFaceSet"):
|
|
||||||
total_polygons += len(e.CoordIndex)
|
|
||||||
if total_polygons > number:
|
|
||||||
errors.append((total_polygons, element))
|
|
||||||
if errors:
|
|
||||||
message = (
|
|
||||||
"The following {} elements are over 500 polygons:\n"
|
|
||||||
.format(len(errors))
|
|
||||||
)
|
|
||||||
for error in errors:
|
|
||||||
message += "Polygons: {} - {}\n".format(error[0], error[1])
|
|
||||||
assert False, message
|
|
||||||
|
|
||||||
|
|
||||||
@step("all {ifc_class} elements have an {representation_class} representation")
|
@step("all {ifc_class} elements have an {representation_class} representation")
|
||||||
def step_impl(context, ifc_class, representation_class):
|
def step_impl(context, ifc_class, representation_class):
|
||||||
switch_locale(context.localedir, the_lang)
|
switch_locale(context.localedir, the_lang)
|
||||||
|
|||||||
Reference in New Issue
Block a user