Add a new cleanup to 3D print tools #41093
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#41093
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
add_mesh_repair.patch
Hello!
This patch adds a generic cleanup functionality to the 3D print tools for a more holistic mesh repair. I think this would make Blender rival some of the top mesh repair software like Netfabb and MeshLab.
It includes making all the vertices face the right way and patching up any holes (removing non-manifold vertices).
The basic algorithm is:
The steps are looped until there are no more non-manifold vertices.
I developed the algorithm from experience.
I have reviewed a lot of mesh repair software:
http://caretdashcaret.wordpress.com/2013/07/17/how-to-fix-your-model-for-3d-printing-part-1/
http://caretdashcaret.wordpress.com/2013/08/09/how-to-fix-your-mesh-for-3d-printing-part-2/
http://caretdashcaret.wordpress.com/2013/09/26/autodesk-3d-print-utility-vs-netfabb/
http://caretdashcaret.wordpress.com/2014/05/19/meshmixer-first-impressions/
This patch passes all of my tests that I use for reviewing other mesh repair software.
I have a less-clean standalone add-on on my GitHub, but I think it should be integrated into the 3D printing toolkit.
https://github.com/caretdashcaret/MeshRepairFor3DPrinting
Thanks,
Jenny
Changed status to: 'Open'
Added subscriber: @caretdashcaret
In general seems like it can be nice functionality to have.
Some concerns.
To better handle cases of really bad mesh data which possibly can't be fixed, I think the loop that checks
while non_manifold_vertices > 0:
It should really check if any changes where made as well.So rather then looping while there is some manifold geometry, It should loop and keep fixing, as long as it can keep making fixes, Once no changes can be made - it can break out of the loop.
Other comments,
bpy.ops.mesh.remove_doubles(use_unselected=True)
why isuse_unselected
set? This is meant for merging unselected into selected, which doesnt make sense in this case?bpy.ops.mesh.fill()
takes asides
options, defaults to 4, probably good to set this. (and perhaps you want to set it higher? - not sure)bpy.ops.mesh.dissolve_degenerate
andbpy.ops.mesh.select_all
take a threshold argument. Probably good if this operator defines a threshold and passes it to all operators it calls which also take a threshold.refactor_mesh_repair.patch
Thanks for reviewing!
I did a pretty big refactor, to try to address the comments you brought up.
I now terminate the loop if it exceeds a max iteration as well as terminate it if nothing was fixed in a particular iteration.
The operator now takes some arguments for threshold and default sides to fill.
I saw the options were added for selecting manifolds, but I didn't see how to specify the option in the API docs.
[[ http://www.blender.org/documentation/blender_python_api_2_71_release/bpy.ops.mesh.html?highlight=manifold#bpy.ops.mesh.select_non_manifold
Hi, thanks for the update, I had a look and made some changes, interested to know if they work for you.
3d_print_utils_nonmanifold_cleanup.diff
Summery of changes
(totvert, totedge, totface)
, then keep cleaning until the same state is reached more than once.self.delete_loose()
once at the start (any reason you removed?)make_normals_consistently_outwards
until after all cleaning is done.It looks great!
Thanks!
I definitely learned a few things from reading your code. :)
I think I accidentally deleted
delete_loose()
.I was worried about postponing
make_normals_consistently_outwards
, since I wasn't sure how edges in between faces with opposite normals would count, but it looks fine.I tested it on Rakdos. It's the model that more naive repairs out there fail on. I can't attach the STL (or even a zipped STL) because it exceeds the size limit.
Do you think using unique
(totvert, totedge, totface)
will get false positives? Like the suppose the total number of vertices stayed the same, but the non manifold vertices themselves have changed (through some combination offill()
anddelete
). I'm not sure if this is likely or even possible.Regarding,
make_normals_consistently_outwards
- your right actually, I'll need to modify this to disableuse_non_contiguous
option, this way edges will be ignored between flipped faces. Probably theres no use in havinguse_multi_face
option enabled either (3+ edges to a face).Would you be able to upload the test file and link the URL here? - so I can check my edits work ok.
Re:
(totvert, totedge, totface)
giving false positives, think the likelyhood is so low as to not being worth worrying about (in fact impossible at the moment).... so I cant see chance that both stay same when an edit is made.
I've uploaded the files to GitHub. It's not a huge sample size, but I think it's somewhat representative of the cases.
https:*github.com/caretdashcaret/MeshRepairTestModels
@caretdashcaret - to be clear, does the current version of this patch work as you'd expect?
Yup! The patch worked great!
I think you've also addressed my concerns.
Committed
a88a2e6460
With some edits
select_non_manifold_verts
.Changed status from 'Open' to: 'Resolved'