<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kellbot! &#187; Projects</title>
	<atom:link href="http://www.kellbot.com/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kellbot.com</link>
	<description>Tinysaurs and Hacking and Nonsense</description>
	<lastBuildDate>Wed, 09 May 2012 16:49:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Sparkle Gamer: Reviewing Games for Girls</title>
		<link>http://www.kellbot.com/2011/06/sparkle-gamer-reviewing-games-for-girls/</link>
		<comments>http://www.kellbot.com/2011/06/sparkle-gamer-reviewing-games-for-girls/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 14:27:20 +0000</pubDate>
		<dc:creator>Kelly Farrell</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/?p=871</guid>
		<description><![CDATA[I need another project like I need a hole in the head, but this one was just too ridiculous to pass up. I&#8217;ve started a review site for games for girls. Specifically I mean games marketed towards girls. It&#8217;s a little tough to explain why I&#8217;m doing this. It kills me a little that there <a href="http://www.kellbot.com/2011/06/sparkle-gamer-reviewing-games-for-girls/">...</a>]]></description>
			<content:encoded><![CDATA[<p>I need another project like I need a hole in the head, but this one was just too ridiculous to pass up.</p>
<p>I&#8217;ve started a review site for <a href="http://www.sparklegamer.com">games for girls</a>. Specifically I mean games <em>marketed </em>towards girls.</p>
<p><a href="http://www.sparklegamer.com/littlest-pet-shop-friends-beach-review/"><img src="http://www.kellbot.com/wp-content/uploads/51keSAUGuRL.jpg" alt="" title="" width="500" height="375" class="aligncenter size-full wp-image-876" /></a></p>
<p>It&#8217;s a little tough to explain why I&#8217;m doing this. It kills me a little that there even are &#8220;games for girls,&#8221; because I believe a good game is for <em>everybody</em>. You can get the full spiel at <a href="http://www.sparklegamer.com/?p=44">&#8220;Why Review Games for Girls&#8221;</A>, but it came up in a conversation with Chris the other day that most of the games marketed to young girls aren&#8217;t reviewed by the major review sites, if anyone at all.</p>
<p>Parents who buy these games, most of which are junk, don&#8217;t really have anything to go on but the Amazon reviews. Unfortunately the Amazon reviews skew heavily towards &#8220;my daughter liked this because she loves [insert character here].&#8221; So for the discerning parent who&#8217;s concerned about the <em>quality</em> and <em>content</em> of the games their daughter plays, there aren&#8217;t a lot of resources.</p>
<p>Personally I&#8217;d love it if parents would drop the pink-is-for-girls thing and just buy games that were good, regardless of gender marketing. But some girls get the princess bug <a href="http://www.npr.org/2011/02/05/133471639/saving-our-daughters-from-an-army-of-princesses">despite the protests of their parents</a>.<br />
I hope to arm parents with information so they can buy high quality games for their kids, navigating the murky world of games for girls and highlighting some gender neutral games which might appeal to even the biggest Disney princess fan.</p>
<p>Check out <a href="http://www.sparklegamer.com">Sparkle Gamer</a>, and if you&#8217;d like to review some games, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2011/06/sparkle-gamer-reviewing-games-for-girls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hooked on &#039;botting</title>
		<link>http://www.kellbot.com/2011/04/hooked-on-botting/</link>
		<comments>http://www.kellbot.com/2011/04/hooked-on-botting/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 21:23:20 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[makerbot]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2011/04/hooked-on-botting/</guid>
		<description><![CDATA[This week I makerbotted for the first time! I know, I know&#8230; I should have done this much much sooner. Everything Tiny and Makerbot were actually founded in the same room, the old NYC Resistor location, and it&#39;s been really exciting to see things take off for them. But until recently, partly due to the <a href="http://www.kellbot.com/2011/04/hooked-on-botting/">...</a>]]></description>
			<content:encoded><![CDATA[<p>	This week I makerbotted for the first time! I know, I know&#8230; I should have done this much much sooner. <a href="http://www.everythingtiny.com">Everything Tiny</a> and <a href="http://www.makerbot.com">Makerbot</a> were actually founded in the same room, the old <a href="http://nycresistor.com">NYC Resistor</a> location, and it&#39;s been really exciting to see things take off for them. But until recently, partly due to the success of Everything Tiny, I never really had time to sit down and get personally aquanited with the wide world of 3D printing.</p>
<p>	Part of my probelm was that I always had ideas which were large and complicated, and I never finished the designs. So in an effort to actually produce something, I set myself to a very simple first project: a plastic organizer insert for a mint tin.</p>
<p>	<img alt="Subdivided mint tin" src="http://images.postling.com/3/37a/g_400xN.13039.jpg" style="width: 400px; height: 300px;" /></p>
<p>	I&#39;m using it to organize my miniature pompom collection. Because I have one of those.</p>
<p>	Overall the printing process was pretty easy. Adam, Matt, and Pax were nice enough to help me get over the few problems I ran into. Matt, who is the developer in charge of ReplicatorG (Makerbot&#39;s printing software), gave helpful instructions like &quot;now click the picture of the potato with an arrow coming out of it.&quot; He then asked if I knew any UI designers looking for work.</p>
<p>	Here are the issues I ran into on my maiden print:</p>
<p>	<strong>The model didn&#39;t adhere to the bed.&nbsp; </strong>Because my design is pretty thin, it didn&#39;t stick very well to the bed of the makerbot, even with the heated build platform. This was easy enough to fix, we turned on the raft (a layer of plastic which goes down evenly before you start the real print, and is removable later).</p>
<p>	<strong>The plastic was coming out goopy.</strong> The main issue with my first two attempts was that the plastic was coming out much too thick, and kind of lumpy/grainy. This caused two problems: first, it looked terrible, with little lumpy bits everywhere. But more importantly, the lumpy goopy bits would build up and then harden. Then when the extruder head came by again, it would hit these plastic lumps and move the model, throwing off the registration.</p>
<p>	There were two suggested fixes here: first was to increase the speed, so that the build platform would move faster (allowing for less material to build up). This was met with a certain degree of success, but Adam suggested that the plastic we were using, which had been sitting out at Resistor for quite some time, had absorbed too much water from the air to really be useful. The moral of the story here is to store your plastics in airtight containers with some desiccant. In the end, we switched plastics.</p>
<p>	<strong>My machine wouldn&#39;t talk to the Makerbot. </strong>This ended up being an issue with my machine, a somewhat unhappy eeePC. When I switched to my mac, all was happy again. Also, the eee is way too underpowered to really be generating gcode for prints. I was able to cold-boot my mac, install RepG, install the drivers, and generate the print&#39;s gcode from scratch in the time it took my eee to get halfway done generating the same gcode.</p>
<p>	<strong>The build platform wouldn&#39;t heat</strong>. This one took us the longest to debug. One of the connectors was visibly damaged (names were named but I won&#39;t reprint them here), but it worked just often enough to make us think something else was the problem. After some thorough testing with the&nbsp; multimeter, and some careful coaxing of the connections, power was restored to the build platform.</p>
<p>	<a href="http://www.thingiverse.com/thing:7815"><img alt="" src="http://images.postling.com/9/9f2/g_400xN.13040.jpg" style="width: 400px; height: 353px;" /></a></p>
<p>	Here&#39;s the source model, which I&#39;ve uploaded to Thingiverse. Note that this is meant to fit mint tins that I purchase wholesale, and as such may not fit the Altoids tins. I created the object in Google SketchUp and then exported it to STL for use with RepG. GoogleSketchUp is OK for doing things quickly, but there are a lot of things I wanted to do with the design that I couldn&#39;t convince SketchUp to let me do. Particularly, I wanted nice rounded edges on the top of my model.</p>
<p>	I&#39;m happy with the final print, and really stoked about Makerbotting more models in the future!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2011/04/hooked-on-botting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lego Sphere Factory</title>
		<link>http://www.kellbot.com/2011/01/lego-sphere-factory/</link>
		<comments>http://www.kellbot.com/2011/01/lego-sphere-factory/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 04:11:11 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[LEGO]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2011/01/lego-sphere-factory/</guid>
		<description><![CDATA[This weekend was spent at RevolvingDork&#39;s parents&#39; house, which they kindly let us turn into a Lego sculpture factory. We had a total of 12 people over on Saturday attempting to make 15 Lego spheres. Each sphere is about 25cm (10ish inches) in diameter. They follow a pattern I created using Blender and the techniques/scripts <a href="http://www.kellbot.com/2011/01/lego-sphere-factory/">...</a>]]></description>
			<content:encoded><![CDATA[<p>	This weekend was spent at RevolvingDork&#39;s parents&#39; house, which they kindly let us turn into a Lego sculpture factory.</p>
<p>	<a href="http://www.flickr.com/photos/kellbot/5402089098/" title="Basement Spheres by kellbot, on Flickr"><img alt="Basement Spheres" height="333" src="http://farm6.static.flickr.com/5254/5402089098_c855e02ccf.jpg" width="500" /></a></p>
<p>	We had a total of 12 people over on Saturday attempting to make 15 Lego spheres. Each sphere is about 25cm (10ish inches) in diameter. They follow a pattern I created using Blender and the techniques/scripts described <a href="http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/">here</a> and <a href="http://www.kellbot.com/2010/11/lego-plans-now-with-better-rendering/">here</a>.</p>
<p>	We used a lot of Legos. Approximately 22,000. Most of them were sourced from BrickLink, though we did buy a few sets new from Toys R Us. When build day came we realized we didn&#39;t have enough, so RD made a last-minute trip to the Lego store. He was able to talk the staff into letting him buy a few boxes in bulk.</p>
<p>	<a href="http://www.flickr.com/photos/kellbot/5401948788/" title="Legos by kellbot, on Flickr"><img alt="Legos" height="333" src="http://farm6.static.flickr.com/5093/5401948788_565f691914.jpg" width="500" /></a></p>
<p>	In order to make the build process easier, we laser-cut jigs out of foam core for each of the 27 layers. The jigs served as templates for each layer, avoiding the frustrating and time consuming counting I had been doing when building them earlier. We didn&#39;t use a script to output the vector cut paths, RD just traced them by hand in Illustrator.</p>
<p>	<a href="http://www.flickr.com/photos/kellbot/5402039548/" title="Building with a jig by kellbot, on Flickr"><img alt="Building with a jig" height="333" src="http://farm6.static.flickr.com/5256/5402039548_abfe8bda8c.jpg" width="500" /></a></p>
<p>	To put it plainly: assembling these is <strong>hard</strong>. There are lots of overhangs and ragged edges where you really need a 1&#215;1, but of course those aren&#39;t very structurally stable. The first few layers are definitely the hardest, and there are a number of tips and tricks we figured out along the way to make things easier. And by easier I mean possible.</p>
<p>	The spheres were built <a href="http://www.flickr.com/photos/kellbot/5402085516/">mostly hollow</a>, though thicker at the top and bottom for structural support. A few folks incorporated a center column to make placing the top easier. Personally I found it easier to start thickening the walls around the top 1/3rd and using long 2&#215;8 pieces to mesh in the top.</p>
<p>	John decided to get fancy with his; rather than a simple mottled pattern he made an artistic swirl.</p>
<p>	<a href="http://www.flickr.com/photos/kellbot/5402078688/" title="John and Sphere by kellbot, on Flickr"><img alt="John and Sphere" height="500" src="http://farm6.static.flickr.com/5011/5402078688_871de02356.jpg" width="333" /></a>;</p>
<p>	After 12 hours of work on Saturday we had 6 complete spheres and a number of half-finished ones. On Sunday RD, myself, and my soon-to-be mother-in-law finished up the leftovers, for a total of 13 spheres completed this weekend. I&#39;m pretty impressed, and honored to have the sort of friends who would give up their Saturday to assemble these ridiculous sculptures.</p>
<p>	What are they all for? The answer to that is coming shortly&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2011/01/lego-sphere-factory/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>LEGO plans, now with better rendering</title>
		<link>http://www.kellbot.com/2010/11/lego-plans-now-with-better-rendering/</link>
		<comments>http://www.kellbot.com/2010/11/lego-plans-now-with-better-rendering/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 14:19:49 +0000</pubDate>
		<dc:creator>Kelly Farrell</dc:creator>
				<category><![CDATA[LEGO]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/?p=776</guid>
		<description><![CDATA[You may remember the &#8220;Legoizer&#8221; script I&#8217;ve been working on for Blender. It uses an existing script and one I&#8217;ve created to generate &#8220;layers&#8221; of LEGO patterns for building. I got a lot of great suggestions on my last entry for how to automate the process of taking a screenshot, but sadly when it came <a href="http://www.kellbot.com/2010/11/lego-plans-now-with-better-rendering/">...</a>]]></description>
			<content:encoded><![CDATA[<p>You may remember the <a href="http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/">&#8220;Legoizer&#8221; script I&#8217;ve been working on for Blender</a>. It uses an existing script and one I&#8217;ve created to generate &#8220;layers&#8221; of LEGO patterns for building.</p>
<p>I got a lot of great suggestions on my last entry for how to automate the process of taking a screenshot, but sadly when it came down to implementing them things didn&#8217;t go so well. Luckily Angelo from <a href="http://abandonhopegames.com/">Abandon Hope Games</a> was kind enough to take the time to help me get the environmentals in Blender set up just right for rendering a &#8220;pattern slice.&#8221;</p>
<p><strong>Step 0: Start with an object made of objects</strong><br />
The AddCells script uses DupliVerts to create an object made of references to another object. We&#8217;ll get to that in a minute, but first, let&#8217;s assume you have an object:<br />
<a href="http://www.kellbot.com/wp-content/uploads/step0.jpg"><img class="aligncenter size-medium wp-image-777" title="step0" src="http://www.kellbot.com/wp-content/uploads/step0-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p><strong>Step 1: Set up the camera</strong><br />
We want the camera to be facing down and rendering orthographic(all lines parallel) rather than perspective.</p>
<p>Make sure you&#8217;re in Object Mode and select the camera.<br />
Press Alt+G and then Alt+R (confirming the dialogs) to return it to the origin.<br />
Hit F9 to get into the Editing panel<br />
Click the button labeled Orthographic in the Camera tab</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/Step1.jpg"><img class="aligncenter size-medium wp-image-778" title="Step1" src="http://www.kellbot.com/wp-content/uploads/Step1-300x64.jpg" alt="" width="300" height="64" /></a></p>
<p>Press 1 on your number pad to get a side view of the scene. Click the blue transform handle of your camera and move it up along the Z axis so it is well above your object.<br />
Press 0 on your number pad and you should see a rectangular bounding box around your object (or perhaps around nothing) which represents the are which the camera sees.<br />
Scroll the &#8220;lens&#8221; option right above the Orthographic button to zoom in/out so your</p>
<p>If you do a test render now with F12, you&#8217;ll probably see a badly lit (perhaps almost all black) render of your object from the top down.</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/Step1test.jpg"><img class="aligncenter size-medium wp-image-779" title="Step1test" src="http://www.kellbot.com/wp-content/uploads/Step1test-300x225.jpg" alt="" width="300" height="225" /></a><strong>Step 2: Set up the lighting</strong></p>
<p>Select the existing light in your scene and press x on your keyboard to delete it.<br />
Press space bar to bring up a dialog, and go to Add &gt; Lamp &gt; Sun<br />
It doesn&#8217;t matter where the lamp is, as long as it&#8217;s facing down (which it is by default).</p>
<p><strong>Step 3: Configure your materials</strong></p>
<p>I mentioned earlier that our object was made up of DupliVerts.<br />
These aren&#8217;t &#8220;real&#8221; objects, which is why I had such trouble applying materials to them. You need to apply the material to the reference object, which is generally somewhere in the middle of it. I usually do this by switching to the Outliner menu and finding the source cube manually.</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/Step3.jpg"><img class="aligncenter size-medium wp-image-780" title="Step3" src="http://www.kellbot.com/wp-content/uploads/Step3-300x48.jpg" alt="" width="300" height="48" /></a>Once we have our source object selected, hit F5 to bring up the Shading panel and click Add New under Links and Pipeline.<br />
Pick a new color for your object. This will be the color of the lines in your final rendered image, so pick something that contrasts with your background color (which defaults to blue).<br />
Click the Wire button under Links and Pipeline</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/Step4.jpg"><img class="aligncenter size-medium wp-image-781" title="Step4" src="http://www.kellbot.com/wp-content/uploads/Step4-300x64.jpg" alt="" width="300" height="64" /></a>Your object in the viewport should take on the color you&#8217;ve selected. If if doesn&#8217;t, you probably didn&#8217;t select the correct source object.</p>
<p>Hit F12 to render. Viola!</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/StepGrid.jpg"><img class="aligncenter size-medium wp-image-782" title="StepGrid" src="http://www.kellbot.com/wp-content/uploads/StepGrid-300x225.jpg" alt="" width="300" height="225" /></a>Now that we have our environment set up the way we want, rendering via script is easy. I&#8217;ve updated the <a href="https://gist.github.com/720578">script source</a> (now on gist) to call Render when it&#8217;s done slicing and save the file to my hard drive.</p>
<p>This all works great, but of course there&#8217;s a new problem. Since we want to iterate over the entire object, I need to &#8220;reset&#8221; it back to being whole again. While I&#8217;ve saved an undo point I don&#8217;t think you can call that point via the API. In the current iteration of the script I save the vectors of each vertex before deleting it and then call verts.extend to add them back. This works great except&#8230;</p>
<p>The vectors for the verticies are transformed to be in the selected object&#8217;s local space, which is necessary for &#8220;layer 1&#8243; to be the first layer of the object and so forth. Unfortunately I<strong> haven&#8217;t yet figured out how to transform those verticies back.</strong> So when I run the script it dutifully reassembles my sphere originating from the center of the object. So there&#8217;s still some work to be done there.</p>
<p><a href="http://www.kellbot.com/wp-content/uploads/Oops.jpg"><img class="aligncenter size-medium wp-image-783" title="Oops" src="http://www.kellbot.com/wp-content/uploads/Oops-300x132.jpg" alt="Yaaaay... oh." width="300" height="132" /></a></p>
<p><script src="https://gist.github.com/720578.js"> </script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/11/lego-plans-now-with-better-rendering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meta Lego Storage</title>
		<link>http://www.kellbot.com/2010/06/meta-lego-storage/</link>
		<comments>http://www.kellbot.com/2010/06/meta-lego-storage/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 15:04:36 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[crafting]]></category>
		<category><![CDATA[lased]]></category>
		<category><![CDATA[LEGO]]></category>
		<category><![CDATA[lego]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2010/06/meta-lego-storage/</guid>
		<description><![CDATA[In need of a way to organize and store my Lego obsession, I made a bunch of acrylic boxes which not only hold Legos, but also stack and interlock similarly: Each brick box holds 64+ of the same-shape piece. So the 1&#215;1 box will hold 64 1&#215;1 bricks, and the 2&#215;2 holds 64 2&#215;2 bricks. <a href="http://www.kellbot.com/2010/06/meta-lego-storage/">...</a>]]></description>
			<content:encoded><![CDATA[<p>	In need of a way to organize and store <a href="http://www.flickr.com/photos/kellbot/collections/72157624316889052/">my Lego obsession</a>, I made a bunch of acrylic boxes which not only hold Legos, but also stack and interlock similarly:</p>
<p>	<img alt="" src="http://images.postling.com/f/f54/g_400xN.3068.jpg" style="width: 400px; height: 266px;" /></p>
<p>	Each brick box holds 64+ of the same-shape piece. So the 1&#215;1 box will hold 64 1&#215;1 bricks, and the 2&#215;2 holds 64 2&#215;2 bricks. The larger ones hold a few more due to how the sizing works out. The 1&#215;1 box is 40mm per side (external dimensions).</p>
<p>	I <a href="http://www.thingiverse.com/thing:3379/">posted the patterns on Thingiverse</a> should anyone wish to make their own. No,&nbsp; I&#39;m not going to make and sell them. They&#39;re time consuming to make, and plus I&#39;m pretty sure Lego would sue me. If you don&#39;t have access to a laser cutter, I&#39;d suggest using a service like Ponoko.</p>
<p>	The patterns were generated in OpenSCAD using the following code. Change &quot;rows&quot; and &quot;cols&quot; to get the lego size you desire. By the way, I&#8217;m teaching a <a href="http://openscad.eventbrite.com">class on OpenSCAD</a> in Brooklyn next weekend!</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">fundamental_unit <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.8</span><span style="color: #339933;">;</span>
thickness <span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
h_pitch <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
v_pitch <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
tform <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
knob <span style="color: #339933;">=</span> fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">;</span>
module side<span style="color: #009900;">&#40;</span>rows<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	lwidth <span style="color: #339933;">=</span> rows<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">;</span>
	lheight <span style="color: #339933;">=</span> v_pitch<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>tform<span style="color: #339933;">;</span>
	difference<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth, lheight<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth<span style="color: #339933;">-</span><span style="color: #cc66cc;">20</span>,thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span>,lheight<span style="color: #339933;">-</span>thickness,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth<span style="color: #339933;">-</span><span style="color: #cc66cc;">20</span>,thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>thickness, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span>,lheight<span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>thickness, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth<span style="color: #339933;">-</span>thickness,<span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>thickness, lheight<span style="color: #339933;">-</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
module top<span style="color: #009900;">&#40;</span>rows,cols,holes<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	lwidth <span style="color: #339933;">=</span> rows<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">;</span>
	llength <span style="color: #339933;">=</span> cols<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">;</span>
	difference<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth,llength<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>thickness,<span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span>,thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">-</span>thickness,<span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span>,thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth,llength<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span>,<span style="color: #339933;">-</span>thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>lwidth,llength<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">-</span>thickness,<span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span>,llength<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span>,<span style="color: #339933;">-</span>thickness<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span>,llength<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> square<span style="color: #009900;">&#40;</span>size<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>thickness,<span style="color: #339933;">-</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>holes<span style="color: #339933;">==</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span>cols<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>j<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span>rows<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">*</span>knob<span style="color: #339933;">-</span>knob<span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span>,i<span style="color: #339933;">*</span>knob<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> circle<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">=</span>fundamental_unit<span style="color: #339933;">*</span><span style="color: #cc66cc;">6</span><span style="color: #339933;">*</span>tform<span style="color: #339933;">/</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
rows <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
cols <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
&nbsp;
h_spacing <span style="color: #339933;">=</span>  rows<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
l_spacing <span style="color: #339933;">=</span>  cols<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
v_spacing <span style="color: #339933;">=</span> fundamental_unit<span style="color: #339933;">*</span>v_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
&nbsp;
side<span style="color: #009900;">&#40;</span>rows<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span> rows<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> side<span style="color: #009900;">&#40;</span>rows<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span>,v_spacing<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> side<span style="color: #009900;">&#40;</span>cols<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span> cols<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span>,v_spacing<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> side<span style="color: #009900;">&#40;</span>cols<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">2</span><span style="color: #339933;">*</span>v_spacing<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> top<span style="color: #009900;">&#40;</span>rows,cols,<span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
translate<span style="color: #009900;">&#40;</span>v<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span> rows<span style="color: #339933;">*</span>fundamental_unit<span style="color: #339933;">*</span>h_pitch<span style="color: #339933;">*</span>tform<span style="color: #339933;">+</span><span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">2</span><span style="color: #339933;">*</span>v_spacing<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> top<span style="color: #009900;">&#40;</span>rows,cols,<span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</p>
<p>	In the next batch I&#39;m going to make the nubs a little smaller than the holes. They work now, but it&#39;s a bit fiddly getting everything to line up just so. A little more forgiveness would be nice. Also, OpenSCAD does strange things with circles. Rather than simply write a circle in the DXF, it represents it as a bunch of line segments. I&#8217;m not sure if there&#8217;s a way around this, but it&#8217;s marginally irritating.</p>
<p>You can download a .dxf for a few different box sizes <a href="http://www.thingiverse.com/thing:3379">on Thingiverse</a>.<br />
I&#8217;ve also created a <a href="http://www.flickr.com/photos/kellbot/collections/72157624316889052/">Flickr Collection</a> for my various Lego stuff.</p>
<p><a href="http://www.flickr.com/photos/kellbot/4715585844/" title="Meta Lego by kellbot, on Flickr"><img src="http://farm5.static.flickr.com/4063/4715585844_5f1a5ba114.jpg" width="500" height="333" alt="Meta Lego" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/06/meta-lego-storage/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>More Legos From 3D Meshes</title>
		<link>http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/</link>
		<comments>http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 01:31:36 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[LEGO]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[sculpture]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/</guid>
		<description><![CDATA[I&#39;ve been doing more Lego building from models. This time I made sort of an abstract mushroom tree forest thing. More photos are available on Flickr. Here&#39;s the original model (left) and the resulting cubeified model after running it through AddCells (right): I realized of course that with everything grey, it was very difficult to <a href="http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/">...</a>]]></description>
			<content:encoded><![CDATA[<p>	<a href="http://www.flickr.com/photos/kellbot/4700953275/" title="Mushroom Thingy by kellbot, on Flickr"><img alt="Mushroom Thingy" height="333" src="http://farm2.static.flickr.com/1299/4700953275_0a9f7e1cb0.jpg" width="500" /></a></p>
<p>	I&#39;ve been doing more Lego building from models. This time I made sort of an abstract mushroom tree forest thing. More photos are available on <a href="http://www.flickr.com/photos/kellbot/tags/lego/">Flickr</a>.</p>
<p>	Here&#39;s the original model (left) and the resulting cubeified model after running it through<a href="http://wiki.blender.org/index.php/Extensions:2.4/Py/Scripts/Add/Cells_v1.2"> AddCells</a> (right):</p>
<p>	<img alt="" src="http://images.postling.com/2/2ef/g_400xN.2975.jpg" style="width: 400px; height: 284px;" /></p>
<p>	I realized of course that with everything grey, it was very difficult to determine which bricks of which color were needed where. So I un-joined the primitives in the original model and ran AddCells on each one individually. I used different colored &quot;cell&quot; blocks for each one, and the resulting models kept the color:</p>
<p>	<img alt="" src="http://images.postling.com/a/a20/g_400xN.2976.jpg" style="width: 200px; height: 238px;" /></p>
<p>	Each peice needed to be moved a little bit so that all the blocks lined up, but other than that it worked pretty well.</p>
<p>	Because each piece is separate, I couldn&#39;t use the hide tool to &quot;slice&quot; each layer. But I did find out something interesting: each &quot;cube&quot; in the new models is actually a vertex. I honestly don&#39;t understand a ton about how that&#39;s pulled off, but basically instead of being a point on a line, each vertex represents another object, the source cube.</p>
<p>	In order to slice up the model, I wrote a script to delete all but a given layer, with layer 1 being the bottom layer, up to however many layers of cubes are in the model.</p>
<p>	&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> Blender, BPyMessages, BPyMesh
<span style="color: #ff7700;font-weight:bold;">from</span> Blender <span style="color: #ff7700;font-weight:bold;">import</span> Scene, Mesh, NMesh, Window, <span style="color: #dc143c;">sys</span>, Group, Object, Draw
<span style="color: #ff7700;font-weight:bold;">from</span> Blender.<span style="color: black;">Mathutils</span> <span style="color: #ff7700;font-weight:bold;">import</span> \
	Matrix, Vector, ProjectVecs, AngleBetweenVecs, TranslationMatrix
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> trimToLayer<span style="color: black;">&#40;</span>selected,layerNumber, blockHeight,offset<span style="color: black;">&#41;</span>:
        toDelete= <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
        mesh = selected.<span style="color: black;">getData</span><span style="color: black;">&#40;</span>mesh=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
        tmesh = NMesh.<span style="color: black;">GetRawFromObject</span><span style="color: black;">&#40;</span>selected.<span style="color: black;">name</span><span style="color: black;">&#41;</span>
        tmesh.<span style="color: black;">transform</span><span style="color: black;">&#40;</span>selected.<span style="color: black;">matrix</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;">#Delete verticies above the current layer</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> v <span style="color: #ff7700;font-weight:bold;">in</span> tmesh.<span style="color: black;">verts</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> v.<span style="color: black;">co</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&gt;</span> blockHeight<span style="color: #66cc66;">*</span>layer:
                toDelete.<span style="color: black;">append</span><span style="color: black;">&#40;</span>v.<span style="color: black;">index</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> layerNumber <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">1</span>:
                <span style="color: #808080; font-style: italic;">#Delete verticies below the current layer</span>
                <span style="color: #ff7700;font-weight:bold;">for</span> v <span style="color: #ff7700;font-weight:bold;">in</span> tmesh.<span style="color: black;">verts</span>:
                    <span style="color: #ff7700;font-weight:bold;">if</span> v.<span style="color: black;">co</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span> blockHeight<span style="color: #66cc66;">*</span>layer-<span style="color: #ff4500;">1</span>:
                        toDelete.<span style="color: black;">append</span><span style="color: black;">&#40;</span>v.<span style="color: black;">index</span><span style="color: black;">&#41;</span>        
        toDelete = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #008000;">set</span><span style="color: black;">&#40;</span>toDelete<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
        mesh.<span style="color: black;">verts</span>.<span style="color: black;">delete</span><span style="color: black;">&#40;</span>toDelete<span style="color: black;">&#41;</span>
        Window.<span style="color: black;">Redraw</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">##################3</span>
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    selection = Object.<span style="color: black;">GetSelected</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
    layer = Draw.<span style="color: black;">PupIntInput</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Layer&quot;</span>,<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span>
    Blender.<span style="color: black;">SaveUndoState</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Kill Everything'</span><span style="color: black;">&#41;</span>  
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Trimming First Layer&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> s <span style="color: #ff7700;font-weight:bold;">in</span> selection:
	bbox = s.<span style="color: black;">getBoundBox</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> bbox<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
	trimToLayer<span style="color: black;">&#40;</span>s,layer,<span style="color: #ff4500;">1.2</span>,bbox<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>	&nbsp;</p>
<p>	There are a couple problems with the script: primarily, I couldn&#39;t find a way to get the software to save a screenshot (ctrl+F3 normally). Because of this, I couldn&#39;t loop through the whole thing at once, I had to go through one layer at a time, running the script, hitting ctrl+f3, saving the image, lather rinse repeat. It was tedious, though not as tedious as manually cutting up each layer. But almost.</p>
<p>	The resulting MRI-like were used to build the model. The exact placement of which bricks and where is left as an excercise to the reader. A few layers (from the bottom, middle, and towards the top) are shown below.</p>
<p>	<img alt="" src="http://images.postling.com/2/2d7/g_400xN.2979.jpg" style="width: 150px; height: 181px;" /><img alt="" src="http://images.postling.com/2/2bd/g_fullxfull.2977.jpg" style="width: 150px; height: 204px;" /><img alt="" src="http://images.postling.com/9/9ed/g_400xN.2978.jpg" style="width: 150px; height: 186px;" /></p>
<p>	This is my first attempt at a Blender script, and admittedly one of my first times using blender, so any feedback on how to streamline this process would be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/06/more-legos-from-3d-meshes/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>From Polygons to Voxels to LEGO: A Utah Teapot</title>
		<link>http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/</link>
		<comments>http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/#comments</comments>
		<pubDate>Sun, 30 May 2010 19:01:40 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[LEGO]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[sculpture]]></category>
		<category><![CDATA[voxels]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/</guid>
		<description><![CDATA[It was only after hours of searching that I finally came up with what I was looking for: a way to take a polygon mesh (OBJ or similar) and convert it into a blueprint for building LEGO sculptures. Don&#39;t get me wrong, there are tons of tools out there for LEGO CAD. But strangely none <a href="http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/">...</a>]]></description>
			<content:encoded><![CDATA[<p>	<img alt="" src="http://images.postling.com/8/842/g_400xN.2683.jpg" style="width: 400px; height: 300px;" /></p>
<p>	It was only after hours of searching that I finally came up with what I was looking for: a way to take a polygon mesh (OBJ or similar) and convert it into a blueprint for building LEGO sculptures.</p>
<p>	Don&#39;t get me wrong, there are tons of tools out there for <a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;ved=0CB4QFjAA&amp;url=http%3A%2F%2Fwww.ldraw.org%2F&amp;ei=srUCTPriL8K78gao8qXPDQ&amp;usg=AFQjCNHyNgZYJngXz4DpVjAzH5ln1ysI_g&amp;sig2=XSwMrVgOVKt7BTrHABLd1g">LEGO CAD</a>. But strangely none of them mention being able to go from a mesh to a LEGO layout. It&#39;s surprising, since it seems like such a natural fit. The rise of 3D printers has rejuvinated interest in <a href="http://en.wikipedia.org/wiki/Voxel">voxels</a>, voulmetric pixels, and as evidenced by all the LEGO sculpture artists we seem to be in a golden age of LEGO.&nbsp;</p>
<p>	Armed with Blender and a giant LEGO collection, I set out to get the computer to do the hard work for me. I used <a href="http://www.blender.org/download/get-blender/">Blender</a>, graph paper, a pencil, and of course lots of LEGOs.</p>
<p>	<strong>Step 1: Voxelizing a Utah teapot</strong></p>
<p>	Let me preface this by saying that the Blender UI is not for the faint of heart. I took classes on Rhino and 3DSMax in college, and thought to myself &quot;how different could it be?&quot; The answer: very. If you&#39;re new to blender, don&#39;t fear the manual. You&#39;re going to need it, particularly the parts on installing/using python scripts.</p>
<p>	To voxelize the teapot I used a script called <a href="http://wiki.blender.org/index.php/Extensions:2.4/Py/Scripts/Add/Cells_v1.2">Add Cells</a> which covers the surface of any object with any other object. First I imported the teapot, and scaled it up a bit. Then I created my &quot;fundamental unit&quot; of LEGO. LEGOs have an aspect ratio of 6:5, so I created a 1&#215;1 LEGO, a 0.6&#215;0.5&#215;0.5 rectangular prism in Blender.</p>
<p>	Selecting both the teapot and my 1&#215;1 lego I ran the Add Cells script (go to the Scripts menu &#8211;&gt; Add -&gt; Cells). I chose the Teapot for my object to be voxelized and the 1&#215;1 LEGO as my voxel model.</p>
<p>	Tada! A blocky teapot!</p>
<p>	<img alt="" src="http://images.postling.com/7/7c4/g_400xN.2684.jpg" style="width: 400px; height: 180px;" /></p>
<p>	<strong>Step 2: Graphing each layer on paper</strong></p>
<p>	In order to make the build process easier, I went through layer by layer and drew a map of each layer on graph paper. This way when building with LEGOs I could shade in with a pencil each voxel I&#39;d built. It sounds redundant, but when things all start looking the same after a few minutes and something isn&#39;t lining up, it&#39;s very helpful.</p>
<p>	To see one layer at a time in Blender I went into Sculpture Mode, side view, and used ctrl+shift+right mouse to select and hide all but the layer I wanted to see. Then I switched to Top view and copied the layer onto my graph paper. By the end I had a sheet of paper full of wobbly circular outlines.</p>
<p>	<strong>Step 3: Building it with LEGOs!</strong></p>
<p>	The completed model uses 244 LEGOs, many of which are tiny 1&#215;1 and 1&#215;2 bricks. The model is hollow, but the walls need to be fairly thick to be able to support the top. As it is I probably should have made things a little thicker; putting the last two layers on was a delicate operation.</p>
<p>	I built each layer sequentially. There were a few overhang pieces near the bottom which I had to append to the layer above them, since they couldn&#39;t anchor to anything below.</p>
<p>	Overall the project took about 4 hours, with a break in the middle for breakfast, church, etc.</p>
<p>	Total LEGO count for the project was 244 individual bricks, distributed thusly:</p>
<ul>
<li>		44 2&#215;3 Bricks</li>
<li>		46 2&#215;2 Bricks</li>
<li>		58 2&#215;4 Bricks</li>
<li>		27 1&#215;2 Bricks</li>
<li>		17 1&#215;3 Bricks</li>
<li>		8 1&#215;4 Bricks</li>
<li>		8 2&#215;2 L shaped Bricks</li>
<li>		33 1&#215;1 Bricks</li>
<li>		1 2&#215;8 Brick</li>
<li>		1 2&#215;6 Brick</li>
<li>		1 1&#215;8 Brick<br />		&nbsp;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/05/from-polygons-to-voxels-to-lego-a-utah-teapot/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My First Lego Ovoids</title>
		<link>http://www.kellbot.com/2010/05/my-first-lego-ovoids/</link>
		<comments>http://www.kellbot.com/2010/05/my-first-lego-ovoids/#comments</comments>
		<pubDate>Fri, 28 May 2010 03:26:46 +0000</pubDate>
		<dc:creator>Postling</dc:creator>
				<category><![CDATA[crafting]]></category>
		<category><![CDATA[LEGO]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/2010/05/my-first-lego-ovoids/</guid>
		<description><![CDATA[After ordering a few hundred bricks from bricklink, I started working on what is for now a top secret project. Step one was to practice making spherical and organic LEGO shapes, and I&#39;m pretty happy with the two sphereoids I came up with while catching up on House. PS, Dr House is a huge jerk.]]></description>
			<content:encoded><![CDATA[<p>	<a href="http://www.flickr.com/photos/kellbot/4646695446/" title="My first lego ovoids by kellbot, on Flickr"><img alt="My first lego ovoids" style="border:0" height="375" src="http://farm5.static.flickr.com/4042/4646695446_4c8dc76590.jpg" width="500" /></a></p>
<p>	After ordering a few hundred bricks from <a href="http://www.bricklink.com">bricklink</a>, I started working on what is for now a top secret project.</p>
<p>	Step one was to practice making spherical and organic LEGO shapes, and I&#39;m pretty happy with the two sphereoids I came up with while catching up on House. PS, Dr House is a huge jerk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/05/my-first-lego-ovoids/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>And another note on LEGO</title>
		<link>http://www.kellbot.com/2010/05/and-another-note-on-lego/</link>
		<comments>http://www.kellbot.com/2010/05/and-another-note-on-lego/#comments</comments>
		<pubDate>Sat, 08 May 2010 14:23:40 +0000</pubDate>
		<dc:creator>Kelly Farrell</dc:creator>
				<category><![CDATA[LEGO]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/?p=602</guid>
		<description><![CDATA[Another thing that bugged me about the LEGO store&#8230; One of the employees was enthusiastically telling us all about LEGO (as employees ought to), and showed us a magazine dedicated to &#8220;Adult fans of LEGO&#8221; or AFOL.&#8221; He then went on to explain that within AFOL is a subgroup, AFFOL or &#8220;Adult Female Fans of <a href="http://www.kellbot.com/2010/05/and-another-note-on-lego/">...</a>]]></description>
			<content:encoded><![CDATA[<p>Another thing that bugged me about the LEGO store&#8230; </p>
<p>One of the employees was enthusiastically telling us all about LEGO (as employees ought to), and showed us a magazine dedicated to &#8220;Adult fans of LEGO&#8221; or AFOL.&#8221;</p>
<p>He then went on to explain that within AFOL is a subgroup, AFFOL or &#8220;Adult Female Fans of LEGO,&#8221; a rare and mystical breed of AFOL. He proceeded to flip through the magazine to show us a photo of a REAL LIVE LADY who ACTUALLY BUILDS WITH LEGOS! </p>
<p>I wasn&#8217;t in the mood to pick a fight over nomenclature, but really? When are people going to realize that singling out women in a male-dominated field, be it work or play, is counterproductive? I&#8217;m not an AFFOL any more than I am a &#8220;girl gamer.&#8221; Drop the extra adjective, people.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/05/and-another-note-on-lego/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hundreds of LEGO bricks</title>
		<link>http://www.kellbot.com/2010/05/hundreds-of-lego-bricks/</link>
		<comments>http://www.kellbot.com/2010/05/hundreds-of-lego-bricks/#comments</comments>
		<pubDate>Sat, 08 May 2010 14:08:33 +0000</pubDate>
		<dc:creator>Kelly Farrell</dc:creator>
				<category><![CDATA[LEGO]]></category>

		<guid isPermaLink="false">http://www.kellbot.com/?p=600</guid>
		<description><![CDATA[I&#8217;m in need of many, many LEGO bricks for what is currently a SECRET project. This week I went to the LEGO store in Paramus, NJ. It was a bit of a let down, and not really worth the hour of fighting traffic it took to get there. They didn&#8217;t have any big tubs o&#8217; <a href="http://www.kellbot.com/2010/05/hundreds-of-lego-bricks/">...</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in need of many, many LEGO bricks for what is currently a SECRET project.</p>
<p>This week I went to the LEGO store in Paramus, NJ. It was a bit of a let down, and not really worth the hour of fighting traffic it took to get there. They didn&#8217;t have any big tubs o&#8217; bricks, just kits, and their pick-a-brick selection was pretty limited (I was looking for 1&#215;2 bricks). </p>
<p>What I DID find was an amazing resource, <a href="http://www.bricklink.com/">Brick Link</a>. Bricklink is like eBay for LEGO bricks. You can find pretty much any size/shape/color. Their interface is a little clunky, without integrated shipping or payment, but it gets the job done. </p>
<p>I ordered roughly 700 red LEGO bricks for $40, most of which was the cost of shipping. It&#8217;s marginally cheaper than the cost per brick of a big tub, but I was able to hand select the colors and shapes that I wanted. </p>
<p>More details when I get the LEGO bricks in&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kellbot.com/2010/05/hundreds-of-lego-bricks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

