mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 06:18:09 +00:00
Publish element classes MicroMVD definitions
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
from behave import step
|
||||||
|
from utils import IfcFile, assert_attribute
|
||||||
|
|
||||||
|
@step('The element {guid} is an {ifc_class} only')
|
||||||
|
def step_impl(context, guid, ifc_class):
|
||||||
|
element = IfcFile.by_guid(guid)
|
||||||
|
assert element.is_a() == ifc_class, 'The element {} is an {} instead of {}.'.format(element, element.is_a(), ifc_class)
|
||||||
|
|
||||||
|
|
||||||
|
@step('The element {guid} is an {ifc_class}')
|
||||||
|
def step_impl(context, guid, ifc_class):
|
||||||
|
element = IfcFile.by_guid(guid)
|
||||||
|
assert element.is_a(ifc_class), 'The element {} is an {} instead of {}.'.format(element, element.is_a(), ifc_class)
|
||||||
|
|
||||||
|
|
||||||
|
@step('The element {guid} is further defined as a {predefined_type}')
|
||||||
|
def step_impl(context, guid, predefined_type):
|
||||||
|
element = IfcFile.by_guid(guid)
|
||||||
|
if (hasattr(element, 'PredefinedType') and element.PredefinedType == 'USERDEFINED') \
|
||||||
|
or hasattr(element,'ObjectType'):
|
||||||
|
assert_attribute(element, 'ObjectType', predefined_type)
|
||||||
|
elif hasattr(element, 'PredefinedType'):
|
||||||
|
assert_attribute(element, 'PredefinedType', predefined_type)
|
||||||
|
else:
|
||||||
|
assert False, 'The element {} does not have a PredefinedType or ObjectType attribute'.format(element)
|
||||||
|
|
||||||
|
|
||||||
|
@step('The element {guid} should not exist because {reason}')
|
||||||
|
def step_impl(context, guid, reason):
|
||||||
|
try:
|
||||||
|
element = IfcFile.get().by_id(guid)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
assert False, 'This element {} should be reevaluated.'.format(element)
|
||||||
@@ -1,50 +1,6 @@
|
|||||||
from behave import step
|
from behave import step
|
||||||
from utils import IfcFile
|
from utils import IfcFile
|
||||||
|
|
||||||
# Custom MicroMVD
|
|
||||||
|
|
||||||
@step('The element {id} is an {ifc_class} only')
|
|
||||||
def step_impl(context, id, ifc_class):
|
|
||||||
try:
|
|
||||||
element = IfcFile.get().by_id(id)
|
|
||||||
except:
|
|
||||||
assert False, f'The element with {id} could not be found.'
|
|
||||||
assert element.is_a() == ifc_class, 'The element {} is an {} instead of {}.'.format(element, element.is_a(), ifc_class)
|
|
||||||
|
|
||||||
|
|
||||||
@step('The element {id} is an {ifc_class}')
|
|
||||||
def step_impl(context, id, ifc_class):
|
|
||||||
try:
|
|
||||||
element = IfcFile.get().by_id(id)
|
|
||||||
except:
|
|
||||||
assert False, f'The element with {id} could not be found.'
|
|
||||||
assert element.is_a(ifc_class), 'The element {} is an {} instead of {}.'.format(element, element.is_a(), ifc_class)
|
|
||||||
|
|
||||||
|
|
||||||
@step('The element {id} is further defined as a {predefined_type}')
|
|
||||||
def step_impl(context, id, predefined_type):
|
|
||||||
try:
|
|
||||||
element = IfcFile.get().by_id(id)
|
|
||||||
except:
|
|
||||||
assert False, f'The element with {id} could not be found.'
|
|
||||||
if element.PredefinedType == predefined_type:
|
|
||||||
return
|
|
||||||
if element.PredefinedType == 'USERDEFINED' and element.ObjectType == 'predefined_type':
|
|
||||||
return
|
|
||||||
assert False, 'The element {} has a predefined type of {} and an object type of {} instead of {}.'.format(element, element.PredefinedType, element.ObjectType, predefined_type)
|
|
||||||
|
|
||||||
|
|
||||||
@step('The element {id} should not exist because {reason}')
|
|
||||||
def step_impl(context, id, reason):
|
|
||||||
try:
|
|
||||||
element = IfcFile.get().by_id(id)
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
assert False, 'This element {} should be reevaluated.'.format(element)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@step(u'there are no {ifc_class} elements because {reason}')
|
@step(u'there are no {ifc_class} elements because {reason}')
|
||||||
def step_impl(context, ifc_class, reason):
|
def step_impl(context, ifc_class, reason):
|
||||||
assert len(IfcFile.get().by_type(ifc_class)) == 0
|
assert len(IfcFile.get().by_type(ifc_class)) == 0
|
||||||
@@ -167,19 +123,6 @@ def step_impl(context, ifc_class, qto_name, quantity_name):
|
|||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use_step_matcher('re')
|
|
||||||
@step(u'the geolocated datum has an? (?P<attribute>.*) of "(?P<value>.*)"')
|
|
||||||
def step_impl(context, attribute, value):
|
|
||||||
if IfcFile.get().schema == 'IFC2X3':
|
|
||||||
site = IfcFile.get().by_type('IfcSite')[0]
|
|
||||||
actual_value = IfcFile.get_property(site, 'EPset_MapConversion', attribute).NominalValue.wrappedValue
|
|
||||||
else:
|
|
||||||
actual_value = getattr(IfcFile.get().by_id(IfcFile.bookmarks['geolocation']), attribute)
|
|
||||||
assert str(actual_value) == value, f'The value was {actual_value}'
|
|
||||||
|
|
||||||
|
|
||||||
use_step_matcher('parse')
|
use_step_matcher('parse')
|
||||||
@step(u'the project has a {attribute_name} attribute with a value of "{attribute_value}"')
|
@step(u'the project has a {attribute_name} attribute with a value of "{attribute_value}"')
|
||||||
def step_impl(context, attribute_name, attribute_value):
|
def step_impl(context, attribute_name, attribute_value):
|
||||||
|
|||||||
Reference in New Issue
Block a user