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

Function select

src/ifcquery/ifcquery/select.py:28–50  ·  view source on GitHub ↗

Filter elements using ifcopenshell selector syntax and return matching element summaries. Examples: - ``IfcWall`` — all walls - ``IfcWall, IfcColumn`` — walls and columns - ``! IfcWall`` — everything except walls - ``IfcWall, Name = "My Wall"`` — walls with a specific name attri

(model: ifcopenshell.file, query: str)

Source from the content-addressed store, hash-verified

26
27
28def select(model: ifcopenshell.file, query: str) -> list[dict[str, Any]]:
29 """Filter elements using ifcopenshell selector syntax and return matching element summaries.
30
31 Examples:
32 - ``IfcWall`` — all walls
33 - ``IfcWall, IfcColumn`` — walls and columns
34 - ``! IfcWall`` — everything except walls
35 - ``IfcWall, Name = "My Wall"`` — walls with a specific name attribute
36 - ``type = "Concrete Wall"`` — elements assigned that type product
37 - ``material = "Concrete"`` — elements with that material
38 """
39 elements = ifcopenshell.util.selector.filter_elements(model, query)
40 results = []
41 for element in sorted(elements, key=lambda e: e.id()):
42 entry: dict[str, Any] = {
43 "id": element.id(),
44 "type": element.is_a(),
45 "repr": str(element),
46 }
47 if hasattr(element, "Name"):
48 entry["name"] = element.Name
49 results.append(entry)
50 return results

Callers 7

test_select_by_typeMethod · 0.90
test_select_no_matchMethod · 0.90
selectMethod · 0.85
start_elementFunction · 0.85

Calls 4

filter_elementsMethod · 0.45
idMethod · 0.45
is_aMethod · 0.45
appendMethod · 0.45

Tested by 5

test_select_by_typeMethod · 0.72
test_select_no_matchMethod · 0.72