Showing posts with label repairing a mesh. Show all posts
Showing posts with label repairing a mesh. Show all posts

Tuesday, June 18, 2019

Blendering a remixed Treasure Puzzle Box

A friend wanted a puzzle box that could hold one thousand crisp US dollar bills.

The first step was to figure out how much space would be necessary, which gets messy with imperial measurements. 1000 bills stacked on each other - 4.3"? What is that on a ruler? I added 5%, as a safety. (4.5 inches became 115mm.) 2.61" by 6.14" were converted to mm, then rounded to 70mm by 160 mm. Then I created a "cash-block" in a Blender file, designed as a testing metric. Similar to software engineering, if you come up with your tests beforehand, you can test to the challenge. (Otherwise, it is similar to writing a question to an answer you have written down already.)

The next step was finding an initial puzzle box. I chose this steampunk version from Thingiverse, and imported the stl files into the Blender file. Obviously, it's not big enough internally to hold the money. Using the MeasureIt plugin, I mapped out the existing internal measurements, in order to do casual scaling of the object on the appropriate x/y/z axis (130% x 120% x 244%). It wasn't necessary for the box, but I wanted to keep the same scale for the other parts.

With that said, there are issues. The steampunk gears decorations on the side stretched more on the z-axis, as did the compass rose. No good — so I switched to wireframe mode, the edit...selecting all of the gear & compass vertices on the outside of the box, and deleted them. Then I rebuilt the faces. A simple box. But...no decorations. To deal with that, I imported another copy of the base box stl into the project.

You'll notice a vertical measurement of 134.99mm. I added more overall space for the lock mechanism, as well as a plate for the locks to rest on — don't want to damage the dollar bills when the locks turn.
With the "old" version of box, I went into wireframe (z), and edit mode. Once again, selecting all of the vertices of a single gear. It'll pick up any of the faces as well, which is inconvenient for the spaces between the gear teeth. Oh well. With the vertices selected, "p" lets you separate by selection. Switch to object mode, select your new gear object, go back into edit mode. Using face select, I chose all of the ugly, not-needed faces between the gear teeth, and "x" to delete those faces.

The import process isn't always clean. Most of the time, you can ignore the cleanup. It will sometimes cause issues with edge select, selected an edge while holding down shift-alt (OSX). If you do have awkward faces/edges, you merge vertices to a "corner of a plane" vertex, using alt-m and then merging to the last one selected.

If you look at the two horizontal lines, there should just be one face (or two faces, if you have a diagonal line, like the faces above the selection. It probably wasn't designed this way...just a function of importing an stl file.
Getting back to the gear as a whole, let's assume the edge select with shift-alt selected the back edge of the gear. I (e)xtruded those edges by 2 to thicken it, then use "f" to fill in a face for those edges. As a best practice, try to merge only solid piece to another solid piece. (Either by using control-j to join, or boolean>union — I prefer Boolean>Union.)

As I finished each gear, I dropped them into a new collection just for gears (a feature of Blender 2.8).

The compass rose turned out to be...problematic. I wonder how much of it was from the STL, vs. how I took it apart in Blender.



You can see how the faces behind the star work, instead of the separate faces connecting between the spokes. When I saw all of those weird lines, I knew from experience that those faces would need to be cleaned up.

I deleted all of the bad faces, rebuilt them by hand. For each of the 8 face areas between the compass rose spikes, grabbing the vertices in edit mode with the (c)ircular select tool, then making a (f)ace.

There were also some non-manifold faces/edges on the back of the 4 tips, as well as edges/faces BEYOND the other faces already cleaned up. Those non-manifold pieces were just deleted. (Sample selections as viewed from the back of the compass rose.)

You can see the top tip highlighted - it had multiple edges that needed to be cleaned up as well, where it touched the back ring. I would guess this was a function of the software made the original remix.

After those were done, from the back side, I selected the outside edge and the tip edges, and made that a (f)ace. (Everything was now manifold - no air gaps.) I made the whole thing thicker, and recessed the separate faces between the compass spokes. I was a bit concerned that the detail might get lost, with a larger puzzle box...and it make it easier to Boolean>Union with the box.




I made the compass rose and gears 160% bigger on the x-axis and z-axis to match the box's ends, and 120% thicker on the y-axis to make it similar in look. They were put into their own collection.

The final box — the hinges stick straight out, but the rest of the box is accurate.



Thursday, November 1, 2018

Figuring out bad meshes in Cura and Blender

One of my recent quick projects was making a simple "D" with a cut for a magnet. I was using magnets from my first project on Thingiverse, so I started by appending the "white" portion of that Blender file.

The benefits of appending, means that I get the Blender object, without having been converted to an STL. This means if I do edge loops, Blender already knows how to play with it...and I can use my current Blender startup file, instead of the dated one I used two years ago.

I switched into edit mode after the append, selected all of the planes of the magnet-holding portion, and hid all of that. I then selected the rest and deleted it. Looking back, I should have just done Control-I, to invert the selection. Oh well...un-hid the ring of planes and made it a cylinder (select an edge with Alt-A, F to create a face, repeat it for the other end of the cylinder. Renamed it Magnet.

Back in Object mode, I added Text, Edit Mode to make it a D. Object mode, Object>Convert to>Mesh from Curve/Text. I went back into Edit mode to scale the interior of the D in, so it would be a thicker letter. Boolean>Solidify>Thicken 1mm...Apply, easy.

It should be a simple matter just to Boolean>Difference the magnet out of the D...and it was. Opened the STL in Cura, and it was ready to print. But there's a red bit. Huh. (I'm posting the fix above it, the broken original beneath.)


It probably would have printed, but it also means something is wrong in the design.

Running Blender 2.78 on OSX, I re-examine the cutout...it's a slightly different shade. It's an easy enough fix, reseting normals in Edit mode. Mesh>Normals>Recalculate Outside. But it doesn't explain why this was a problem!


Remember my first steps? I used the magnet sizing from the STOP sign...and the cylinder part inside-outside normals were flipped. When I made the magnet cutout, by using those cylinder sides, it used those same normals. You can see the Magnet object that is off-color. (When I was doing work, I hid objects and never saw the color difference.)



Be wary of Boolean cuts with bad normals!

[The solution is: fix the normals on the "bad" magnet, so the colors look correct. When you use boolean on the D to remove the magnet shape, it will have the correct normals.]




Thursday, April 19, 2018

Blender Things I Did Not Know (Part 1)

Blender has a lot of techniques, for doing the same thing. It's great, in some ways - multiple paths to find a solution. There are faster techniques, there are more accurate techniques. If you're like me, you watch tutorials on YouTube when you're considering a problem.

At two years into Blender, I know some things. It means that tutorials will typically cover 95% of what I already know, and...I have to watch the whole thing to squeeze out 5% of the value.

This starts sharing my reading list of things that I didn't know.

Joining, Merging, and Filling Holes:

Repairing a Mesh

I've used his first two methods. "(F)ill" has always been "(f)ace" in my head. His second method, he chose a single edge to make a face from. I usually (f)ace from two opposing edges, or the 4 vertices. A single edge? Well, saves me small amounts of time.

His third method, eek. I didn't know the "alt"-when selecting an edge helps with edge loops. (Saves me button clicks of Select>Edge Loops.) And I didn't use J to join to vertices to make an edge within a plane...I've been using the Knife Tool. The Knife tool has some cool benefits to it, but J is fast.

Jimmer's 4th method, not covered...I would have extruded a vertex along a x/y/z axis to get a corner, and get the x/y/z axis correct by inputing the numbers in (make sure you are in Global, not Local). Create edges to the other axis vertices (f). Subdivide the edge a correct number of times, make faces. You only need to get coordinates right for that corner, and subdividing is a fast Ctrl-E away...you can add more than one cut as needed.

Reading the YouTube comments, there was some slightly more complex things to get vertices lined correctly, using the third method. Change the Pivot to Active Element (this is found on the bottom bar), grab the vertices you want to line up, and the final one is what you want them to align with. Then (s) for scale, (y) for the y-axis, (0) to zero them. Interesting and fast.

Normals

A friend asked me how to fix normals when importing things in from Maya. I wasn't familiar with it, so I basically just pointed to Mesh>Normals as the solution. Sometimes when working in Blender, I've noticed off-color faces...I had to delete faces, rebuild them...I now understand what those faces mean. And what the Shading/UVs tab in the upper right gets you....and you can Flip Direction on a single face. A much faster and cleaner response to the occasional "Blender doesn't know what you're doing" trigger.

Monday, October 3, 2016

Optimizing prints (aka the BB-8 cookie cutter)

There's a lot to catch up on - I print about 20-50 hours a week, and there's so much information to share.

Recently a friend asked for a BB-8 cookie cutter. Yes, designing from scratch is awesome. If I were to print only things I designed...egads. I found a nice one with not TOO much heavy design on Thingiverse. It turns out to be 5" tall and 4" wide...a little big for my tastes in cookie size. (Incidently, it allowed commercial use - Etsy had several of these...$6-$7 apiece for 60 cents of plastic. Maybe more cost-of-goods, depending on the maker's cost of plastic...I had gotten some random PETG filament from makergeek for $18/kg.)

Adding a link to Imgur for the next bit.

I remixed the cookie cutter in Blender to give it a lip to help pull it off the cookie dough. In the Cura slicer software, I scaled it from 100% down to 50%. It looked good in Cura - print! It lost lines...but..why? Well, print it at 60% - more lines back, but not complete.

I could have continued to print over and over again, until all of the lines came back with the object creeping back up in size. At this point, we can assume that the line is just too thin to print occasionally. (This was a learning moment for me from here on.) One - how do we keep a smaller size, and two - how do we identify a bad print before we waste time and plastic?

I'll start with identifying bad prints. Cura has something call the LAYER mode in the upper right corner (where it starts with NORMAL). Right there, I can see where items disappear. Now we have that nailed down, we can look at possible fixes to the object file before prints...great. Incidentally, 90% seemed to have all of the lines back - it was too big of a cookie though.

Next, getting a small size, we'd run into the same situation if we just did scaling in Blender instead of Cura. There's a useful plug-in for Blender called "3D Printing", already included...you just need to turn it on. (It'll show up as a tab on the left-hand side, if you have an object loaded in Blender.)

In Blender - select the object, go to edit view, and de-select all. ("a" selects all or deselects all.) Then click the "Check All" box in the 3D Printing tab. Down below, you'll notice the Output box is now full of information. (If you want to fully duplicate my experience, download the cookie cutter, scale it to 70% in Blender, then do the above to see the output.)



Let's make another change before we go further - Thickness is the size of your nozzle. My Lulzbot Mini has a stock nozzle of 0.5 mm. I'm running the standard blender unit scaling, which means 1 blender unit = 1 mm. If I set the Thickness at .7 - the Output display will show a lot of Thin Faces. If your nozzle/Thickness is .3mm, you'll have much LESS for Thin Faces. This makes sense - a bigger opening = bigger lines; small opening = thinner lines.

Depending on your nozzle and calibration accuracy - you might consider changing the thickness setting. I think I was fortunate starting out with a Lulzbot Mini for my first experience into printing (no calibration necessary, even after a year).

At .5 Thickness, it shows me more thin faces than I need to be concerned about. I only care about the walls that are too thin - not the bases or tops. Click on the "Thin Faces" box in output - it will select all of the thin faces. Fix the walls that weren't printing, Check All again, fix walls...then check the new object file in Cura. It's possible that you'll need to go back to fix walls before printing, but I had good fortune. Printing it at 70% worked out great - my first run after my adjustments had no errors.

Below is the image of the "thin faces" I mentioned:


Good luck!

EDIT:
As a follow-up to this article, the current release of Blender has the 3D printing information as part of the object information ("n" when you're selecting the object). I haven't upgraded yet, but moving from a plug-in to part of how Blender is used is a great acknowledgment on how Blender is developing. I've been using 2.76, I think 2.78 has this feature but is buggy in other respects.