Jason (jcreed) wrote,
Jason
jcreed

As promised!

Step one: model 11:45 in sketchup.
robot-screen1

Step two: take model apart in sketchup by tediously rotating polygons. Surely there is some way to script this, (modulo the computationally nontrivial part of avoiding overlapping polygons) but I took the scenic route this time.

robot-screen2

Step three: write horribly ad-hoc perl script to convert from the COLLADA data exported from Sketchup (exporting "Google Earth 4" yields a file that is secretly a .zip of COLLADA despite its .kmz extension) to postscript


sub group {
    my ($n) = shift;
    my @rv;
    while (@_) {
	my @buf = ();
	for (1..$n) {
	    push @buf, shift @_;
	}
	push @rv, [@buf];
     }
    return @rv;
}

my $ninputs = 0;

while (<>) {
    if (m(<float_array id="mesh(.*?)-geometry-position-array" count="(.*)?">(.*?) </float_array>)) {
	push @c,  {vertices => [group(3, split /\s+/, $3)]};
	$ninputs = 0;
    }
    if (m(<triangles(.*?)>)) {
	$ninputs = 0;
    }
    if (m(<input(.*?)>)) {
	$ninputs++;
    }
    if (m(<p>(.*?) </p>)) {
	$c[$#c]{triangles} = [group(3, group($ninputs, split /\s+/, $1))];
    }
}

sub plot_vertex {
    my ($x, $y, $cmd) = @_;
    print "$x $y $cmd\n";
}

print "0.5 0.5 scale\n";
print "0 400 translate\n";
for my $p (@c[0,1]) {
    print "%%% MESH\n";
    my $vs = $p->{vertices};
    my $ts = $p->{triangles};
    for my $t (@$ts) {
	print "newpath\n";
	plot_vertex($vs->[$t->[0][0]][0], $vs->[$t->[0][0]][1], "moveto");
	plot_vertex($vs->[$t->[1][0]][0], $vs->[$t->[1][0]][1], "lineto");
	plot_vertex($vs->[$t->[2][0]][0], $vs->[$t->[2][0]][1], "lineto");
	print "closepath fill\n";
    }
}



Step four: import into illustrator, fiddle with colors and such.

robot-screen3

(pdf file here if you wish to make your own)

Step five: print out and assemble. (the arms didn't make it)

0813081640

Step six: Rock out.

0813081647

Step seven: Rock out some more.

0813081646
Tags: robots
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 30 comments