Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from compas_view2 to compas_viewer #5

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

andrusha
Copy link
Contributor

compas_view2 is deprecated and is no longer supported with newer compas versions, which makes cra viewer inoperable.

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)

compas_view2 is deprecated and is no longer supported with newer compas versions, which makes cra viewer inoperable
@andrusha
Copy link
Contributor Author

@tomvanmele could you take a look?

Copy link
Contributor

@tomvanmele tomvanmele left a comment

Choose a reason for hiding this comment

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

generally LGTM, just a few small comments...

class Arrow:
def __init__(self, position=[0, 0, 0], direction=[0, 0, 1], linewidth=0.02):
super().__init__()
self.position = Vector(*position)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make this a point?

Comment on lines +29 to +30
Vector(*self.direction),
anchor=Point(*self.position),
Copy link
Contributor

Choose a reason for hiding this comment

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

self.direction is already a Vector. why the conversion?
same for self.position (if you change self.position = Point(*position))

viewer.add(
Collection(blocks),
viewer.scene.add(
blocks,
Copy link
Contributor

Choose a reason for hiding this comment

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

just FYI, groups and collections are not exactly the same. collections are a bit faster once the viewer is running. groups provide logical grouping in the scene tree.

if we are concerned about speed, we could consider switching to BufferGeometry, but this can be done ina separate PR...

from compas_viewer.config import Config


class Arrow:
Copy link
Contributor

Choose a reason for hiding this comment

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

we could make an actual arrow object for compas_viewer as well, but this will work for now...

env_osx.yml Outdated
- compas_view2
- ipopt
- compas_viewer
- ipopt ==3.14.5
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure about this version? i have 3.14.9 locally...

@tomvanmele
Copy link
Contributor

@andrusha i have updated the envs in the repo because the builds were failing. perhaps you can resubmit with those envs...

@tomvanmele
Copy link
Contributor

ideally we can update the solvers to more recent versions, but this will require some testing

@tomvanmele tomvanmele merged commit ecf29fd into BlockResearchGroup:main Oct 21, 2024
3 of 4 checks passed
@tomvanmele
Copy link
Contributor

@andrusha please add yourself to the list of contributors...

@andrusha
Copy link
Contributor Author

Thanks! Appreciate the merge. My goal was to make it at least work with the examples to unblock a friend of mine, who would like to try this library out. So I didn't know how to make it proper.

Another thing I've noticed is that JSON format is not longer compatible with the latest compas, but I couldn't find an easy fix for it.

@andrusha andrusha deleted the main.compas_viewer branch October 21, 2024 17:45
@tomvanmele
Copy link
Contributor

i've fixed the JSON files. on my computer (OSX) all examples work.

a few things are still remaining:

  • replace groups with buffer geometry
  • add proper arrow implementation

will try to fix those later this week.

@tomvanmele
Copy link
Contributor

btw, if you are on windows or linux, please let me know if there are still problems...

@tomvanmele
Copy link
Contributor

@petrasvestartas could you test this on your machine?

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.

2 participants