-
Notifications
You must be signed in to change notification settings - Fork 113
Geometry brep #1057
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
Geometry brep #1057
Conversation
src/compas/geometry/brep/brep.py
Outdated
| type : {TopAbs_COMPOUND, TopAbs_COMPSOLID, TopAbs_SOLID, TopAbs_SHELL, TopAbs_FACE, TopAbs_WIRE, TopAbs_EDGE, TopAbs_VERTEX, TopAbs_SHAPE}, read-only | ||
| The type of BRep shape. | ||
| orientation : {TopAbs_FORWARD, TopAbs_REVERSED, TopAbs_INTERNAL, TopAbs_EXTERNAL}, read-only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this constants seem to be occ specific, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes they are. we could wrap this and make it more general so it applies to both/all backends...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about this: do we need an external/interface representation for these? In compas_occ I've only seen them being used via is_compound(), is_shell() etc.. If that's the case we don't really need a generic representation. Do you see a need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, no need...
tomvanmele
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good start! :)
| 'NurbsSurface' | ||
| 'NurbsSurface', | ||
|
|
||
| "Brep", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will need to expose vertex, edge, loop, and face as well...
| class RhinoBRep(Geometry): | ||
| def __init__(self): | ||
| super(RhinoBRep, self).__init__() | ||
| self.rhino_brep = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._brep?
and the same for compas_occ then, instead of self.occ_shape?
|
|
||
| @classmethod | ||
| def from_faces(cls, faces): | ||
| brep = Brep() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be implemented.
While we're here, this part will have to be a bit different than compas_occ. BrepEdge, BrepFace and even BrepVertex all don't have a public constructor and can only be created via the Brep instance (e.g. Brep().Vertices.Add(Point3d)).
Consequently, de-serializing a compas_rhino.geometry.RhinoBRepVertex alone does not result in a Rhino.Geometry.BrepVertex instance. Therefore, I imagine the de-serialized building blocks will be containing COMPAS types and the actual reconstruction of the native Rhino Brep will take place here, in from_faces. It can then also "inject" the native types to each of the underlying objects.
Do you see a better way to go about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, that makes sense to me. in fact, also in compas_occ we should try to funnel everything through the Brep class, and expose the other types only through the element accessors (.vertices, .edges, .loops, .faces), or for development pruposes.
|
|
||
| class RhinoBRepFace(Data): | ||
|
|
||
| TOLERANCE = 1e-6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a better solution for this.
also just in general, we need a formal location to store compas-wide configuration options...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gonzalocasas mentioned once these can be handled with some global COMPAS precision system. I'll look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i wouldn't necessarily call it a system, but there is indeed a precision setting compas.PRECISION :)
a more robust version of this that also allows for other settings would be a good thing...
tomvanmele
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an old review i forgot to submit so it might be a bit outdated...
| """ | ||
| Parameters | ||
| ---------- | ||
| data | ||
| Returns | ||
| ------- | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setters are meant to be documented on the getter...
| """ | ||
| Returns the native representation of this Brep. | ||
| Returns | ||
| ------- | ||
| :class: `Rhino.Geometry.Brep` | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason some of the properties and others not? perhaps leave this one out as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean why there's public access to the native type in Brep but not in the others?
I found this is useful at the moment due to the lack of a BrepArtist for example. That way you can plug-in Brep.native_brep to a GH geometry component to visualize.
Maybe once there's more extensive support for Brep in COMPAS it would make sense to remove this one as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no sorry, there were some crucial words missing...
any reason some of the properties HAVE DOCSTRINGS and others not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason ;)
Removed all docstrings from properties and added to Attributes instead.
| from compas.data import Data | ||
|
|
||
|
|
||
| class BrepFace(Data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i remember correctly this creates major problem in ironpython with memory leaks etc
WIP: added initial implementation of a
compas.geometry.BRepwith a Rhino backend incompas_rhino.geometry.brep.compas_occintocompas.geometry.BRepand generalized.compas_rhino.geometry.brepwith wrapping types for brep, edge, vertex and loop.data(in some also the setter but not tested)I could serialize a simple box brep with:
Opening this draft PR to start a conversation about the approach.
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.