CAD cleanup unbevel - but bad topology

CAD will mostly be all hard surface modeling. Most of it is larger slightly curved, or flat faces, then where those connect, you’ve got a bevel (CAD usually calls it a fillet if it’s curved). But NURBS are tricky to mesh, so it makes sure that the vertexes touch (usually), but that causes triangles. Lots and lots of triangles. And at first, the points aren’t even joined, when coming from Rhino at least.

So first step, just all the vertices that are actually sharing the same space. Great, you just screwed up your normals. So add the weighted normals modifier, and that’s fixed up. Go ahead and apply that, it’s not like you’re done here.

So you’ll be best off, if you simplify all the main surfaces, and redo all, the bevels after you fix up the topology a bit. But…how do you get rid of the bevels? Rhino actually can’t do that. It’s a pretty destructive software. Their solution, is to tell you to keep a version on another layer that isn’t bevelled. Oh, thanks!?

Fusion 360 is pretty awesome at doing that, but it takes some time. And honestly, I’d rather not support Autodesk. We still have a license of it because it’s currently coming free with Eagle, a PCB board software. You can just select pretty much any shape, delete it, and it automatically extends the adjacent faces to meet eachother where they would intersect without the shape. So delete holes, bevels, chamfers, an entire half of a model. But it takes time to select them all. And that’s just another software you have to bounce through.

So Blender. There’s got to be a way to delete a selection of faces, and extend the other faces, right? I know it’s not going to work on curved surfaces, because Blender doesn’t understand “A curved surface” when it’s part of the whole object. If you have an arc surface, it has to be segmented, and all blender would be able to figure out is how to extend the last piece. But that would be “good enough.” I don’t think you’d end up with fillets that are large enough to remove and also cause an issue anyway.

I have MeshMachine, and HardOps. Neither really work with bad topology. I’m trying to figure out some fast ways of creating good topology out of these with really high accuracy, but repeatable and fast. One of the biggest hangups is removing bevels.

I can select them all easy enough, but I want to remove them and just extend the other faces so they all join together. Then I can do a limited dissolve and have very little work left to get the model to be decent topology.

This kind of remove bevel shouldn’t be too hard to write in Python. Just check the normals of the selection, if there are no non-manifold surfaces, just follow the normals from the surrounding mesh to join at the middle. You basically loop through each triangle and use the other triangles to cut off the parts that aren’t directly connected to the surrounding faces.

Of course pictures might help if I’m understanding you correctly. You just want to remove a bevel from a mesh.

edit: Ok, I tried it but it requires the same type of thing as @howardt has done with Inset Straight Skeleton, just in 3D space, instead of 2D. So it’s not trivial to implement after all

edit: I made a quick proof of concept.

It kind of works, but isn’t perfect.

If you have a Rhino6 license you can download Rhino7 WIP and use the new Quad Meshing to make better topology.

You can also download a trial of Moi3d which has the best quad meshing from CAD surfaces.
Considering Moi is less than half the cost of Rhino, it may be a the best deal around to create better meshes from CAD models.

Maybe this will work https://gumroad.com/l/rebevel%20
Or u could send me problematic geometry blend file

Sending example files and what you want to achieve would certainly help.

Well, we already have, and use Rhino. So that’s why I’m using it. And I do have the beta. But the quad mesh output doesn’t really work well with smaller fillets, and completely falls apart with small holes. It doesn’t to great with large holes for that mater either. And it takes a Long time. I’m sharing two objects from a file that has 203 objects. That’s after removing a Ton of screws and parts that I’ll never see. 203 is pretty low. Often times I’ll have between 500-700 parts for one product. I don’t have to create “good” mesh for every object for sure. But it is quite useful for UV unwrapping, when needed, deforming objects that engineers don’t like to model bent even though they should be, and reducing a model if you hope to see a representation in VR or something like that.

I think that rebevel tool will have the same issue as meshmachine. It’s expecting quad mesh. I think the only way it might work is if the user is able to select an entire bevel, and the plugin extends each edge until it touches the opposite edge. It looks like most of the rebevel tools out there right now are sliding the edges all at once, until they reach the point where they would merge. But that method only works if you have, not only quad mesh, but quad mesh with edge loops that define the bevels, right?

Here’s an example of the mesh topology:


fromRhino.blend (3.7 MB)
And I’ve attached that file, which has two parts in it. Both are from sheet stock, so really only the front facing surface (designers/engineers call that the A surface) needs to be cleaned up, then just add the thickness of the material, and often times can just do rim only because you’ll never see the backside.

I did some very basic cleanup. I’m using the Rhino importer, which just imports the Rhino viewport mesh. The Rhino viewport mesh, every surface of a part is basically it’s own mesh. The vertices Touch, but they are not merged. So I merged by distance with the distance as .001in, so basically only if they are touching. Then I added autosmooth and weighted normals, which I applied. So my file is quite a bit smaller for uploading to you folks. In the weighted normals, I check the sharpen checkbox, which is why we see the blue line on the hard edges. That makes selecting the backside easier.

Next I would do a limited dissolve, because the sheet metal part is completely flat on some of the sides. Notice though, that as the pieces are bent, there’s a tiny radius in there, which throws another wrench in simplifying the mesh. IF I can find a tool to eliminate the radius for me, I still need to carefully do them in the correct order, so I can add them back in with hardOps or MeshMachine. (or just a bevel modifier if that’s the way to go)

The plastic part is Definitely harder because the legs have a curve on the top and end surfaces. It could be worse though, and be a compound curve. But compound curved surfaces are not easy to do in engineering software, so it’s rare that designers are even able to talk them into it, unless they are talented enough to create the surfacing in SolidWorks or ProE themselves.

Just to be clear, I’m not asking you folks to Do this for me. Like i said, I have a couple hundred parts in this file, and I don’t even have this one blender at the moment. For faster things I’m using Keyshot, and I’ll continue to do that until I can get a good workflow in blender. I’m just hoping to learn some ways of fixing this sort of thing up. Once I am confident I’ve come across most all of the best practices for cleaning up other people’s CAD data, I’ll return the favor to the community and create a youtube video showing how to handle it.

1 Like

So you don’t want to remove bevels, you just want to clean up a CAD mesh so that it’s in good quad topology? There’s doesn’t seem to be many good automated ways to do that outside https://exoside.com/quadremesher/ who some people have had success with.

If you are not happy with Rhino quad mesh, try Moi3d.
I don’t know that it will absolutely work for you, but its worth a try if you can avoid having to fix mesh topology after it has been exported from CAD.

Can you post the untouched imported blend? I think some of your cleanup has removed useful geometry for the things I’d like to try.

fromRhino_Untouched.blend (3.7 MB)
I’m actually surprised that the file size is nearly identical. Maybe that has something to do with orphan data? Anyway, I just imported it, and saved. No changes. So at the edge of every surface, you’ll find duplicate vertices.

And yes, I could try Moi3d. That’s just another software to buy and worry about.

I DO want to remove bevels. I’m hoping to end up with clean nGon surfaces for flat objects, and only necessary quads for others. @ambi your plugin looks to be pretty good, but since I’m using Rhino I’m not sure it’s more useful than the existing rhino importer for blender. I’d have to export to step every time, then import that. If it handles the mesh in a way that helps me clean things up though then totally worth it. I’m buying all the blender stuff out of my own pocket though. Work has really cut down on buying things they don’t deem absolutely necessary.

I’ll try out Moi when I have collected a few good examples. One reason I want to figure out a way to clean up pieces like this is my idea workflow would be to import then entire file. I’d only fix objects that need fixing, as I realize they need fixing. Avoiding having to go back and forth Might save quite a bit of time. Right now, I’d have to go back to rhino, export to step. Import to Fusion 360, defeature all the fillets (which is a Lot of selecting because you have to pick each surface one by one), export to step, import to rhino, import that part back to blender. Simplify the mesh, add bevels back, which are now quad yay. And that’s a lot of moving data around. If I can just get rid of the fillets, it’s actually pretty fast just to completely remodel most things. Snap to corner, snap to corner, repeat, fill. Extrude edge, snap to corner, etc. For nice even curves, add a division on a face, pull it straight out, then bevel it. It’s pretty darn fast. But there’s nothing to snap to if you’ve got fillets everywhere.

I understand what you are saying.

However, if you can end the difficulties you are talking by getting a good quad mesh without modifying the fillets or fussing with the mesh topology after the export, it sound like it would be a win.

You could easily justify the minimal cost in time savings.

I was messing around with zbrush’s zremesher and came up with this. Not sure if it’s usable or not. I don’t think that cad file is super clean. Noticed a lot of holes in it. You could always just topo a quarter of it and rotate around and join.

zremesher.blend (2.9 MB)

ZRemesher/QuadRemesher is so good. I forgot to try out QuadRemesher on my desktop at home where I have a license. I assume you could get an equivalent result from Blender with the addon. It’s not expensive at all imo, either.

Ha, reading through some of your code, I like your notes. This is definitely the type of method, I think, that I was thinking might work, at Least for things like bent sheet metal because it’s mostly all flat surfaces. The “bevels” really are just the bends of the sheet metal, so sometimes aren’t even needed.

The goal here isn’t just quad mesh. I think folks are focusing on that. The reason I mentioned that is because since it isn’t quad mesh, I can’t remove the bevels easily with some of the nice existing tools that remove bevels. They work by selecting the rings of the bevels, but with this data you can’t do that.

Sometimes I’ll just leave the bevel off completely and just fake it in the render. Often that’s “good enough”. For larger bevels, or something that is more details, I’ll add those in. But I’m looking to just help myself remodel things. Getting rid of the bevels is the most difficult part. For the quad mesh most people are showing, it’s decent looking mesh that holds the shape Fairly well, but that’s not how you’d model it right? So it would make UV unwrapping, where necessary, easier but other than that, it’s not accomplishing much. Unless you need to bend things, change the model, or help you deal with UVs, you really don’t need quad mesh for product renders. But looking forward, I Am looking at some workflows to show larger things in real-size VR now that it’s built in to blender. So not having 7 million polygons helps a little. So I’m after being able to speed up REmodeling the model in blender. If I can just get rid of the bevels, then I can simplify the rest really easily with limited dissolve, add new bevels with something like hardOps, and move on to the next piece.

I imported a food truck kitchen recently which was made of nearly all boxes. But they ALL have bevels on them. In that case I found a “make bounding box” tool, and just used that for those items. But pretty much anything that isn’t machined or built by hand has draft, so although the surface might be flat, it’s not quite as simple.

@ambi I’d love to test out your script on a few pieces. But I’m a bit new to blender still. Can I just copy the text from there and run that as a new script in the text window? Seeing where it works and where it fails might give some ideas on how to solve for the issues.

If there was a simple, automatic solution for going from a high poly mesh to low poly automatically while keeping the forms, everyone would know about it and be pointing you to it because it would be a huge production saver for games.

You have to work with everyone in your asset production chain and figure out where efficiencies can be introduced for people up and down the chain. It’s all going to be trade offs and how much influence you have on the process.

If you can go higher up the chain and get geometry before bevels are introduced, obviously that’s going to be a speed increase because then you don’t have bevels to worry about in the first place.

If you can’t, the fastest solution for you based on what it sounds like your low poly requirements are might just be retopologizing your 7 million polygon mesh just to make Blender more responsive, and then using something like Retopoflow, SpeedRetopo or even just plain Blender with snap to face to create your low poly, bevel free geometry.

I understand where you’re coming from, but I didn’t say simple or automatic. I’m just trying to find out some good ways.
And yes, using snapping to just recreate the geometry is pretty efficient because you get to make the geometry choices as you go. But with bevels, that’s only so useful. That’s why I was looking for some ways to get rid of bevels right in blender.

Often I’m heading to blender after already being in Keyshot. The workflow to get high quality renders in keyshot is just faster than blender. I’d like to figure out some ways to narrow the time gap because keyshot Definitely falls short at quite a few things.
But even if I go up the chain, the products are created by multiple designers and engineers. No one creates the entire model Then adds fillets (what blender calls bevels). And this isn’t a production line for games. It’s creating actual physical product, and I’m just making renderings, animations, etc usually before that’s all finished.

Also, in just a day ambi came up with a script that shows promise? Sometimes just talking through what you’re hoping for gives people who know how to code some ideas on how to accomplish things. I’m not asking for instant good geometry. I’m asking for removing bevels. And maybe there are some other tricks people are using to clean up CAD data that I’m not aware of yet. Sometimes there are just a couple little errors, but if you’ve dealt with that data before, you probably know it’s not as simple as just merging a few nearby vertices because that will screw up the already odd normals that the CAD software outputs. It’ll remind you of Hal changing the lighbulb in Malcom in the Middle. (funny gag if you haven’t seen it) You go to fix one tiny thing, and somehow end up completely remodeling that piece.

And you’re right. So far, I’ve found the thing that makes blender the most responsive is to do this for every piece of geometry, then go back and address the ones that didn’t turn out great:
Merge overlapping vertices
smooth shade, in case it’s off
autosmooth at probably 44deg (that’s seemed to work out the best, and avoids smoothing if there are actual 45 degree angles)
Limited dissolve at .5deg just do get rid of the majority of geometry on completely flat surfaces
Make quads, just to eliminate a few triangles that aren’t needed
add weighted normal modifier with sharp checked
apply weighted normal modifier (can this be done in the same way without a modifier? Not sure yet)

Then just go back and fix things that got noticeably messed up. Rhino viewport mesh isn’t perfect, but it’s fast. Outputing quad mesh is Painfully slow, and doesn’t even truly stick strictly to the surface edges even when you tell it to, and at least in Rhino WIP won’t even let you do it if there is too much data. But, it’s still WIP. I haven’t tried Moi Yet, but work isn’t going to let me buy anything…probably for the year. So unless I can wrap it up in a client project, then I won’t be buying it.

I missed his edit. I thought you were talking about his post about quadremesher. Whoops. :blush:

Corporate protocol strikes again, oh well.

Yeah, I mean it’s not really corporate? We’re pretty small. But hey, we all still have our jobs at least. No raises this year either.
But I’m buying some things on my own. I bought boxcutter, hardops, and meshmachine out of my own pocket for myself. There are a few other things I’d like, but I’ve gotta space this stuff out or the other person that looks at my home finances is going to question my purchase history. :wink:

Like i said, I’m trying to figure out if I can get a workflow figured out for blender that meets or beats keyshot. The rhino importer, so long as you touch the mesh at ALL, is fine. Setting up the render output and the lack of material library definitely slow things down a bit. PBR adds a ton of realism though, so that might be my next personal purchase, a decend PBR library. Then I can keep adding to a material library on my own. HDR environments help as well, but have a general lack of control. Keyshot has HDRlightStudio basically built in. But that also has some severe limitations, which is where Keyshot falls short. Add a physical light in Keyshot and your rendertimes suffer Greatly. Need to have a transparent object not cast a ridiculous amount of shadow? You can’t use GPU to render.
But keyshot also lets me output a material_ID pass, a “render layer” pass (which can have Similar effects to cryptomatte? but is also fairly limited), and a few other things and save them all out at the same time with Very little setup. I still have to learn how to set that up in blender, and see if I can re-use the setup for the next project easily.

So there’s a lot to do. But one pain point is this, finding the most time effective way to essentially re-model some geometry that ends up being problematic for some reason.

I made a release on Github https://github.com/amb/ambitools/releases/tag/v1.1.18
Tell me if you get it working (just download the .zip and install normally through Blender, then enable addon). It’s a pretty rough draft, but could be useful for somethings.
It works by extending the surface and then clipping with self-intersects. Won’t work for corners (like in video) or surfaces that have varying directions (concave/convex).