Im working on creating a ShrinkWrap plugin that does some custom things. One thing thats plaguing this project is these objects in rhino. They are caused by overlapping surfaces from what i can gather and will not shrinkwrap. When i convert them to mesh they are invalid. I can fix this in rhino manually by FillMeshHoles and them repairing in _meshrepair however i cannot get it fixed in RhinoCommon. I convert breps to mesh, then iterate through each mesh and if its invalid and open (these objects are both) then fill holes and repairNormals. This isnt solving however. Any advice?
shrinkwrap needs a closed volume to work properly.
can you post this file?
Sure thing, ill post it tomorrow.
open.3dm (1.6 MB)
Here is the file Kyle. Thanks.
so I scabbed, and I do mean utterly scabbed the back closed, then ran shrinkwrap on your part at .008 edge length (no hole filling, 10% optimization, no smoothing)
Note the scabbed surfaces normals
are not even facing the right directions…
and it wraps fine.
open_kfix.3dm (3.9 MB)
Thanks Kyle. My goal is to get these fixed up within a shrinkwrap plugin im making. Do you have any advice for how i can identify these pieces when a user inputs their entire model?
When its a paleosurface its closed and valid.
When my plugin converts it to mesh its then open and invalid, however is it easier to fix this as a polysurface?
automating that will be a bit of a mission because you have to sort out what connects to what in order to scab the back closed. Doing this reliably with any pile of surfaces you throw at it will be very difficult IMO.
How to do that is a question for someone who did not go to art school…
@Trav any ideas here?
“Do you have any advice for how i can identify these pieces when a user inputs their entire model?”
Most objects in RhinoCommon offer info about them like IsSolid, IsValid etc.
For example: https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.brep
ShrinkWrap is also available via RhinoCommon.
" I convert breps to mesh, then iterate through each mesh and if its invalid and open (these objects are both) then fill holes and repairNormals. This isnt solving however. Any advice?"
The ShrinkWrap command already does what you just described. Where you’re probably having issues is when FillMeshHoles cant correctly solve the open areas. For that you’ll have to find geometry edges and try to fill in the voids with some sort of custom logic. ShrinkWrap should then figure it out just fine.
lol, thanks for your help! Let me ask one more question about ShrinkWrap while I have you here. In testing my ShrinkWrap plugin, I see a bit different results from the SW inside rhino. Specifically on the edge of some pieces, it adds a bit of a chamfer in my plugin. Could this be something in my meshing parameters? Been playing with these but just cannot get the result im expecting. _ShrinkWrap in Rhino works perfectly.
ShrinkWrap.3dm (1.1 MB)
Id say its your meshing parameters causing the issue. The Shrinkwrap command defaults to whatever the render mesh values are, which are set by the doc, or by any custom applied render mesh values.
Thank you!!
trav beat me to it… crank up the render mesh for a better SW result.
“The ShrinkWrap command already does what you just described. Where you’re probably having issues is when FillMeshHoles cant correctly solve the open areas. For that you’ll have to find geometry edges and try to fill in the voids with some sort of custom logic. ShrinkWrap should then figure it out just fine.”
When using the ShrinkWrap method in RhinoCommon, it only accepts meshes though right? or is there another way to do this without the mesh conversion prior to the shrinkwrap method? 10/4 on the rest, Ill work on figuring that out!
I added multiple constructors for ShrinkWrap to RhinoCommon. You can pass in geometry bases as well, which is how the ShrinkWrap command does it. You still have to specify the meshing parameters for the resulting meshes of the input objects.
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.mesh/shrinkwrap