compas-dev / compas_occ

COMPAS wrapper for the Python bindings of OCC
http://compas.dev/compas_occ/
MIT License
16 stars 9 forks source link

Brep plugin #19

Closed chenkasirer closed 1 year ago

chenkasirer commented 2 years ago

Edit:

This PR adds compas_occ plugins to the new pluggable compas.geometry.Brep. There's also a small bugfix and some open issues.

The pluggable Brep allows writing (somewhat) context agnostic code when working with a Brep, this is realized using the COMPAS plugin system and some backends (currently Rhino).

>>> from compas.geometry import Brep, Box
>>> Brep.from_box(Box.from_width_height_depth(5,5,5))
<compas_occ.brep.brep.BRep object at 0x00000198E97052B0>

This also allows serializing a Brep created in compas_occ and using is in e.g. Rhino

# in compas_occ
from compas.data json_dump
from compas.geometry import Box, Brep

path = r"..."

brep = Brep.from_box(Box.from_width_height_depth(5,5,5))

>>> type(brep)
<class 'compas_occ.brep.brep.BRep'>

json_dump(brep, path)
# in Rhino/Grasshopper
from compas.data json_load

path = r"..."

brep = json_load(path)

>>> type(brep)
<class 'compas_rhino.geometry.brep.RhinoBrep'>

Known issues:

What type of change is this?

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.

gonzalocasas commented 2 years ago

Tests fail because compas is installed from conda-forge and new Brep pluggable is only available in the unreleased COMPAS main. Have to wait for next release?

This makes me feel that we would technically need a new minor release, 1.18.x for COMPAS, so that we can bump the requirement here to greater than that. It would technically be possible to do it with the patch part of version as well, but it wouldn't be very semver-ish ;)

chenkasirer commented 2 years ago

Tests fail because compas is installed from conda-forge and new Brep pluggable is only available in the unreleased COMPAS main. Have to wait for next release?

This makes me feel that we would technically need a new minor release, 1.18.x for COMPAS, so that we can bump the requirement here to greater than that. It would technically be possible to do it with the patch part of version as well, but it wouldn't be very semver-ish ;)

Isn't 1.17 the next one?

Does it make sense in anyway to install COMPAS from Github rather than from Pypi/conda-forge? Or do we definitely want that COMPAS extensions only rely on released features in core?

gonzalocasas commented 2 years ago

Isn't 1.17 the next one?

you're right, sorry, I thought we had already released 1.17

Does it make sense in anyway to install COMPAS from Github rather than from Pypi/conda-forge? Or do we definitely want that COMPAS extensions only rely on released features in core?

I think it's a good idea that by default CI runs on released versions. For wip branches, we could change the github actions workflow files so that on the branch, the build depends on main instead, but it'd need to be reverted before merge.

tomvanmele commented 2 years ago

@chenkasirer @gonzalocasas shall we do a sprint this week to get 1.17 out?

chenkasirer commented 2 years ago

Sorry, was away this week. If you haven't done one yet, then I'm in!

tomvanmele commented 2 years ago

quick discussion about this in the afternoon?

gonzalocasas commented 1 year ago

@chenkasirer I'm a bit lost here, has this been superseded by other PRs after this, or do we need to revive and merge this?

chenkasirer commented 1 year ago

@chenkasirer I'm a bit lost here, has this been superseded by other PRs after this, or do we need to revive and merge this?

This was waiting for the first release of compas.geometry.Brep which was 1.17.0, I think, but since forgotten due to work mostly focused on the RhinoBrep.

I think this one is worth reviving - I'll refresh it and re-open.

In the grand scheme of things, there are still two tasks:

  1. Making OCC BRep a plugin for compas.geometry.Brep which is relatively trivial - is the purpose of this PR.
  2. Sorting out the OCC BRep serialization, which in the meantime has been removed altogether. This will require some more significant work and will have it's own PR.