Closed julienr closed 2 years ago
I've just tried latest meshcut.py from your git and there are still some artifacts :-/
Any ideas what might cause this? It almost looks like one of the coordinates is ignored...
the line goes flat instead of being at angle.
I would need to investigate this, I'm not sure what's wrong. I am currently quite busy, but I'll try to have a look when I have some time.
Trying to reproduce this: is this still with the hemisphere.stl
model ? The plane y=14.5
doesn't intersect the sphere, so I guess there is some scaling going on. I guess you are using another model. Could you share it ?
I am using this model:
https://github.com/vlachoudis/bCNC/files/2358797/sphere.stl.zip
But i've got very similar problems with sphere.stl from your repository. see following: https://github.com/vlachoudis/bCNC/issues/901#issuecomment-419243166
@julienr note it is Y -14.5 not Y 14.5 update: it probably does not matter, because model is symmetric in this axis...
but there are such problems in lots of slices... 14.5 is just example.
I've tried increasing close_epsilon
and dist_tol
magic numbers and it does not seem to help.
I am not able to reproduce this on the 1_stl_sphere_cut.py
example of meshcut. Here is an example with the sphere.stl.zip
that you gave above and
plane_orig = (0, -14.5, 0)
plane_norm = (0, 1, 0)
I tried to play a bit with various parameters, but couldn't find some that would reproduce the bug. Are you sure this is not a display problem in bCNC ?
Well. Maybe there's some problem in how i interpret the resulting contour, but it seems to me that sometimes there's one piece missing. Even in your screenshot:
We can close that slice path by returning back to the first coordinates, but not every slice should be closed as some models might not be manifold / solid and in such case the resulting slice should be open path. For example if you slice STL model of plane (eg. single triangle) you should get line (open path), but if you slice sphere, you should get circle (closed path). So i thin we should not always close the path, but rather figure out, why is the last line missing from slice.
Update: i had problem in bCNC. I had typo in code which automaticaly closes the contour. Now i fixed it:
I am quite happy with how it turned out.
Only issue is the non-manifold case. It's not really critical, as most meshes are manifold, however it would make meshcut more consistent if fixed.
I think that meshcut should close the path itself if needed. Now i close it by returning to original coordinates, but this might not be desirable for non-watertight meshes. See the last line of this code:
first = contour[0]
block.append("g0 x%f y%f z%f"%(first[0],first[1],first[2]))
for segment in contour:
block.append("g1 x%f y%f z%f"%(segment[0],segment[1],segment[2]))
block.append("g1 x%f y%f z%f"%(first[0],first[1],first[2])) #HERE I CLOSE THE PATH
if i don't include the last line, i get bad slice for manifold mesh. if i include it, i get bad slice for non-manifold mesh.
any news regarding this issue? 🤔
@unre4l Are you running into this with a non-manifold mesh ? Do you have a repro mesh ?
I've been quite busy, but I think fixing this would involve keeping track of the starting triangle and the ending triangle and if those are the same triangle, then it means the mesh is manifold and we can close the path. If the two triangles are different, then the mesh is non-manifold and the path shouldn't be closed. If you want to work on it, PR welcome. Otherwise, I can have a look, but I don't promise anything :)
Duplicate of #20, closed by #21
Follow-up from https://github.com/vlachoudis/bCNC/issues/901
In
examples/1_stl_sphere_cut.py
, with the settingsthis gives :