Monday, October 24, 2022

2D to 3D, using just Blender

One of the useful tricks for board game pieces is figuring out how to create a 3D object from a 2D image. I did an earlier version of this, using a different process. If you have the SVG file of the object, you can skip to Step 4.

 

Step 1 - Get a straight-on shot of the piece you will be making

The best objects are photographed from directly in front of the object, in good light, with enough resolution to trace the object well.

Step 2 - Importing the file

First, hit 7 on your keypad to orient the view to looking "from above". Next, shift-a will add an (i)mage, and use reference or background - choose your image.

It's useful to have the image in the center, and then to angle it so that it appears straight on. Use (g)rab and (r)otate to move the photo around.


Step 3 - Create the outline

Make sure to be in object mode - if you're in edit mode, it adds new meshes to the existing object selected. shift-a to add a plane, then (s)cale it down so that it fits to the object you are tracing. (Tab) will drop you in and out of edit mode. At this point, choose "select mode vertex" so anything you click on with your mouse will only pick up a corner. (d)elete 3 verticees, and then select the last vertex.   


Now, just (e)xtrude from the selected point around the entire object. If something doesn't quite match, you can use (g)rab to move the vertex around. To connect the final vertex to your original, just select both (shift and click to select more than one) and (f)ace to create a line.

For finer detail, add more vertices to the area. If not enough vertices were added in the first pass, select two adjacent vertices, control-e (or choose the edge menu), and subdivide it. More subdivisions, more vertices.

For less detail, choose one or more vertices, (x), then dissolve vertices.

This meeple needs a flat & even surface for its feet. Select the meeple's base vertices.


On the menu bar, there is a Transform Pivot Point, choose "Active Element". (s)cale (y) (0) will scale all 4 points on the y-axis to the "y" position for the last vertex selected.


Step 4 - Make a face and extrude to make an object

Still in edit mode, (a) will select all vertices. (f) will create a face connecting all of the selected vertices. Next, (e)xtrude (1) to extrude the face along the z-axis. (If it doesn't lock to the z-axis as a blue line, then (z) will lock/unlock it.)

Holding the center mouse button, then moving the mouse will change the view (the keypad 7 had locked to the view from above).

Step 5 - Adjust the total size of the object

(Tab) to go back to Object Mode. Click on "Item" from the side tabs.


Adjust the x-axis or y-axis to a known measurement. In this case, the y-axis measurement for the meeple's height is 16mm - adding that to the Dimension Y box skews your meeple along the y-axis. Copy the "scale" for y to the scale for x, to keep your x&y scale the same. Measuring the thickness of the meeple, adjust the Dimension Z box to 10mm.

To clean things up at the end of the process, select Object>Apply>Rotation & Scale to set the "scale" for x/y/z to 1. Sometimes slicer software expects this, and it is a good habit to get into regardless.

Step 6 - Export the object

File>Export>Stl will export the selected object as an .stl file, useful for 3D printing.

Conclusion: 2D is now 3D!

It's straightforward, it's brute-force, but it is also done.

Extra Credit: Using the Mirror Modifier

There are more tricks than what was shown here. The meeple is technically the same on its left and right sides, even though the outline isn't the same. Instead of drawing out the complete outline in Step 3, you can get by with only doing one half, then mirroring it.

 


Disclaimers: Have the "edge" to be mirrored directly on the x- or y-axis. Scale must be "1" and rotation 0 degrees following the process at the end of Step 5. The object's origin should be at 0/0 for the best results.

(Tab) to Object Mode and select the object. Click on the wrench for Modifier properties, and scroll down to Mirror under Generate. The default mirror is the x-axis, which gives the proper mirror for this meeple's other half. Check the "Clipping" box, so that the two halves merge at the mirroring line. Resume the design process back at Step 4.

      

Monday, July 26, 2021

Bang. Lulzbot Mini stops printing

 I still run two Lulzbot Minis, 1.04. They're durable and dependable.

Except for two weeks ago.

The BANG

I was making some custom Magic the Gathering coasters for a friend's birthday party. The last one to print was the Swamp icon, except...I was down to 1 meter of black filament. I thought I would be clever and do a two-tone. If you haven't read my earlier material, I covered doing it here.

When I switched over from gray to black, it went smoothly. I tried resuming the print from the Octoprint web page - and it choked. The nozzle crashed down onto the printing plate and I aborted. [Note to self: resume it from Cura next time?]

Future prints, it would run into an error during startup.

It would touch the first washer (front left), TRY to touch the second washer (front right) - but fail. At this point it would cancel the job.

Possible solutions:

  1. Nozzle is old and needs replacing - but it was making a connection on the first one
  2. Wire for the bed was broken - apparently the wire can be broken inside its casing
  3. The board was somehow corrupted and needed to be reflashed
  4. Bed was out of alignment - seemed reasonable from the crash
  5. Toolhead was out of alignment - also reasonable from crash
Nozzle is an easy but time-consuming replacement - I'd come back to that if needed.

Replacing the wire was unfamiliar to me, but I would do it if necessary.

Likewise, the brains (the board) - reflashing it is something I had never done.

And then I found this page - adjusting the "x" axis, which is the vertical. (Fixes the toolhead being out of alignment.)


It took some effort to get a good measurement, but it was easy enough to adjust.

Best of all it might even fix my 1.03 that's been sitting in a box for several years. Woo-hoo!

Adding Octoprint to Home Assistant

I still 3D print - home automation took over some of my time. It's still relevant to 3D printing though.

The useful links to my 3D Printing-related Home Assistant posts

Home Assistant Controlling Octoprint through MQTT - Chapter 1 

Home Assistant Controlling Octoprint through MQTT - Chapter 2 

Adding controls for the smart plug - also shows the dashboard

The benefits are nice - I can turn on the two printers, start the connection from Octoprint, preheat the nozzle, extrude, retract...my printers don't have LCD screens or manual controls.

The costs are not that much - a Raspberry Pi 3+ for Home Assistant, a 2.5 Amp plug for the Pi, and the Kasa Smart Plug if you go that route. Mostly time to get into it.

Thursday, May 14, 2020

Easter Traditions: the Dinobunny (and Sculpting 101)

My girlfriend likes dinosaurs. We have a wacky, inflatable dinosaur that's about two-and-a-half feet nose-to-tail, that got paper-crafted bunny ears at some point. I'll also state this post will feel very dated, as my sculpting abilities progress.

The Great Dinobunny. Every year, he'd hide plastic eggs around the apartment, containing a variety of objects. Some years it was candy, sometimes little dinosaurs or other toys. This year, I printed some eggs (we moved 4 months ago, not sure where things are), and the avatar of the Great Dinobunny.
Avatar of the Great Dinobunny

The project started with the 13 eggs from this design on Thingiverse.  They're a lovely design, printed well 95% of the time, a little longer/thinner than previous eggs - fine for the purposes.

Next, was the 3D Bunny Puzzle by Sakati, also on Thingiverse. As it's a No Derivatives license, I'm not posting the Dinobunny .stl back out there. The 12-piece puzzle is based on the Stanford Bunny, basically a project in 1994 where they tried to 3D model a bunny as accurately as possible for a computer to display. You can read more about it on Wikipedia in this article. I ended up making the dinobunny 13 pieces — I wanted the ear puzzle-piece to be printed white, with the rest of the dinobunny being green.

I printed the puzzle at 50% size, and it was nice. The tolerances were good; not too big, not too little. But for a dinobunny, I needed to do something more. Imported the puzzle into Blender - all of the pieces were imported into their proper space...no dragging needed!

Version 1: Crossbreed
Fixed up the head and the tail - tail was still rough
I haven't done a lot of sculpting in Blender 2.8. Blender 2.79 and lower, I did sculpt several times, but it was never quite natural for me. Blender 2.8, I used most of the same tools, but it just felt better.

Sculpting Tip #1: Turn on Dynamic Topology, aka Dynotopo

When you're in Sculpt mode, it's in the lower right panel, there's a checkbox labeled "Dyntopo". Click that, and your sculpting will look a lot smoother - at a cost of more polygons being created. Also, I've noticed that Dynotopo becomes unchecked when you leave Sculpting mode, at least in my version of 2.8.
Dynotopology off (turn on!) and Symmetry as Mirror is all unselected
Yeah, when you turn on Dynotopo, this is a junk message. Click "OK" and move on


Sculpting Tip #2: Deselect Mirror under Symmetry

It's in the same panel as Dynotopo - immediately below. It's not so much on/off, as select everything off. In the case of the dinobunny, there wasn't anything to mirror - and leaving Mirror X on (the default) made me question my sanity/sculpting.

Sculpting Tip #3: Be aware of what you're sculpting


I definitely did NOT want to affect the puzzle portion. It meant extra care when I was using sculpting tool near the existing puzzle cut outs and tabs.

The new Dinobunny neck

Stretching the neck out was problematic for me. I basically grabbed a bunch of vertices and dragged them up - but it wasn't on a straight z-axis. The next step was making a cylinder with the height of the new neck, with the diameter of the "post" in the puzzle's neck...this served as a guide on grabbing the vertices to the right place. (I want to say I did smart things, like changing the neck pieces to match the rotation face of the cylinder, so I could just "z-z" and move along the object's own z-axis as opposed to global z-axis. It also works to just join the cylinder and the piece you want to move up/down, and then use "p" in edit mode to separate them again. z-z now works for the piece, using the angle of the cylinder.)

Well, you now have a stretched out neck. It no longer looks natural, just a bunch of flat planes.

Before

After
I spent some late night  hours on this, and no longer entirely sure of the process - it's good to document things as you go, so you can be accurate when describing your descent into madness. Remember: dynotopo ON, symmetry OFF. In sculpting mode, the strength & the size of your brush - they're both impacted by how far in/out you zoom in on the model. A feature, not a bug.

Dynotopo was necessary here — I wanted to get the organic, slightly lumpy roundness bits of the original...and it wouldn't make the new faces I needed if I just tried to dump clay strips down.

I also sculpted with non-active pieces visible, as it gave me feedback on how the rest of the pieces looked with the changes. Sculpt mode doesn't affect those non-active pieces, so it was a safe method.

Brushes used:
  • Used Draw more often than Clay Strips, both as a +/- brush.
  • Smooth for cleaning things up
  • Alternating between Crease and Pinch for better definition of transitions

Making Two Pieces instead of One


As I wanted to make the ear portion white, it meant I had to break apart the back of the head/neck piece. I didn't use any sculpting technique - it was a quick creation of a cylinder and cube merged together, and then using Boolean>Intersect on it to make the bottom part. I briefly scaled it up, to then Boolean>Difference to create the puzzle-fit in the top portion. No sculpting needed!

Remaking the puzzle portion - notice my edges are sharp compared to the original




Thursday, April 30, 2020

Zooming in: Remixing a Train Station for Ticket to Ride Europe


Black is my final version, red is from the actual game
(Sorry for the break. We got a house and a puppy. Less writing, more...stuff to do.)

Today, I'm zooming in on a remix I did for a friend. We were listening to irish folk music at a newly-local bar, and one of my friends asks: do you do replacement game pieces? Yes. Yes, I do.

Their copy of Ticket to Ride Europe apparently didn't arrive with black train stations. We went on Thingiverse, found a station - thought, sure...it's already done! Getting home that night, I realized that it was only partially done and unprintable — but someone else had remixed it into a solid piece.

Left is straight import, right is cleaned up
The initial print was fine. It had the general shape and was roughly the same size. In a dark play area, maybe someone wouldn't notice all of the differences. My friend probably would have been happy with it, but if *I* played with them, it would bug me that I didn't improve the piece before gifting them. You can find the final STL on Thingiverse, here.

The final project
I did a lot of touching up. The arch for the train tunnel is now rounded, instead of chunked 5 times. The tall doors/windows on the first floor have a break in them, like the original. Shingles! Oh man. The actual stations have smaller shingles and more of them, but I felt it was risking the details not showing up enough. The overall piece is only 3 cm tall, printed with a .1mm layer height. (That's 300 layers, maybe I could have fit in more detail.) I added the side vertical ridges above the arch, and the time is now the same on both sides. The triangle windows...dormers(?) on the roof needed to be fixed as well.

This was hours of work, using the digital calipers and figuring out how the model was actually designed. Minor trivial adjustments — it's hard for me to let an imperfection stay.

Timesaver Tip 1: Cut it in half, use the mirror modifier

I was adjusting the first floor, the second floor, the pre-shingled roofing...why do it more than once? I should have been able to mirror x-axis and y-axis, which would have been a much better example.

Timesaver Tip 2: Break it up into consumable parts

One of the nice parts about Blender, is keeping the objects separate until the end is easy. The shingles were probably the most fun part of the whole remix - carving them out of the roof would have been annoying though.

The three shingle arrays on the roof

There are three parts to the shingles - the main roof, the top of the clock tower, and the slightly curved shingles at the base of the main roof.  I did the initial main roof tile as a flattened cube, rotated it to match the roof, and then multiple arrays of the cube. As I only needed the tiles that would stay on the roof portion, I grabbed them downward into what they would be covering. Using the boolean-intersect with the main station...it now matched the size of the roof, and raised them slightly back above the main station to be visible. The clock tower shingles were much the same. (Also in keeping with the first timesaver tip - MIRROR.)

The slightly curved tiles, were a single array. The base tile, in  edge mode, I selected the two side edges, control-e for the edge menu, then Subdivide - 3 times. I grabbed the three new edges to make a slight curve...then did the array, followed by the same boolean-intersect trick to get the right amount of tiling.

I didn't bother altering the bottom or sides of the curved tiles - those are hidden inside the roof. I didn't make any special exceptions for the 4 dormers, within the tiling, as the shingles went right up to the dormers.

Overall, I didn't learn a lot of new skills in the project — it is what it is. Looking back, I was too finicky about small details. I could have mirrored x and y, saving 30 minutes here and there. Maybe I could have done the shingles smaller, and still had detailed shingles for the final print.

Wednesday, October 9, 2019

Art Deco Lightswitch Cover and Multi-color Prints

This started off as a project to make a lightswitch cover that was interesting and unique. We've been looking at buying a house, and when I mentioned that maybe doing custom ones would be fun — yes.

For this project, I used Blender 2.8 and older developer version Cura (2.x, but is able to run on an ancient OSX desktop). The file can be found here - https://www.thingiverse.com/thing:3907742

Lightswitch Cover Design & the Foray into Art Deco


It would have been an easier start if I had just remixed someone else's lightswitch cover as a base. In this case, I decided to do everything from scratch. Starting with digital calipers, I decided the plate would be 114 mm tall and 71 mm wide. I measured the slot and the holes, using blocks and cylinders to punch holes in the plate. (The cylinder was wider at the top, to represent the tapered screw that lightswitches use.)

I did some beveling on the top and the underside to get a rounded feel for the cover — one of the useful techniques when using control-B to bevel, or Edge>Bevel Edges is using "M" to change the mode...I clicked M several times to get to "percent", which turned out really well. I've done some basic bevels in the past, but this is the first time I experimented with every combination of options before settling on the one true way.

Added some cylinders on the bottom for more screw support. The bevel on the actual bottom came from inset, followed by moving the portion up past the top's bevels, then applying bevel/percentage to the rectangle that had moved up. Tricky.
Before printing this cover, I downloaded someone else's plate from thingiverse, compared the slots and holes...pretty close. I did end up moving the screw holes .3mm closer to the center, but not bad. Printing it, I realized I had not put enough taper space into the plate for the screws. Ah well.

With the basic object shape out of the way, we get into an introduction of "art deco". As I'm not a designer, I went to Google Images, and searched for "art deco pattern". After browsing a ton of images and styles, I decided on one that was relatively simple. (Showing my beta version to an actual designer type person, he asked if I was a designer, and explained that I got the style right - basically a simple image that repeats...that's what I got out of his comments at least.)

The goal was an image that would merge together with itself. Didn't like my design at first, but it looks good printed. 

I created the basic image, sized it up to 15 mm, then used the array modifier for the relative offset y-axis at "1.25", 20 times. I created a second array modifier, .65 for x-axis, .025 y-axis. This wasn't science, it was trial and error to get a feel for what it would look like.



Next was...ugly. I clearly need to learn better habits on how to merge the art deco design onto an object.  It *eventually* worked. I needed to use a lot of the 3D Print Toolbox plugin to look for non-manifold edges. There were over 300, and I did too much manual fixes and partially manual fixes to get down to 0.

Multi-color Prints & How to Pause in Mid-print


A friend asked me how hard it was to imbed something within a print. Specifically, adding a metal nut into a knob as it prints. Sure, it could be done, but I didn't know how or had a project that needed me to stop in mid-print...until NOW.

The idea was to print the art deco image in a different color - imagine a white plate with a series of black stamps. There's a plugin that comes native to Cura, found under Extensions>Post-Processing>Modify G-Code>Add a script>"Pause at height". From Blender, I recognized I needed about 5mm of white before switching over to black. Loading the cover, clicking on the View, Layers...it looked like I needed to switch over at layer 21, at a .24 mm layer height. The only number I had to change for the input was the Pause Height to 5.04mm (arrived at by multiplying 21 * .24).

[edit: I came back a year later to update some of this.]

If you have a different initial layer height, make sure that is figured as layer 1. (For example, a .3mm layer height, and 20 layers at .24...5.10mm.) You can also resume the print from your Octoprint browser window, if you don't have Cura open.

I'm trying out "Extrude Amount" with a new print - it's supposed to extrude filament after you resume. You'll still need to be quick, to clean off that extruded filament before it starts printing on the model.

[edit end. November 29th, 2020.]

You can add multiple pause at heights, for multiple color changes from highest (top) to lowest (bottom).


And I started the print. At layer 21, the printer paused and sent the printer head to the far right corner, and elevated on the z-axis slightly. The Cura software was still open, and registered as "Paused". I opened up the tensioner on the feeder, slowly pulled the white filament out, slowly pushed the black filament through. Caution! Try hard not to move the printer head - if it loses where it is, it won't be aligned when it starts with the new color. (If you look closely, you can see white at the top of each black circle, where I bumped it slightly when using the feeder gear to push it through. The second time, I just pushed it through manually, no gear.)

Going back to the Cura software, it was still paused. Click the resume button, and it goes back to printing. Sadly, my bed temperature was low for PETG (and the room was drafty), so you can see how the corners were pulling up. That's fine for experiments, but wouldn't be good for the final result.

Action shot, printing the black as layer 21

I also found that the cover no longer printed correctly. The screw holes and switch slot in the cover filled on some of the layers! Sure enough, back in Cura in View Layers, I noticed that it filled up. Spending some time in internet searches, the solution that I found suggested in the "Mesh Fixes" options, to DISABLE "Union Overlapping Volumes". That brought back the holes and slot that should have been there in the first place.

The screw holes are white, the switch was black...clearly neither were holes anymore This version had beveled edges on the outside, which meant they ended lower than 5.04 mm (still the white filament).

Having done that, I went back to printing the white/teal PETG to get this final product. (230 degrees nozzle, 70 degree plate, .24mm layer height, .5mm nozzle.) Polymaker's Polylite PETG, 2.85mm.

Ta-da!


Wednesday, September 25, 2019

Removing the background & converting a JPEG or PNG to SVG

Disclaimer: this isn't a strictly 3D printing post. Blender will consume SVG files, and with some effort can MAKE svg files...but I needed some SVG files for a project, so I will go over how it works for me.

For my current project, I need to remove the background of a photo, then turn the subject into a SVG file - all so I can use a laser cutter to etch animals onto slate coasters. 



I'll be using Illustrator...CS3. I was a student once, and the Indesign/Photoshop/Illustrator package was $300 as a one-time purchase. I'm not using this for commercial purposes (if I end up needing to do commercial purposes, I might come back and show how to do this in Inkscape). I'm sure the habits are very similar.

I start with a 10 cm x 10 cm square as the document size - the size of the coaster I'll be etching with a laser. (This can also be useful for someone using a Cricut - my girlfriend got one last week.)

Next, under File>Place, I put my image file on my document - this also creates the first layer. The image is ideally too big - scaling down keeps details, while scaling it up will lose them. Regardless, select a corner with your right mouse button, hold down shift (so the image will scale on its X/Y at the same rate)...and then scale your picture to fit in the box. If you used a PNG, you're fine. If you used a JPEG, go to Object>Rasterize and click okay in the dialog box. (If you don't rasterize your JPEG you will not see "Live Trace" later.)

Rasterized Baby Leopard scaled down to fit in the 10 cm x 10 cm frame (Layer 1)
You have the photo within the box - let's take a step back and do some other prep work. Under Window>Layers - you'll want that visible. Under View>Show Transparency Grid, you want the background to be transparent - checkered instead of pure white. Also under View>Smart Guides, I like turning those off for this kind of project. (Feel free to turn them back on later - you can decide for yourself what you like.)
View Menu for adding Show Transparency Grid & turning off Smart Grid

As a good practice, create a new layer and select it - this is where you'll do your tracing. Both your foreground and background should be a white box with a red line through it...this means any fill you have will be transparent. (If you don't do this step, you'll see your picture being covered up as you trace.)

Transparent fill
With the pen tool, start right-clicking along the border of your image. You can make curves with a curve tool, but...more learning. When I hit an area that needs more of a curve, I'll just place more vertices. Once you get back around to the start, click from your first spot, and it will automatically make it complete. (If you had Smart Guides from earlier turned on, it would try to suggest certain angles for the next vertex.)

The red vertices are pretty small, so I often zoom in for close details

With that done, drag that part of the layer 2 on top of that the original layer. Under Select>All, it should highlight both the image and the border you just drew. Object>Clipping Mask should cut out the background!

The clipping can be more exact, but the conversion to SVG will change the detail level too.
Now comes a more basic "turn this into an svg" - you can always save an Illustrator file as an SVG. But I needed a black with transparency object. With the selection tool (not pen tool), double right-click on the new image. You want a "Live Trace" button to show up in the top bar, and for some reasonable-but-not-known-to-me, it takes two double-clicks. Press "Live Trace". Boom - white and black...but not transparent. There's a button in the bar that opens up tracing options, and you'll want to check the "Ignore White" checkbox. (You'll notice now that it's just transparent and black now.) I would also recommend experimenting with different amounts of Threshold, instead of sitting at 128. The higher the number, the more black. Min. Area is going to give you a higher detail at a smaller number.

Trace Dialog Box

And that's it. Save as a SVG, and you're done! Wish you good luck translating this into your vector-based experiences.

Thursday, September 12, 2019

Remixing a d20 countdown dice holder in Blender - BoltFactory plugin

I figured I would share some of the remix process of my latest project.

The final result - whoops, where is my d12?
You can find the final results here on Thingiverse. The original version was done by the user kittka on Thingiverse, a little larger and using magnets.

My original remix that I didn't share, was scaled down and using different magnets. Sadly, the thin magnets I normally use for my projects did not hold the d20 together, as it jostled around in the gaming bag. Remix #2, I used more powerful magnets in the base where the d20 had more room.

As this wasn't a major remix, I didn't bother posting it. There were still minor issues - knocking the d20 at just the wrong angle, it would spill all of the dice out. I considered replacing one set of magnets with a post and hole, so you'd have to pull it apart vertically...but it was in a design backlog.

Enter the Puppy


My friend hosting D&D has a pup that likes to chew. Alfred climbed into my bag, pulled out my d20, and chewed on the lid...breaking off part of the top. Fortunately, none of the magnets were swallowed, no PETG was eaten, but I now needed a new d20.
Post-Alfred


Enter the BoltFactory plugin


Blender 2.8 has a bunch of plugins, most of which I had played with in the earlier versions. I had not experimented very much making bolts in the past. I did make a screw thread once using arrays, but...it was work. Boltfactory is stock, just needing to be turned on. Edit>Preferences>Add-ons, then type in "bolt".


Once that's turned on, you can shift-A to create a mesh, and select "Bolt" at the bottom, which gives you this handy bolt creation menu.


I used the default bolt generated. To get the corresponding nut, just change the Model: BOLT to Model: NUT.


I scaled them both up at the same ratio, to fit to the die. From there, I made a wide-but-not-tall cube to boolean-intersect a thread section from the bottom of the bolt (slightly bigger than the nut part I was cutting out), and a boolean-intersect from the nut. I printed a prototype, to see if my .24 mm layer height and .5mm nozzle would provide good enough tolerances for the scaled-up threads. Success!
Orange nut, purple bolt, with a longer orange test bolt
Scaling up the nut/bolt gave me a really "chunky" thread. Easy to print, as well as not needing a lot of turning to open. (Turned out to be about 108 degrees of turning.) Enough to have a tight seal, but not enough to make it too much effort.

The Real Work


It gets tedious and ugly after this. I dissolved all of the vertices that held the magnets, and made smooth edges to merge with future bolt/nut sections. There were three design issues to overcome, and in my first time doing this, I didn't come up with a clean system.

  1. The top needs to be flush with the base, plane to plane (bottom of the top, to the top of the base)
  2. The number faces on the top need to match the "spin" of the bolt into the nut
  3. The number faces on the top need to be flush with the number faces on the base
The first one was awkward — the top and base needed to be rotated the exact amount. I probably should have just reimported the original, but I continued my original remix. They needed to be the same z-plane coordinates on each facing plane. I checked the z-coordinates of the vertices, and rotated on x/y axis to balance opposite sides. After that was flat, I merged the bolt and nuts (skipping some finer details here). 

I printed the d20 bottom, as the nut part wasn't going to change. Printed a top, testing the "right amount" of bolt.

The second design issue should have been more manageable in Blender, but I didn't trust virtual tolerances. To match up the faces, I would rotate everything BUT the screw portion. It's easiest if you dissolve the unnecessary edges on the bottom of the top - otherwise the spin might get some of your edges cutting into other edges. Again, printed a couple more to get the alignment of faces correct.

The third design issue, I noticed that the top wasn't completely aligned with the bottom, on the x/y axis. I could run my fingernail up the face from #6 into #5, but it would catch...and there was one millimeter-ish gap on the #2 to #10. A couple of printed tops later, it matched.
Closed



Thursday, July 4, 2019

Using Array modifier for an object around a point in space in Blender

Building an array of an object around a point - it always feel messy and non-intuitive in Blender. The first half-dozen times, I'd have to look things up on the internet to recognize where I went wrong. I did this in Blender 2.78, but it applies the same in 2.8.

The two primary tips


  • Set your object to scale & rotation (Scale should be 1.00 when doing an array)
  • Put the object origin on whatever you're going to rotate around

To demonstrate the process, make any object, grab it so it's not in the center, and scale it some fashion.
For this example, I took a cube, extruded it on the Y-axis, added some loop cuts in edit mode (control-r), scaled those cuts in x- and y-axis — then moved it on the y-axis away from the center.

We'll want to spin this object around the center of the grid on 0, 0, 0 - so shift-s to put cursor to center (if it wasn't already there).  Under Object>Transform>Origin to 3D Cursor (or under Tools>Set Origin, or shift-control-alt C)...set the origin to the cursor.

If we DON'T set the origin to cursor, it'll spin around the center of the object when it was a lonely little cube. The green and red arrows should no longer be set on the object, they should have moved down to the center.

This is the killer - Object>Apply>Rotation & Scale.

With the cursor still in the center, shift-a to add an empty axis.

Now for the fun.
The Modifier (wrench) > Array panel

You'll want to turn off the relative and constant offsets. The Object Offset, you will want to turn on, and mark the Empty axis as your offset. (It'll be a drop down in the list of objects you have in Blender.) Nothing will appear to have happened to your object, as the array objects are stacked in the same space.

The next step is selecting the Empty axis, and then rotate it 45 degrees on the Z-axis. This will fan out your objects, based on the rotation of your empty axis. If you want an even distribution of these objects, you would take 360 degrees, divide by 7, and use that instead of 45. (This is convenient sometimes when building a complex objects.)

The array of 7 pieces, at 45 degrees. Note that the original piece counts towards the "Count" from the array modifier panel.

Troubleshooting

If it didn't look like this, go back and revisit the first two points: apply the rotation & scale to the object, and make sure the origin of your object is set to the same spot as your Empty axis.

Extra Tricks


Let's say you wanted to add a number to each of those tiles in space. You could Add Text (then duplicate it any number of times, but hide the extras) above one of those tiles, convert it to mesh, thicken it, boolean it into the object...and then rotate the Empty axis another 45 degrees, to add each number.

Alternatively, you could "set rotation" on your Empty axis each time, and then type in the 45 degrees again....this could be useful, if your rotation is something more complex, like 31.528 — meaning you wouldn't have to do the extra math each step.

You can also do some funky things, by changing the scale of your Empty axis which will stretch or shrink your array in a given direction.

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.