Repository navigation
Assembly to Model - #23
gonzalocasas wants to merge 4 commits into
Conversation
jckenny59
left a comment
There was a problem hiding this comment.
We all discussed and I think we will go forward with the model, so basically everything is approved. I left some open comments to discuss, but I think we can go ahead and merge this after we discuss on Monday 👍😄 Thank you for all of your help @gonzalocasas 😄
| filename = "{}.obj".format(str(beam.guid)) | ||
| mesh_transformed.to_obj(os.path.join(target_folder_path, filename)) | ||
|
|
||
| def export_mesh_model_objs(self, model: Model, folder_path: str, new_folder_name: str, z_to_y_remap: bool = False) -> None: |
There was a problem hiding this comment.
This is just a general question that I have. But I was curious about the generic object type supports for the Model. I have been looking through the code, and I only see major support for Brep and Mesh. On the XR side actually while the Meshes can be used to create any object. The lowest latency / most responsive is generally the generics like Box, Cylinder, and Sphere.... I was just curious and would love to discuss this overall so I thought I would leave a comment 😄
There was a problem hiding this comment.
That's a good point. As far as I can see, the only thing that wouldn't work is calculating contacts, but we don't do that. The rest is mostly just that the type hint will push against adding a Shape, but it would work. However, we can use a different subclass of Elemenet to add support for primitive shapes
| filename = "{}.obj".format(str(element.guid)) | ||
| mesh.to_obj(os.path.join(target_folder_path, filename)) | ||
|
|
||
| def create_qr_model(self, qr_frames: list[Frame]) -> Model: |
There was a problem hiding this comment.
Same kind of question above applies here. This was a very specific method to support deserialization on the compas_xr_unity_assembly application. (because it was a bit easier in the application logic to deserialize as an assembly when we were doing all the manual deserialization) This is just a general comment. I think with the move to proto this should change kind of specific, but a good discussion point I think....😄
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical visualization defects and broken shipped examples must be addressed before approval.
Review effort: Lite
Findings: 2
Open (4)
What changed in this PR
Migrates COMPAS XR workflows from legacy Assembly/Part APIs to Model/Element APIs.
Changes:
- Replaces assembly-based planning, export, and visualization with model-based workflows.
- Updates dependencies, exports, tests, documentation, and changelog.
- Removes legacy Assembly helpers.
| File | Summary |
|---|---|
uv.lock |
Locks updated dependencies. |
tests/compas_xr/project/test_model_migration.py |
Adds migration coverage; dependency-version assertion is overly narrow (moderate, 1 vote). |
src/compas_xr/project/project_manager.py |
Migrates project management; timber visualization uses an unavailable API and actor representations are inconsistent (critical, 1 vote each). |
src/compas_xr/project/model_extensions.py |
Adds model export and QR helpers. |
src/compas_xr/project/buildingplan_extensions.py |
Adds model-based planning. |
src/compas_xr/project/assembly_extensions.py |
Removes legacy Assembly helpers. |
src/compas_xr/project/__init__.py |
Exposes Model APIs; bundled examples still require the removed Assembly export (moderate, 3 votes). |
requirements.txt |
Updates runtime dependencies. |
environment.yml |
Updates environment dependencies. |
docs/userguide.md |
Documents Model workflows; bundled examples remain assembly-based (moderate, 1 vote), and one example uses an undefined frame (nit, 3 votes). |
CHANGELOG.md |
Records the migration and removed APIs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| """ | ||
| part = nodes[assembly_element_id]["part"] | ||
| element_id = str(step.element_ids[0]) | ||
| element = timber_model.get_element(element_id) |
| if step.actor == "HUMAN": | ||
| # TODO: I am not sure if this works in all scenarios of Part | ||
| if step.is_built: | ||
| built_human.append(part) | ||
| built_human.append(element) | ||
| else: | ||
| unbuilt_human.append(part) | ||
| unbuilt_human.append(element) |
| from compas_xr.project.model_extensions import ModelExtensions | ||
| from compas_xr.project.project_manager import ProjectManager | ||
|
|
||
| __all__ = ["ProjectManager", "AssemblyExtensions", "BuildingPlanExtensions"] | ||
| __all__ = ["ProjectManager", "ModelExtensions", "BuildingPlanExtensions"] |
| from compas.geometry import Transformation | ||
| from compas_model.elements import BeamElement | ||
| from compas_model.models import Model | ||
|
|
||
| model = Model() | ||
| element = BeamElement( | ||
| width=0.1, | ||
| depth=0.2, | ||
| length=3.0, | ||
| transformation=Transformation.from_frame(frame), | ||
| ) | ||
| model.add_element(element) |



PR to move from Assembly to Model
What type of change is this?
Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed).invoke test).invoke lint).compas.datastructures.Mesh.