What other parts need a similar treatment? I've already modded the code to deal with flexibile hose with
0 Technic Ribbed Hose XX Ribs
but it's easy to modify for other standardised parts.
Tim
PS. perl code below for anyone who wishes to do their own sets
Code:
use POSIX;
sub round {
return(floor(0.5+$_[0]));
}
# Auto generation file prefix (suffix is length)
$fpre="79c";
$author="Timothy Gould [timgould]";
#Description prefix
$pdesc="Technic Ribbed Hose ";
#Description suffix
$ldesc=" Ribs";
@length=();
foreach $i (2..30) {
push @length, round(10*$i/3.1)
}
# Length => Part number, Length => Part number, ...
%specno = (13=>71952);
foreach $l (@length)
{
$id=sprintf("%02d",$l); # Ensure space for two characters (with 0)
$tlen=sprintf("%2d",$l); # Ensure space for two characters (no 0)
if (exists $specno{$l}) {
# If there's a special name
$fname=$specno{$l}.".dat";
} else {
# Otherwise
$fname=$fpre.$id.".dat";
}
# Set the part description
$partdesc="$pdesc$tlen$ldesc";
print $fname." => ".$partdesc."\n";
# Length of a segment
$lseg=6.2;
# Start segment (for centering)
$sseg=($l-1)/2*$lseg;
# Generate the body of the part
$body="";
# First segment
$y=$sseg;
$body=$body.sprintf("1 16 %.1f 0 0 0 1 0 1 0 0 0 0 -1 79.DAT\n", $y);
# Middle segments
foreach $i (1..($l-2)) {
$y=$sseg-$i*$lseg;
$body=$body.
sprintf("1 16 %.1f 0 0 0 -1 0 1 0 0 0 0 1 80.DAT\n",$y);
}
# Last segment
$y=-$sseg;
$body=$body.sprintf("1 16 %.1f 0 0 0 -1 0 1 0 0 0 0 1 79.DAT\n",$y);
# Make the part text
$mask="0 $partdesc
0 Name: $fname
0 Author: $author
0 !LDRAW_ORG Unofficial_Part
0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt
0 BFC CERTIFY CCW
$body
";
# Write the part
open(FIL,">$fname");
print FIL $mask;
close(FIL);
}
$no=$#length+1;
print "Generated $no parts\n";
Tim Gould Wrote:Ahhhh... with all the sense that entails.
Do you know more than these 3?
Tim
5L = 76307, 6L = 76279, 7L = 76289, ...
76307 should be 70859
70859 Outer cable for TECHNIC 40mm
47040 Outer cable 40mm, red
47042 Outer cable 40mm, blue
47420 Outer cable 40mm, yellow
51976 Outer cable 40mm, dark stone grey
76307 Outer cable 40mm, dark grey
76279 should be 70860 (76279 is Outer cable 48mm, black)
76289 should be 70861 (76289 is Outer cable 4mm, dark grey)
-- joshua