MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / the_object_name_exists

Function the_object_name_exists

src/bonsai/test/bim/test_feature.py:1142–1152  ·  view source on GitHub ↗
(name: str)

Source from the content-addressed store, hash-verified

1140@when(parsers.parse('the object "{name}" exists'))
1141@then(parsers.parse('the object "{name}" exists'))
1142def the_object_name_exists(name: str) -> bpy.types.Object:
1143 # Some objects from linked collections may share the same name. This disambiguates them.
1144 if name.startswith("Col:"):
1145 _, collection_name, name = name.split(":")
1146 obj = bpy.data.collections.get(collection_name).objects.get(name)
1147 else:
1148 obj = bpy.data.objects.get(name)
1149 if not obj:
1150 debug = "\n".join([o.name for o in bpy.data.objects])
1151 assert False, f'The object "{name}" does not exist:\n{debug}'
1152 return obj
1153
1154
1155@then(parsers.parse('the object "{name}" does not exist'))

Calls 3

splitMethod · 0.80
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected