#!/usr/bin/perl # # Look for 3D files and create a web page about them. #$url = "https://svn.so-much-stuff.com/svn/trunk/3D"; $url = "/pdp8/trunk/3D"; $head = <<'EOM'; EOM print $head; $status = 0; print "Here are some 3D design files mostly relevant to the PDP-8.\n"; print "These should mostly be printable with common 3D printing services\n"; print "like Shapeways, etc. Because .stl is no longer the prefered format,\n"; print "be advised that all of the STL files are now in mm, not inches.\n"; print "

Use the link in the page footer to let me know if there are issues\n"; print "with these files.\n"; print "

In no particular order:

\n"; print "\n"; $thisrow = 0; %work = (); # No sets found yet # .scad => .stl or .3mf foreach $scad (sort <*/*.scad>) { $noext = $scad; $noext =~ s/[.]scad$//; $work{$noext} = 1; next if -f "$noext.3mf"; next if -f "$noext.stl"; warn "no .stl or .3mf for $scad\n"; undef $work{$noext}; } # .skp => .stl foreach $skp (sort <*/*.skp>) { $noext = $skp; $noext =~ s/[.]...$//; $work{$noext} = 1; next if -f "$noext.stl"; warn "no .stl for $skp\n"; undef $work{$noext}; } # .stl => .3mf foreach $stl (sort <*/*.stl>) { $noext = $stl; $noext =~ s/[.]...$//; $work{$noext} = 1; # warn "./nonsolid $stl"; # $status += system("./nonsolid $stl") / 256; next if -f "$noext.3mf"; next if -f "$noext.stl"; warn "no .3mf for $stl\n"; undef $work{$noext}; } # Every .stl should be checked for solid # Every .3mf needs a .jpg image # Every .3mf needs a .txt description foreach $stl (sort keys %work) { # Skip artefacts next if $stl =~ /^mangled\//; next if $stl =~ /-mm$/; # Look for the best 3D file to download if (-f "$stl.3mf") { $prt = "$stl.3mf"; } else { $prt = "$stl.stl"; } # Look for a .jpg $jpg = "$stl.jpg"; $jpg =~ s/.jpg$/.png/ unless -f $jpg; warn "$stl: no image .jpg\n" unless -f $jpg; next unless -f $jpg; $txt = "$stl.txt"; warn "$stl: no descriptive .txt\n" unless -f $txt; next unless -f $txt; print "\n"; $thisrow++; if ($thisrow > 1) { print "\n"; print "\n"; $thisrow = 0; } } print "
"; if (-f $txt) { open(INPUT, $txt) || die "$txt: $!"; $dsc = || ($dsc = ""); print "$dsc
\n"; $dsc = ""; while () { $dsc .= $_; } close(INPUT); } else { $dsc = ""; } print "
\n"; $dir = "$stl"; $dir =~ s:/[^/]*::; print "Directory
\n"; $src = "$stl.scad"; if (-f $src) { print "OpenSCAD file
\n"; } $skp = $stl; $skp =~ s/.stl$/.skp/; if (-f $skp) { print "Sketchup file
\n"; } $stl = "$stl.stl"; print "STL file (Metric)
\n" if -f $stl; $mf = $stl; $mf =~ s/.stl$/.3mf/; if (-f $mf) { print "Print profile
\n"; } print $dsc; print "


\n"; $tail = <<'EOM'; EOM print $tail; exit $status;