Skip to content

Assembly to Model - #23

Open
gonzalocasas wants to merge 4 commits into
mainfrom
restructure
Open

gonzalocasas wants to merge 4 commits into
mainfrom
restructure

Conversation

@gonzalocasas

@gonzalocasas gonzalocasas commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

PR to move from Assembly to Model

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in 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.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@gonzalocasas
gonzalocasas requested a review from jckenny59 August 10, 2026 17:17

@jckenny59 jckenny59 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 😄

Comment thread docs/userguide.md Resolved
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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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....😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very fair point

Comment thread requirements.txt Resolved
Comment thread environment.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical visualization defects and broken shipped examples must be addressed before approval.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity · 1 Low severity

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)
Comment on lines 409 to +413
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)
Comment on lines +2 to +5
from compas_xr.project.model_extensions import ModelExtensions
from compas_xr.project.project_manager import ProjectManager

__all__ = ["ProjectManager", "AssemblyExtensions", "BuildingPlanExtensions"]
__all__ = ["ProjectManager", "ModelExtensions", "BuildingPlanExtensions"]
Comment thread docs/userguide.md
Comment on lines +47 to +58
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)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants