This repository was archived by the owner on Nov 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/ifcbimtester/bimtester/features/steps Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from utils import IfcFile
44
5+ @step ('The IFC schema "{schema}" must be provided' )
6+ def step_impl (context , schema ):
7+ try :
8+ IfcFile .load_schema (schema )
9+ except :
10+ assert False
11+
512
613@step ('The IFC file "{file}" must be provided' )
714def step_impl (context , file ):
Original file line number Diff line number Diff line change 11import ifcopenshell
2+ import ifcopenshell .express
23import ifcopenshell .util
34import ifcopenshell .util .element
45
@@ -10,6 +11,13 @@ class IfcFile(object):
1011 @classmethod
1112 def load (cls , path = None ):
1213 cls .file = ifcopenshell .open (path )
14+ if not cls .file :
15+ assert False
16+
17+ @classmethod
18+ def load_schema (cls , path = None ):
19+ schema = ifcopenshell .express .parse (path )
20+ ifcopenshell .register_schema (schema )
1321
1422 @classmethod
1523 def get (cls ):
@@ -23,6 +31,17 @@ def by_guid(cls, guid):
2331 return cls .get ().by_guid (guid )
2432 except :
2533 assert False , "An element with the ID {} could not be found." .format (guid )
34+
35+ @classmethod
36+ def by_type (cls , ifc_type ):
37+ return cls .get ().by_type (ifc_type .strip ())
38+
39+ @classmethod
40+ def by_types (cls , ifc_types ):
41+ elements = []
42+ for ifc_type in ifc_types .split ("," ):
43+ elements += cls .by_type (ifc_type .strip ())
44+ return elements
2645
2746
2847def assert_number (number ):
You can’t perform that action at this time.
0 commit comments