💫 3D Scanning

I came into the lab for a demonstration of how to use the Artec Space Spider 3D scanner. Apparently it is very expensive ($25k!).

🤚Hand Scan

At first, I tried to scan my hand/arm in order to use it when modeling the bracelet for my final project. This proved to be very challenging to scan because my arm was not static throughout which meant that the software had trouble aligning all of the different scans afterwards.

📎Clip Scan

IMG_1237

I decided a small, inanimate object might be easier to start with so I found this wooden clip. The scanning went much more smoothly but I configured the scanner to automatically remove the plane that the object was sitting on and this ended up mangling the output. I thought I could fix it with the alignment process afterwards. Which I could have had I added more scans, but other people were waiting to use the machine.

IMG_1225IMG_1226

🖨 3D Printing with a Prusa i3

📊Characterization

IMG_1260IMG_1261

I wanted to find a single .stl file that would allow me to characterize the Prusa i3 — which is the main type of 3D printer in the Harvard Lab.

I found this file on Thingiverse and remembered seeing it in lecture, so I thought I'd go ahead and print it.

However, when I realized how long it would take I decided to go with a simpler model from the class website.

IMG_1240

🍕Slicing the Model

I am going to use the PrusaSlicer. It can be installed on OSX but the build process seems a little… involved. So I'll be using the version installed on a Windows computer in the lab.

I downloaded the .stl file and opened it in PrusaSlicer. Then, keeping all the default settings, exported the g-code with CMD R and saved it on to the external drive.

IMG_1266

Plugged it into the 3D printer, selected the file and started the job. It says it should take about an hour.

That will give me plenty of time to figure out how to convert a shapefile to the stl format.

IMG_1258IMG_1256

🗺Designing a model

brew cask install blender

I need to figure out what I actually want to make. The assignment for the week is to 3d print an object that couldn't be made with subtractive manufacturing processes, like milling. For example, the a 3d printing can print ball joints in place. Also, now that I have figured out what I am going to make for my final project, it would be ideal if I could print something that is tangentially related to it.

But we saw how that went when I tried to scan my arm, so it might be better to focus on building an MVP first.

A few ideas in this vein, would be a prototype of the design to assess the dimensions or maybe a base for the bracelet while it is charging.

I'm not sure if either of these would really work, both in terms of being useful to the final project and satisfying the assignment.

Screen Shot 2019-10-02 at 2.06.05 PM

Another thing that I think might be cool is a topographic map of San Francisco. The elevation data is publicly available at data.sfgov.org. I would just need to figure out how to go from GeoJson or a ShapeFile to an .stl model.

I would live to regret this decision. I spent the majority of my time this week working trying to understand obscure GIS file formats and patch a 5 year old npm module. Anyway, enjoy my descent into insanity. 

A quick Google search lead me to this tool. It looked promising so I tried it out but I think something went wrong. I did some debugging… it seemed like the code to export the zip file didn't work.

I kept browsing around until I found this blog post from 2014 which looked promising. The author had even been thoughtful enough to convert their workflow into an npm module called shp2stl.

At this point, I thought I was basically done. I had shapefile and, now a tool, that could convert it into an stl file.

First, let's understand the pipeline. The shp2stl takes in a shapefile converts it to an ogr file in order to re-project its coordinates (whatever that means) The ogr file is then converted into geojson which is then converted into topojson which is then converted to a Three.js model which can finally be converted to an stl file.

Just take a moment to appreciate how insane this is! (but it works)

A limitation (or perhaps sane design decision) of the shp2stl library is that it is only able to extrude polygons. The San Francisco local government has helpfully shared a shapefile with the elevation contours of the city but its not working with the library. The main issue I'm facing is that the shapefile is malformed. Or rather, it is malformed for my purposes because it is composed of LineString elements, when ideally each contour ring would be a Polygon.

 

One fun note about the topojson specification (which can be found here) is that occasionally arcs indices are negative. It turns out this means that the order of the quantized steps in the arc geometry need to be reversed for this specific arc segment. Ugh.

 

I didn't actually end up writing that much code. Most of my time was spent figuring out how the pipeline worked and understand each of the formats.

var linePoints = function(points) {
	return [points[0], points.reduce((i, acc) => [acc[0] + i[0], acc[1] + i[1]])]
}

var isComplete = function (x) {
	var p = linePoints(x); 
	return p[0][0] == p[1][0] && p[0][1] == p[1][1]
}

function objArcs(obj, topology) {
	let steps = obj.arcs.reduce((acc, idx, i) => {
			var reverse = false
			if (idx < 0) {
				idx = ~idx
				reverse = true
			}

			var segment = topology.arcs[idx];
			console.log("seg", topology.arcs[idx])
			if (i > 0) {
				segment = segment.slice(1)
			}

			if (reverse) {
				segment.reverse()
			}

			return acc.concat(segment);

		}, [])
	console.log("isComplete:", isComplete(steps));
	return [steps, decodeArc(topology, steps)];
}

...

Well this took a long time.

Screen Shot 2019-10-02 at 12.36.24 PMScreen Shot 2019-10-02 at 12.36.24 PMIMG_1264

🚨Random Fire Drill

Luckily, I was not responsible!

Printing the Model

IMG_1271IMG_1273IMG_1270IMG_1282

I realized that the stl file was backwards only after I printed it out. Need to figure out how to mirror the print (https://service.netfabb.com/service.php) but that it for another day.

🌐Rendering .stl files on the web

http://tonylukasavage.com/blog/2013/04/10/web-based-stl-viewing-three-dot-js/