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

CAD->bisect node. Fix fill holes on complex objects (ex. torus). #4803

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

satabol
Copy link
Collaborator

@satabol satabol commented Dec 8, 2022

Windows 11, Blender 3.3.1, Sverchok-master

ex. #4799 if replay with Bisect then result is unexpected too:

image

But Blender do bisect well:

image

What the problem? The part of problem is in operator bmesh.ops.bisect_plane. The Bisect Operator does not fill holes! (Unexpected!).
See:

https://github.com/blender/blender/blob/3780a402651aeac0caa86767f823a8517a6f8bae/source/blender/editors/mesh/editmesh_bisect.c#L322-L333

image

But how Blender do fill? It do fill later with triangle_fill operator (https://docs.blender.org/api/current/bmesh.ops.html#bmesh.ops.triangle_fill)!

https://github.com/blender/blender/blob/3780a402651aeac0caa86767f823a8517a6f8bae/source/blender/editors/mesh/editmesh_bisect.c#L346-L355

image

But how Sverchok do fill on bisect [see line 49]?

# this needs work function with solid geometry
if fill:
fres = bmesh.ops.edgenet_prepare(
bm, edges=[e for e in res['geom_cut'] if isinstance(e, bmesh.types.BMEdge)]
)
bmesh.ops.edgeloop_fill(bm, edges=fres['edges'])

I think this is a problem. So I try replace bmesh.ops.edgeloop_fill to bmesh.ops.triangle_fill. And I got next result that look good:

image

Bisect 001

With joined mesh:

Bisect 002

Suzanne tomography:

Bisect 003

Suzanna has non-manifold geometry so glitches are expected.

for test this pull request: https://gist.github.com/78671a6264b9255acbb3883779fefc73

@satabol
Copy link
Collaborator Author

satabol commented Dec 8, 2022

https://gist.github.com/8d13133a0b642422bf396005369c80de

Play with some noise transform of torus:

Bisect 004 edited

Bisect 005 edited

Attention for noise scale! Do not overlap source geometry with noise. Scale must not be big.

@satabol
Copy link
Collaborator Author

satabol commented Dec 8, 2022

It is very old function.

image

May I ask somebody for approve or test? (I did several test and did not see unexpected results but I believe it is very important)

@satabol
Copy link
Collaborator Author

satabol commented Dec 9, 2022

Can't stop play with that:

https://gist.github.com/f397c61f7275217008fb28b29bdfb260

Bisect 010 edited

image

image

@portnov
Copy link
Collaborator

portnov commented Dec 9, 2022

Huh. If you will be able to make the Waffel node do it's work for this thing, you'll probably be able to CNC it :)

@rendetto
Copy link
Contributor

I've made a test with one of my interactive scenes and it does not affect the performance.

@satabol
Copy link
Collaborator Author

satabol commented Dec 11, 2022

@rendetto Thank you.

@satabol satabol merged commit ebb935a into master Dec 12, 2022
@satabol satabol deleted the cad_bisect_fix_fill branch December 12, 2022 06:04
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.

4 participants