[Add-On] [WIP] Clean Cad Data

UPDATE 1: Polyboy updated the addon to work in blender 2.8. I currently don’t have access to much cad data right now, but it seams to be working from what I can tell. Thank you Polyboy.

Hello everyone. In my attempt to completely remove 3ds Max from my life, the only step remaining up to this point was to find an alternative to converting parametric solid model cad files to a manageable mesh format. I do a good bit of work doing visualizations of 3d cad data created in SolidWorks and Inventor. Normally I use 3ds Max as an intermediate step to convert the cad files to a mesh format and to combine and repair material assignments.

I discovered Cad Assistant by Open Cascade (https://www.opencascade.com/content/cad-assistant) which does a good job at conversion from stl to obj format, but found two issues with the mesh files that it exports.

Issue 1 - Messy Meshes (Split Edges and Extra Faces/Verts): The mesh files imported from Cad Assistant contain loose parts for each nurbs surface. 3ds Max managed this well and welded boarder vertices between surfaces. With the broken seams from Cad Assistant, it took a significant amount of time to select each of the individual loose parts to assign materials or create vertex groups. Also, there were a tremendous amount of coplanar faces and colinear verts that had to be eliminated as well as triangular faces that were begging to be converted to quads.

Issue 2 - Duplicate Materials: Depending on the origin of the solid models, there are often many duplicates of the same material which results in many materials with the same base name (ie Stainless_Steel.001, Stainless_Steel.002, Stainless_Steel.003, etc.). To be fair, this also happened often with 3ds Max’s built in converters.

Once this add-on is installed it can be found in the Object menu of the 3d view. Select the objects you want to clean up and click Object>Clean Cad Data. The cad data will have vertices merged, split normals removed, auto-smoothing applied, unneeded geometry cleaned up and all materials merged. The auto-smoothing is fixed to a value that worked for 95% of my cad data. Because of this, some objects may require manually modifying the auto-smooth angle after applying the add-on.

This is very much a WIP. I’m not sure how often I will be able to work on it since I have a good bit of Viz work right now. This was also written by a beginner in python, so try not to be too harsh when it destroys all of your precious cad goodness. Definitely backup your work before you run this script on it.

The material merging bits were lifted directly from the excellent AF: Materials Specials by meta-androcto.

The current project I’m working on started with 1,791,603 verts at 193 MB and was reduced to 828,086 verts at 59.3 MB.

If you have any suggestions on new features or tips on how I could improve the python let me know. I may or may not be able to address any of these issues.

I hope someone else can find this useful!

Dan Pool

Download Here:

1 Like

Good stuff. Thanks and good luck

Standard CAD workflow issues, thanks for the effort.

Thank you!

Good work!! This was the thing I have been waiting for so long!


Are you working on this project? Does your addon work with 2.80, too?

I haven’t been able to work on this or another (bigger) add-on project I had just started for a few months because of a large modeling project we’re working on until the end of December. I haven’t tried it in 2.8 because I haven’t been able to work on it since before the code quest started. This add on is very lightweight code wise, so it will be a quick conversion. I can probably do that as soon as the python api is complete.