bruce-models 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. {bruce_models-0.3.1 → bruce_models-0.3.2}/PKG-INFO +1 -1
  2. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/__init__.py +1 -1
  3. bruce_models-0.3.2/bruce_models/cli/run_import_ifc.py +255 -0
  4. bruce_models-0.3.2/bruce_models/cli/seed_ifc.py +403 -0
  5. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/suites.py +18 -1
  6. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/client_file/client_file.py +70 -0
  7. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models.egg-info/SOURCES.txt +2 -0
  8. {bruce_models-0.3.1 → bruce_models-0.3.2}/MANIFEST.in +0 -0
  9. {bruce_models-0.3.1 → bruce_models-0.3.2}/README.md +0 -0
  10. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/__main__.py +0 -0
  11. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/account/__init__.py +0 -0
  12. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/account/account.py +0 -0
  13. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/account/account_audit.py +0 -0
  14. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/__init__.py +0 -0
  15. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/api.py +0 -0
  16. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/bruce_api.py +0 -0
  17. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/errors.py +0 -0
  18. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/guardian_api.py +0 -0
  19. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/api/response.py +0 -0
  20. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/change/__init__.py +0 -0
  21. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/change/change_set.py +0 -0
  22. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/change/change_set_builder.py +0 -0
  23. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/change/edit_store.py +0 -0
  24. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/__init__.py +0 -0
  25. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/baseline.py +0 -0
  26. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/baselines/benchmark.json +0 -0
  27. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/bench.py +0 -0
  28. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_accounts.py +0 -0
  29. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_audit.py +0 -0
  30. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_auth.py +0 -0
  31. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_indexes.py +0 -0
  32. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_render.py +0 -0
  33. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_run.py +0 -0
  34. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/cmd_status.py +0 -0
  35. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/commands.py +0 -0
  36. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/config.py +0 -0
  37. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/exits.py +0 -0
  38. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/humanize.py +0 -0
  39. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/identity.py +0 -0
  40. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/live.py +0 -0
  41. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/main.py +0 -0
  42. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/report.py +0 -0
  43. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_bench.py +0 -0
  44. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_change_set.py +0 -0
  45. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_data_model.py +0 -0
  46. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_data_transform.py +0 -0
  47. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_datalab.py +0 -0
  48. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_entity_lod.py +0 -0
  49. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_gis.py +0 -0
  50. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_historic.py +0 -0
  51. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_brz.py +0 -0
  52. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_csv.py +0 -0
  53. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_geojson.py +0 -0
  54. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_json.py +0 -0
  55. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_kml.py +0 -0
  56. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_import_xlsx.py +0 -0
  57. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_merge.py +0 -0
  58. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_relation.py +0 -0
  59. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/run_scale.py +0 -0
  60. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/runner.py +0 -0
  61. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed.py +0 -0
  62. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_bench.py +0 -0
  63. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_brz.py +0 -0
  64. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_change_set.py +0 -0
  65. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_data_model.py +0 -0
  66. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_data_transform.py +0 -0
  67. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_datalab.py +0 -0
  68. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_geojson.py +0 -0
  69. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_gis.py +0 -0
  70. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_historic.py +0 -0
  71. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_json.py +0 -0
  72. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_kml.py +0 -0
  73. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_lod.py +0 -0
  74. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_merge.py +0 -0
  75. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_relation.py +0 -0
  76. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_scale.py +0 -0
  77. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/seed_xlsx.py +0 -0
  78. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/cli/style.py +0 -0
  79. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/client_file/__init__.py +0 -0
  80. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/client_file/client_file_query_builder.py +0 -0
  81. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/client_file/client_file_texture.py +0 -0
  82. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/client_file/client_file_value_map.py +0 -0
  83. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/common/__init__.py +0 -0
  84. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/common/bounds.py +0 -0
  85. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/common/geometry.py +0 -0
  86. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/common/geometry_builder.py +0 -0
  87. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/common/lru_cache.py +0 -0
  88. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_lab/__init__.py +0 -0
  89. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_lab/data_lab.py +0 -0
  90. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_lab/data_lab_builder.py +0 -0
  91. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_lab/data_lab_pairing.py +0 -0
  92. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_mapping/__init__.py +0 -0
  93. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_mapping/data_mapping.py +0 -0
  94. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_mapping/data_mapping_builder.py +0 -0
  95. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_transform/__init__.py +0 -0
  96. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/data_transform/data_transform.py +0 -0
  97. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/__init__.py +0 -0
  98. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity.py +0 -0
  99. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity_historic_data.py +0 -0
  100. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity_index.py +0 -0
  101. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity_link.py +0 -0
  102. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity_type.py +0 -0
  103. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/entity/entity_ucs.py +0 -0
  104. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_assembly/__init__.py +0 -0
  105. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_assembly/assembly_import.py +0 -0
  106. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_brz/__init__.py +0 -0
  107. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_brz/brz.py +0 -0
  108. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_csv/__init__.py +0 -0
  109. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_csv/csv_import.py +0 -0
  110. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_geojson/__init__.py +0 -0
  111. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_geojson/geojson.py +0 -0
  112. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_geojson/geojson_import.py +0 -0
  113. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_json/__init__.py +0 -0
  114. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_json/json_import.py +0 -0
  115. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_kml/__init__.py +0 -0
  116. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_kml/kml.py +0 -0
  117. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_kml/kml_import.py +0 -0
  118. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_xlsx/__init__.py +0 -0
  119. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_xlsx/xlsx.py +0 -0
  120. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/format_xlsx/xlsx_import.py +0 -0
  121. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/geometry/__init__.py +0 -0
  122. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/geometry/glb.py +0 -0
  123. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/hosting/__init__.py +0 -0
  124. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/hosting/hosting_location.py +0 -0
  125. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/internal/__init__.py +0 -0
  126. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/internal/uploader.py +0 -0
  127. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/lod/__init__.py +0 -0
  128. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/lod/entity_lod.py +0 -0
  129. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/lod/lod_category.py +0 -0
  130. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/relation/__init__.py +0 -0
  131. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/relation/entity_relation.py +0 -0
  132. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/relation/entity_relation_type.py +0 -0
  133. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/scenario/__init__.py +0 -0
  134. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/scenario/scenario.py +0 -0
  135. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/server/__init__.py +0 -0
  136. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/server/api_version.py +0 -0
  137. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/server/pending_action.py +0 -0
  138. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/tileset/__init__.py +0 -0
  139. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/tileset/tileset.py +0 -0
  140. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/user/__init__.py +0 -0
  141. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/user/session.py +0 -0
  142. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/__init__.py +0 -0
  143. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/import_utils.py +0 -0
  144. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/optional.py +0 -0
  145. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/path_utils.py +0 -0
  146. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/query_plan.py +0 -0
  147. {bruce_models-0.3.1 → bruce_models-0.3.2}/bruce_models/util/required.py +0 -0
  148. {bruce_models-0.3.1 → bruce_models-0.3.2}/pyproject.toml +0 -0
  149. {bruce_models-0.3.1 → bruce_models-0.3.2}/requirements.txt +0 -0
  150. {bruce_models-0.3.1 → bruce_models-0.3.2}/setup.cfg +0 -0
  151. {bruce_models-0.3.1 → bruce_models-0.3.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bruce-models
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: This is a library which defines data-models for the Nextspace API and provides functions for communicating with the endpoints.
5
5
  Author: Matvey Lavrinovich
6
6
  Author-email: matveylavrinovich@gmail.com
@@ -62,7 +62,7 @@ from .util.path_utils import PathUtils
62
62
 
63
63
  # The one place the version is written. setup.py reads it from here without importing the package,
64
64
  # and pypi-release.sh reads this same file, so a source checkout and a wheel can never disagree.
65
- __version__ = "0.3.1"
65
+ __version__ = "0.3.2"
66
66
 
67
67
  __all__ = [
68
68
  "__version__",
@@ -0,0 +1,255 @@
1
+ """
2
+ IFC imports: whether a generated document converts, and whether each representation shape survives.
3
+ """
4
+
5
+ import time
6
+ from typing import List, Optional
7
+
8
+ from bruce_models.api.bruce_api import BruceApi
9
+ from bruce_models.api.errors import ApiError
10
+ from bruce_models.client_file.client_file import ClientFile
11
+ from bruce_models.entity.entity import Entity
12
+ from bruce_models.entity.entity_type import EntityType
13
+ from bruce_models.format_assembly.assembly_import import AssemblyImport
14
+ from bruce_models.server.pending_action import EStatus
15
+ from bruce_models.cli import seed_bench
16
+ from bruce_models.cli import seed_ifc
17
+ from bruce_models.cli.runner import (ImportFailed, Result, Timer, _finish, _job_outcome,
18
+ _message_relay, _report_step)
19
+
20
+
21
+ # How deep the walk over an imported tree is allowed to go before it gives up.
22
+ # The documents here are a handful of nodes, so anything approaching this is a cycle rather than a deep model.
23
+ MAX_DEPTH = 12
24
+
25
+
26
+ def _import_document(api: BruceApi, result: Result, document: seed_ifc.Document,
27
+ suffix: str, on_message=None) -> dict:
28
+ """
29
+ Uploads one generated IFC and runs both phases of the import against it.
30
+ """
31
+ name = f"ifc-{document.key}-{suffix}"
32
+ file_name = f"{name}.ifc"
33
+ try:
34
+ uploaded = ClientFile.upload_temp_bytes(api, document.data, file_name)
35
+ except ValueError as e:
36
+ raise ImportFailed(f"{document.key}: {e}") from None
37
+
38
+ # The upload registers a Client File alongside the temp file, and teardown has to know about it.
39
+ client_file_id = uploaded.get("ClientFile.ID")
40
+ if client_file_id:
41
+ result.client_file_ids.append(client_file_id)
42
+
43
+ parent_type_id = EntityType.create(api, f"bruce test {name}")
44
+ result.assembly_type_ids.append(parent_type_id)
45
+
46
+ outcome = AssemblyImport.run(api, assembly_name=file_name,
47
+ parent_type_name=f"bruce test {name}",
48
+ temp_file_id=uploaded["TempFile.ID"],
49
+ temp_file_name=file_name,
50
+ parent_type_id=parent_type_id,
51
+ on_message=_message_relay(on_message))
52
+ assembly_id = (outcome.get("result") or {}).get("Assembly.ID")
53
+ if assembly_id:
54
+ result.assembly_ids.append(assembly_id)
55
+ result.entity_ids.append(outcome["root_entity_id"])
56
+ return outcome
57
+
58
+
59
+ def _node_count(api: BruceApi, root_entity_id: str) -> int:
60
+ """
61
+ How many Entities the imported tree holds, root included.
62
+ """
63
+ seen = set()
64
+ pending = [(root_entity_id, 0)]
65
+ while pending:
66
+ entity_id, depth = pending.pop()
67
+ if not entity_id or entity_id in seen or depth > MAX_DEPTH:
68
+ continue
69
+ seen.add(entity_id)
70
+ for child in Entity.get_children(api, entity_id):
71
+ pending.append((Entity.child_id(child), depth + 1))
72
+ return len(seen)
73
+
74
+
75
+ def _leaf_ids(api: BruceApi, root_entity_id: str) -> List[str]:
76
+ """
77
+ The Entities in the tree with nothing under them, which is where element properties land.
78
+ """
79
+ leaves = []
80
+ pending = [(root_entity_id, 0)]
81
+ seen = set()
82
+ while pending:
83
+ entity_id, depth = pending.pop()
84
+ if not entity_id or entity_id in seen or depth > MAX_DEPTH:
85
+ continue
86
+ seen.add(entity_id)
87
+ children = Entity.get_children(api, entity_id)
88
+ if not children:
89
+ leaves.append(entity_id)
90
+ for child in children:
91
+ pending.append((Entity.child_id(child), depth + 1))
92
+ return leaves
93
+
94
+
95
+ def _find_property(api: BruceApi, leaf_ids: List[str]) -> Optional[str]:
96
+ """
97
+ The first value the generated property set put on any leaf, or None when none carried one.
98
+
99
+ Which leaf carries it is not asserted: an importer is free to arrange the tree how it likes, and
100
+ the question here is whether the properties crossed the conversion at all.
101
+ """
102
+ for entity_id in leaf_ids:
103
+ try:
104
+ entity = Entity.get(api, entity_id)
105
+ except (ApiError, ValueError):
106
+ continue
107
+ # Segments rather than a dotted string: a Nextspace path quotes its parts, so
108
+ # "Pset_BruceTest.Label" parses as one segment naming an attribute nothing answers to.
109
+ for path in ([seed_ifc.PSET_NAME, seed_ifc.PSET_LABEL], [seed_ifc.PSET_LABEL]):
110
+ value = Entity.get_value(entity, path)
111
+ if value:
112
+ return str(value)
113
+ return None
114
+
115
+
116
+ def run_import_ifc(
117
+ api: BruceApi,
118
+ rows: int = 0,
119
+ on_progress=None,
120
+ on_message=None,
121
+ cleanup: bool = True
122
+ ) -> Result:
123
+ """
124
+ Imports one generated IFC and checks the tree and the properties it produced.
125
+ """
126
+ def report(message):
127
+ if on_progress:
128
+ on_progress(message)
129
+
130
+ result = Result()
131
+ started = time.monotonic()
132
+ document = seed_ifc.simple()
133
+ expected_nodes = seed_ifc.SPATIAL_LEVELS + document.element_count
134
+
135
+ step = result.step("Generate IFC")
136
+ with Timer(step):
137
+ step.ok = True
138
+ step.detail = (f"{document.element_count} elements, {document.size_bytes / 1024:.1f} KB "
139
+ f"(no file fixture)")
140
+ _report_step(report, step)
141
+
142
+ step = result.step("Import IFC")
143
+ imported = None
144
+ with Timer(step):
145
+ try:
146
+ imported = _import_document(api, result, document, seed_bench.new_suffix(),
147
+ on_message)
148
+ step.ok = True
149
+ step.detail = _job_outcome(EStatus.COMPLETE, imported["dispatch"])
150
+ except (ApiError, ImportFailed, ValueError, TimeoutError) as e:
151
+ step.detail = str(e)
152
+ _report_step(report, step)
153
+
154
+ if imported:
155
+ _check_tree(api, result, document, imported["root_entity_id"], expected_nodes, report)
156
+ _check_properties(api, result, imported["root_entity_id"], report)
157
+
158
+ return _finish(api, result, started, cleanup, report)
159
+
160
+
161
+ def _check_tree(api: BruceApi, result: Result, document: seed_ifc.Document,
162
+ root_entity_id: str, expected_nodes: int, report) -> None:
163
+ """
164
+ The converted tree must carry a node for every element plus the spatial levels above them.
165
+ """
166
+ step = result.step("Check hierarchy")
167
+ step.expected = expected_nodes
168
+ with Timer(step):
169
+ try:
170
+ found = _node_count(api, root_entity_id)
171
+ step.actual = found
172
+ if found != expected_nodes:
173
+ step.detail = (f"expected {expected_nodes} Entities for "
174
+ f"{document.element_count} elements, found {found}")
175
+ else:
176
+ step.ok = True
177
+ step.detail = f"{found} Entities, {document.element_count} elements"
178
+ except (ApiError, ValueError) as e:
179
+ step.detail = str(e)
180
+ _report_step(report, step)
181
+
182
+
183
+ def _check_properties(api: BruceApi, result: Result, root_entity_id: str, report) -> None:
184
+ """
185
+ An IFC property set has to survive the conversion, or the import carries geometry and nothing else.
186
+ """
187
+ step = result.step("Check properties")
188
+ with Timer(step):
189
+ try:
190
+ leaves = _leaf_ids(api, root_entity_id)
191
+ found = _find_property(api, leaves)
192
+ if not found:
193
+ step.detail = (f"no '{seed_ifc.PSET_NAME}.{seed_ifc.PSET_LABEL}' on any of "
194
+ f"{len(leaves)} leaf Entities")
195
+ else:
196
+ step.ok = True
197
+ step.detail = f"{seed_ifc.PSET_NAME} read back on a leaf"
198
+ except (ApiError, ValueError) as e:
199
+ step.detail = str(e)
200
+ _report_step(report, step)
201
+
202
+
203
+ def run_ifc_variants(
204
+ api: BruceApi,
205
+ rows: int = 0,
206
+ on_progress=None,
207
+ on_message=None,
208
+ cleanup: bool = True
209
+ ) -> Result:
210
+ """
211
+ Imports one IFC per representation shape, so a converter regression names the shape that broke.
212
+ """
213
+ def report(message):
214
+ if on_progress:
215
+ on_progress(message)
216
+
217
+ result = Result()
218
+ started = time.monotonic()
219
+ documents = seed_ifc.variants()
220
+ suffix = seed_bench.new_suffix()
221
+
222
+ step = result.step("Generate variants")
223
+ with Timer(step):
224
+ total = sum(document.size_bytes for document in documents)
225
+ step.ok = True
226
+ step.detail = f"{len(documents)} documents, {total / 1024:.1f} KB total"
227
+ _report_step(report, step)
228
+
229
+ for document in documents:
230
+ _run_variant(api, result, document, suffix, on_message, report)
231
+
232
+ return _finish(api, result, started, cleanup, report)
233
+
234
+
235
+ def _run_variant(api: BruceApi, result: Result, document: seed_ifc.Document, suffix: str,
236
+ on_message, report) -> None:
237
+ """
238
+ One representation shape: import it, then check every element reached the tree.
239
+ """
240
+ expected_nodes = seed_ifc.SPATIAL_LEVELS + document.element_count
241
+ step = result.step(f"Import {document.key}")
242
+ step.expected = expected_nodes
243
+ with Timer(step):
244
+ try:
245
+ imported = _import_document(api, result, document, suffix, on_message)
246
+ found = _node_count(api, imported["root_entity_id"])
247
+ step.actual = found
248
+ if found != expected_nodes:
249
+ step.detail = f"expected {expected_nodes} Entities, found {found}"
250
+ else:
251
+ step.ok = True
252
+ step.detail = f"{found} Entities, {document.description}"
253
+ except (ApiError, ImportFailed, ValueError, TimeoutError) as e:
254
+ step.detail = f"{document.description}: {e}"
255
+ _report_step(report, step)
@@ -0,0 +1,403 @@
1
+ """
2
+ Generated IFC documents for the import suites, written from the standard library alone.
3
+ """
4
+
5
+ import uuid
6
+ from typing import List, Optional, Sequence
7
+
8
+ # IFC spells a GlobalId as 22 characters of base64 over its own alphabet with no padding,
9
+ # which is not the base64 any standard library function produces.
10
+ GUID_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$"
11
+
12
+ # The four spatial levels every document carries: project, site, building, storey.
13
+ SPATIAL_LEVELS = 4
14
+
15
+ # Millimetres, matching what the CAD exporters we actually read from use.
16
+ MILLIMETRES = ".MILLI."
17
+
18
+ # The property set each element carries, and the two properties in it.
19
+ PSET_NAME = "Pset_BruceTest"
20
+ PSET_LABEL = "Label"
21
+ PSET_INDEX = "Index"
22
+
23
+
24
+ class Document:
25
+ """
26
+ A generated IFC plus what a caller should expect to read back from it.
27
+ """
28
+
29
+ def __init__(self, key: str, text: str, element_names: Sequence[str],
30
+ schema: str, description: str, has_geometry: bool = True):
31
+ self.key = key
32
+ self.text = text
33
+ self.data = text.encode("utf-8")
34
+ self.element_names = list(element_names)
35
+ self.schema = schema
36
+ self.description = description
37
+ self.has_geometry = has_geometry
38
+
39
+ @property
40
+ def size_bytes(self) -> int:
41
+ return len(self.data)
42
+
43
+ @property
44
+ def element_count(self) -> int:
45
+ return len(self.element_names)
46
+
47
+ @property
48
+ def instance_count(self) -> int:
49
+ return self.text.count(";\n") - 6
50
+
51
+
52
+ def compress_guid(seed: int) -> str:
53
+ """
54
+ An IFC GlobalId derived from a number, so a regenerated document is byte identical.
55
+ """
56
+ number = uuid.UUID(int=seed, version=4).int
57
+ digits = []
58
+ for _ in range(22):
59
+ digits.append(GUID_CHARS[number % 64])
60
+ number //= 64
61
+ return "".join(reversed(digits))
62
+
63
+
64
+ class Builder:
65
+ """
66
+ Accumulates STEP instances, handing back the reference each one is named by.
67
+
68
+ Every method returns the "#n" the instance was written as, since a STEP file is a flat list whose
69
+ structure is entirely in those references.
70
+ """
71
+
72
+ def __init__(self, schema: str = "IFC4", length_prefix: str = MILLIMETRES):
73
+ self.schema = schema
74
+ self.lines: List[str] = []
75
+ self.seed = 0
76
+ self._preamble(length_prefix)
77
+
78
+ def add(self, body: str) -> str:
79
+ self.lines.append(body)
80
+ return f"#{len(self.lines)}"
81
+
82
+ def guid(self) -> str:
83
+ self.seed += 1
84
+ return f"'{compress_guid(self.seed)}'"
85
+
86
+ def _preamble(self, length_prefix: str) -> None:
87
+ """
88
+ Everything a document needs before it can hold a product: ownership, units and the contexts.
89
+ """
90
+ person = self.add("IFCPERSON($,'Bruce','Test',$,$,$,$,$)")
91
+ org = self.add("IFCORGANIZATION($,'Nextspace',$,$,$)")
92
+ pao = self.add(f"IFCPERSONANDORGANIZATION({person},{org},$)")
93
+ app = self.add(f"IFCAPPLICATION({org},'1.0','bruce-models','bruce-models')")
94
+ self.owner = self.add(f"IFCOWNERHISTORY({pao},{app},$,.ADDED.,$,$,$,0)")
95
+
96
+ units = [
97
+ self.add(f"IFCSIUNIT(*,.LENGTHUNIT.,{length_prefix},.METRE.)"),
98
+ self.add("IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.)"),
99
+ self.add("IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.)"),
100
+ self.add("IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.)"),
101
+ ]
102
+ assignment = self.add(f"IFCUNITASSIGNMENT(({','.join(units)}))")
103
+
104
+ origin = self.add("IFCCARTESIANPOINT((0.,0.,0.))")
105
+ self.axis_z = self.add("IFCDIRECTION((0.,0.,1.))")
106
+ self.axis_x = self.add("IFCDIRECTION((1.,0.,0.))")
107
+ self.world = self.add(f"IFCAXIS2PLACEMENT3D({origin},{self.axis_z},{self.axis_x})")
108
+ context = self.add(
109
+ f"IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-5,{self.world},$)"
110
+ )
111
+ self.body = self.add(
112
+ "IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,"
113
+ f"{context},$,.MODEL_VIEW.,$)"
114
+ )
115
+
116
+ project = self.add(f"IFCPROJECT({self.guid()},{self.owner},'Bruce test',$,$,$,$,"
117
+ f"({context}),{assignment})")
118
+ site_place = self.add(f"IFCLOCALPLACEMENT($,{self.world})")
119
+ site = self.add(f"IFCSITE({self.guid()},{self.owner},'Site',$,$,{site_place},$,$,"
120
+ ".ELEMENT.,$,$,$,$,$)")
121
+ building_place = self.add(f"IFCLOCALPLACEMENT({site_place},{self.world})")
122
+ building = self.add(f"IFCBUILDING({self.guid()},{self.owner},'Building',$,$,"
123
+ f"{building_place},$,$,.ELEMENT.,$,$,$)")
124
+ self.storey_place = self.add(f"IFCLOCALPLACEMENT({building_place},{self.world})")
125
+ self.storey = self.add(f"IFCBUILDINGSTOREY({self.guid()},{self.owner},'Storey',$,$,"
126
+ f"{self.storey_place},$,$,.ELEMENT.,0.)")
127
+ for parent, child in ((project, site), (site, building), (building, self.storey)):
128
+ self.add(f"IFCRELAGGREGATES({self.guid()},{self.owner},$,$,{parent},({child}))")
129
+
130
+ def placement(self, x: float, rotated: bool = False) -> str:
131
+ point = self.add(f"IFCCARTESIANPOINT(({x:.4f},0.,0.))")
132
+ if rotated:
133
+ # A tilted Z and a yawed X, so a converter that ignored the axes could not agree.
134
+ axis_z = self.add("IFCDIRECTION((0.,-0.4472136,0.8944272))")
135
+ axis_x = self.add("IFCDIRECTION((0.8660254,0.5,0.))")
136
+ else:
137
+ axis_z, axis_x = self.axis_z, self.axis_x
138
+ axes = self.add(f"IFCAXIS2PLACEMENT3D({point},{axis_z},{axis_x})")
139
+ return self.add(f"IFCLOCALPLACEMENT({self.storey_place},{axes})")
140
+
141
+ def swept_box(self, width: float, depth: float, height: float) -> str:
142
+ """
143
+ A box as a profile swept along Z, which is what most exporters emit.
144
+ """
145
+ centre = self.add("IFCCARTESIANPOINT((0.,0.))")
146
+ axes = self.add(f"IFCAXIS2PLACEMENT2D({centre},$)")
147
+ profile = self.add(f"IFCRECTANGLEPROFILEDEF(.AREA.,$,{axes},{width:.4f},{depth:.4f})")
148
+ up = self.add("IFCDIRECTION((0.,0.,1.))")
149
+ solid = self.add(
150
+ f"IFCEXTRUDEDAREASOLID({profile},{self.world},{up},{height:.4f})")
151
+ return self.add(f"IFCSHAPEREPRESENTATION({self.body},'Body','SweptSolid',({solid}))")
152
+
153
+ def brep_box(self, width: float, depth: float, height: float) -> str:
154
+ """
155
+ The same box as an explicit boundary representation.
156
+ """
157
+ corners = [(0, 0, 0), (width, 0, 0), (width, depth, 0), (0, depth, 0),
158
+ (0, 0, height), (width, 0, height), (width, depth, height), (0, depth, height)]
159
+ points = [self.add("IFCCARTESIANPOINT((%.4f,%.4f,%.4f))" % corner) for corner in corners]
160
+ faces = []
161
+ for face in ((0, 3, 2, 1), (4, 5, 6, 7), (0, 1, 5, 4),
162
+ (1, 2, 6, 5), (2, 3, 7, 6), (3, 0, 4, 7)):
163
+ loop = self.add(f"IFCPOLYLOOP(({','.join(points[i] for i in face)}))")
164
+ bound = self.add(f"IFCFACEOUTERBOUND({loop},.T.)")
165
+ faces.append(self.add(f"IFCFACE(({bound}))"))
166
+ shell = self.add(f"IFCCLOSEDSHELL(({','.join(faces)}))")
167
+ solid = self.add(f"IFCFACETEDBREP({shell})")
168
+ return self.add(f"IFCSHAPEREPRESENTATION({self.body},'Body','Brep',({solid}))")
169
+
170
+ def tessellated_box(self, width: float, depth: float, height: float) -> str:
171
+ """
172
+ IFC4's triangulated face set, which newer exporters prefer for its compactness.
173
+ """
174
+ corners = [(0, 0, 0), (width, 0, 0), (width, depth, 0), (0, depth, 0),
175
+ (0, 0, height), (width, 0, height), (width, depth, height), (0, depth, height)]
176
+ coords = self.add("IFCCARTESIANPOINTLIST3D((%s))"
177
+ % ",".join("(%.4f,%.4f,%.4f)" % corner for corner in corners))
178
+ triangles = []
179
+ # Indices into the point list are one based, and each quad face becomes two triangles.
180
+ for a, b, c, d in ((1, 4, 3, 2), (5, 6, 7, 8), (1, 2, 6, 5),
181
+ (2, 3, 7, 6), (3, 4, 8, 7), (4, 1, 5, 8)):
182
+ triangles.append(f"({a},{b},{c})")
183
+ triangles.append(f"({a},{c},{d})")
184
+ faceset = self.add(f"IFCTRIANGULATEDFACESET({coords},$,.T.,({','.join(triangles)}),$)")
185
+ return self.add(
186
+ f"IFCSHAPEREPRESENTATION({self.body},'Body','Tessellation',({faceset}))")
187
+
188
+ def representation_map(self, shape: str) -> str:
189
+ """
190
+ The reusable definition an element maps in rather than carrying its own geometry.
191
+
192
+ Made once and mapped many times. A map per element would share the shape underneath but
193
+ still declare a separate definition, which is not the instancing this exists to exercise.
194
+ """
195
+ return self.add(f"IFCREPRESENTATIONMAP({self.world},{shape})")
196
+
197
+ def mapped(self, source: str) -> str:
198
+ """
199
+ One element's use of a shared representation map.
200
+ """
201
+ origin = self.add("IFCCARTESIANPOINT((0.,0.,0.))")
202
+ target = self.add(f"IFCCARTESIANTRANSFORMATIONOPERATOR3D($,$,{origin},$,$)")
203
+ item = self.add(f"IFCMAPPEDITEM({source},{target})")
204
+ return self.add(
205
+ f"IFCSHAPEREPRESENTATION({self.body},'Body','MappedRepresentation',({item}))")
206
+
207
+ def product(self, name: str, placement: str, shape: Optional[str],
208
+ ifc_class: str = "IFCBUILDINGELEMENTPROXY", index: int = 0,
209
+ with_pset: bool = True) -> str:
210
+ """
211
+ One element, optionally carrying geometry and a property set.
212
+ """
213
+ definition = "$" if shape is None else self.add(
214
+ f"IFCPRODUCTDEFINITIONSHAPE($,$,({shape}))")
215
+ predefined = "'FLOOR'" if ifc_class == "IFCSLAB" else "'NOTDEFINED'"
216
+ product = self.add(f"{ifc_class}({self.guid()},{self.owner},'{name}',$,$,{placement},"
217
+ f"{definition},'{name}',{predefined})")
218
+ if with_pset:
219
+ values = [
220
+ self.add(f"IFCPROPERTYSINGLEVALUE('{PSET_LABEL}',$,IFCLABEL('{name}'),$)"),
221
+ self.add(f"IFCPROPERTYSINGLEVALUE('{PSET_INDEX}',$,IFCINTEGER({index}),$)"),
222
+ ]
223
+ pset = self.add(f"IFCPROPERTYSET({self.guid()},{self.owner},'{PSET_NAME}',$,"
224
+ f"({','.join(values)}))")
225
+ self.add(f"IFCRELDEFINESBYPROPERTIES({self.guid()},{self.owner},$,$,({product}),"
226
+ f"{pset})")
227
+ return product
228
+
229
+ def aggregate(self, parent: str, children: Sequence[str]) -> None:
230
+ self.add(f"IFCRELAGGREGATES({self.guid()},{self.owner},$,$,{parent},"
231
+ f"({','.join(children)}))")
232
+
233
+ def contain(self, products: Sequence[str]) -> None:
234
+ self.add(f"IFCRELCONTAINEDINSPATIALSTRUCTURE({self.guid()},{self.owner},$,$,"
235
+ f"({','.join(products)}),{self.storey})")
236
+
237
+ def render(self) -> str:
238
+ data = "\n".join(f"#{index + 1}= {line};" for index, line in enumerate(self.lines))
239
+ return ("ISO-10303-21;\n"
240
+ "HEADER;\n"
241
+ "FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');\n"
242
+ "FILE_NAME('bruce-test.ifc','2026-01-01T00:00:00',('bruce'),('Nextspace'),"
243
+ "'bruce-models','bruce-models','');\n"
244
+ f"FILE_SCHEMA(('{self.schema}'));\n"
245
+ "ENDSEC;\n"
246
+ "DATA;\n"
247
+ f"{data}\n"
248
+ "ENDSEC;\n"
249
+ "END-ISO-10303-21;\n")
250
+
251
+
252
+ def _box_dimensions(index: int, scale: float = 1.0) -> Sequence[float]:
253
+ """
254
+ Dimensions that differ per element.
255
+
256
+ They have to differ: a converter deduplicates identical geometry, so a row of identical boxes
257
+ produces one geometry however many elements carry it, and a count would be asserting on
258
+ deduplication rather than on the conversion.
259
+ """
260
+ return ((1000.0 + index * 200.0) * scale, 500.0 * scale, (800.0 + index * 100.0) * scale)
261
+
262
+
263
+ def _row(builder: Builder, count: int, shape_of, name: str = "Box",
264
+ ifc_class: str = "IFCBUILDINGELEMENTPROXY", spacing: float = 2000.0,
265
+ rotated: bool = False) -> List[str]:
266
+ """
267
+ A row of elements spread along X, each with its own geometry, placement and property set.
268
+ """
269
+ names = []
270
+ products = []
271
+ for index in range(count):
272
+ element_name = f"{name} {index}"
273
+ names.append(element_name)
274
+ products.append(builder.product(
275
+ element_name, builder.placement(index * spacing, rotated=rotated),
276
+ shape_of(builder, index), ifc_class=ifc_class, index=index))
277
+ builder.contain(products)
278
+ return names
279
+
280
+
281
+ def simple(count: int = 6) -> Document:
282
+ """
283
+ The document the plain import suite uses: a row of swept solids, each with properties.
284
+ """
285
+ builder = Builder()
286
+ names = _row(builder, count,
287
+ lambda b, i: b.swept_box(*_box_dimensions(i)))
288
+ return Document("swept", builder.render(), names, "IFC4",
289
+ "extruded profiles")
290
+
291
+
292
+ def _variant_brep(count: int) -> Document:
293
+ builder = Builder()
294
+ names = _row(builder, count, lambda b, i: b.brep_box(*_box_dimensions(i)), name="Brep")
295
+ return Document("brep", builder.render(), names, "IFC4",
296
+ "boundary representation")
297
+
298
+
299
+ def _variant_tessellated(count: int) -> Document:
300
+ builder = Builder()
301
+ names = _row(builder, count, lambda b, i: b.tessellated_box(*_box_dimensions(i)), name="Tess")
302
+ return Document("tessellated", builder.render(), names, "IFC4",
303
+ "triangulated face set")
304
+
305
+
306
+ def _variant_mapped(count: int) -> Document:
307
+ """
308
+ Every element points at one shared representation, so the converter sees instancing.
309
+ """
310
+ builder = Builder()
311
+ shared = builder.representation_map(builder.swept_box(*_box_dimensions(0)))
312
+ names = _row(builder, count, lambda b, i: b.mapped(shared), name="Mapped")
313
+ return Document("mapped", builder.render(), names, "IFC4",
314
+ "one representation, mapped")
315
+
316
+
317
+ def _variant_rotated(count: int) -> Document:
318
+ builder = Builder()
319
+ names = _row(builder, count, lambda b, i: b.swept_box(*_box_dimensions(i)),
320
+ name="Rot", rotated=True)
321
+ return Document("rotated", builder.render(), names, "IFC4",
322
+ "non-identity placement axes")
323
+
324
+
325
+ def _variant_metres(count: int) -> Document:
326
+ """
327
+ The same model in metres, since a unit misread is a silent factor of a thousand.
328
+ """
329
+ builder = Builder(length_prefix="$")
330
+ names = _row(builder, count,
331
+ lambda b, i: b.swept_box(*_box_dimensions(i, scale=0.001)),
332
+ name="Metre", spacing=2.0)
333
+ return Document("metres", builder.render(), names, "IFC4", "authored in metres")
334
+
335
+
336
+ def _variant_typed(count: int) -> Document:
337
+ """
338
+ Real element classes rather than proxies.
339
+ """
340
+ classes = ("IFCWALL", "IFCBEAM", "IFCCOLUMN", "IFCSLAB")
341
+ builder = Builder()
342
+ names = []
343
+ products = []
344
+ for index in range(count):
345
+ ifc_class = classes[index % len(classes)]
346
+ element_name = f"{ifc_class[3:].title()} {index}"
347
+ names.append(element_name)
348
+ products.append(builder.product(
349
+ element_name, builder.placement(index * 2000.0),
350
+ builder.swept_box(*_box_dimensions(index)), ifc_class=ifc_class, index=index))
351
+ builder.contain(products)
352
+ return Document("typed", builder.render(), names, "IFC4",
353
+ "walls, beams, columns, slabs")
354
+
355
+
356
+ def _variant_nested(count: int = 4) -> Document:
357
+ """
358
+ An element that aggregates children, so hierarchy depth is exercised rather than one flat row.
359
+ """
360
+ builder = Builder()
361
+ parent_name = "Assembly"
362
+ parent = builder.product(parent_name, builder.placement(0.0),
363
+ builder.swept_box(500.0, 500.0, 200.0), index=0)
364
+ names = [parent_name]
365
+ children = []
366
+ for index in range(count):
367
+ child_name = f"Part {index}"
368
+ names.append(child_name)
369
+ children.append(builder.product(
370
+ child_name, builder.placement(index * 1000.0),
371
+ builder.swept_box(*_box_dimensions(index)), index=index))
372
+ builder.aggregate(parent, children)
373
+ builder.contain([parent])
374
+ return Document("nested", builder.render(), names, "IFC4",
375
+ "child elements aggregated")
376
+
377
+
378
+ def _variant_ifc2x3(count: int) -> Document:
379
+ """
380
+ The older schema, which is what the exporters behind our real sample files emit.
381
+ """
382
+ builder = Builder(schema="IFC2X3")
383
+ names = _row(builder, count, lambda b, i: b.swept_box(*_box_dimensions(i)), name="Legacy")
384
+ return Document("ifc2x3", builder.render(), names, "IFC2X3", "the IFC2X3 schema")
385
+
386
+
387
+ def variants(count: int = 4) -> List[Document]:
388
+ """
389
+ One document per representation shape a converter has to handle.
390
+
391
+ Deliberately smaller rows than `simple`: this sweep is about breadth of shape rather than volume,
392
+ and every document here is a separate upload, conversion and import.
393
+ """
394
+ return [
395
+ _variant_brep(count),
396
+ _variant_tessellated(count),
397
+ _variant_mapped(count),
398
+ _variant_rotated(count),
399
+ _variant_metres(count),
400
+ _variant_typed(count),
401
+ _variant_nested(count),
402
+ _variant_ifc2x3(count),
403
+ ]