discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Fwd: Loomis Heads

RW
Ray West
Mon, Mar 8, 2021 11:29 PM

Thanks to Jordan's code, and further assistance, I've added place
holders for feet and hands. I think, I will make all joints, knees,
ankles, hips etc, to give full 360deg articulation,  then maybe impose
limits on each axis if required. I have  put  the parts into a rough
proportion, based on an adult  figure being approximately 7.5 times the
height of the head. I can pose it, but I've yet to scale it down, print
it, and see if it looks right. Later on, it can be modified to give
shorter legs, bigger heads, child proportions/whatever. The code below,
needs my previously designed head added, also I need to refine hands and
feet and torso shape. I'm undecided on setting the angle for joints.
There are a lot of parameters to adjust. Will possibly need to be able
to twist the torso, but at the final small scale I am interested in I
doubt it will be noticeable, or a special case could be designed. It is
not easy positioning hands, etc, I may revert to restricting movement
earlier than i thought. Anyway, it's getting there.

//Cheap and dirty stick figure.
// Note that measurements are global values and picked up directly
// by the modules, while joint positions are parameters
// (which in turn come from global values).
// This is mostly because you can generally assume that the left and
// right arms are the same length, but the shoulders and elbows may
// be in different positions.

/* [ Measurements ] */

// dimensions in relation to head diameter - hd=350
 hd=350;

torso_h = hd3;
torso_w = hd
2;
torso_d = hd1;
shoulder_h = torso_h 7/8;
shoulder_d = hd
.7;
neck_h = hd/2;
neck_d = hd/2;
head_w = hd
.6;
head_h = hd*.86;
head_d = hd;
uarm_l = hd1.5;
uarm_d = hd
.7;
elbow_d = hd*.4;
larm_d = hd*.4;
larm_l = hd1.2;
uleg_l = hd
2;
uleg_d = hd0.8;
hip_d=hd
0.8;
knee_d=hd0.5;
lleg_l = hd
1.8;
lleg_d = hd0.5;
hand_l=hd
.8;
hand_w=hd*.5;
hand_h=hd*.2;
foot_l=hd1.2;
foot_w=hd
.4;
foot_h=hd*.3;
wrist_d=hd*.3;
ankle_d=hd*.4;

/* [ Joint positions ] */
lshoulder_xa = -90;
lshoulder_ya = 125;
lshoulder_za = -90;
rshoulder_xa = -90;
rshoulder_ya = 55;
rshoulder_za = -90;
lelbow_theta = 25;
relbow_theta = 5;
lhip_theta =18;
lhip_phi = 0;
rhip_theta = 0;
rhip_phi = 0;
lknee_theta =190;
rknee_theta =-170;
lwrist_xa=-90;
lwrist_ya=0;
lwrist_za=98;
rwrist_xa=90;
rwrist_ya=190;
rwrist_za=90;
lank_xa=-5;
lank_ya=5;
lank_za=-6;
rank_xa=-10;
rank_ya=0;
rank_za=-7;

// Children:
// 0 - neck
// 1 - left shoulder
// 2 - right shoulder
// 3 - left leg
// 4 - right leg
module torso() {
    scale([1, torso_d/torso_w, 1]) cylinder(h=torso_h,d=torso_w);
    translate([0,0,torso_h]) children(0);
    translate([torso_w/2, 0, shoulder_h]) children(1);
    translate([-torso_w/2, 0, shoulder_h]) children(2);
    translate([torso_w0.3, 0, 0]) children(3);
    translate([-torso_w
0.3, 0, 0]) children(4);
}

// Children:
// 0 - head
module neck() {
    cylinder(h=neck_h, d=neck_d);
    translate([0,0,neck_h]) children(0);
}

module head() {
    translate([0,0,head_h/2]) scale([head_w/head_h, head_d/head_h, 1])
sphere(d=head_h);
}

// Children
// 0 - upper arm
module shoulder(xa,ya,za) {
    sphere(d=shoulder_d);
    rotate([xa,ya,za]) children();
}

// Children
// 0 - elbow
module upper_arm() {
    rotate([0,90,0]) {
        cylinder(h=uarm_l, d1=uarm_d,d2=uarm_d*0.6);
        translate([0,0,uarm_l]) children();
    }
}

// Children
// 0 - lower arm
module elbow(theta) {
    sphere(d=elbow_d);
    rotate([theta,0,0]) children();
}

module lower_arm() {
    cylinder(d=larm_d, h=larm_l);
    translate([0,0,larm_l])children();
}

module wrist(xa,ya,za){
     sphere(d=wrist_d);
    rotate([xa,ya,za]) children();
}

module hand(){
  translate([-hand_w*.5,-hand_l,-hand_h*.5])cube([ hand_w,hand_l,hand_h]);
}

module hip(theta, phi) {
    sphere(d=hip_d);
    rotate([-theta, -phi]) children();
}

module upper_leg() {
    rotate([180,0,0]) cylinder(h=uleg_l, d1=uleg_d,d2=uleg_d*0.7 );
    translate([0,0,-uleg_l]) children();
}

module knee(theta) {
    sphere(d=knee_d);
    rotate([theta,0,0]) children();
}

module lower_leg() {
     cylinder(h=lleg_l, d1=lleg_d, d2=lleg_d*0.8);
    translate([0,0,lleg_l])children();
}
module ankle(xa,ya,za){
     sphere(d=ankle_d);
    rotate([xa,ya,za]) children();
   }

module foot(){
 translate([0,foot_l*.5, foot_h*.5])cube([ foot_w,foot_l,foot_h],true);
}

$fn=50;
torso() {
    neck() {
        head();
    }
    shoulder(lshoulder_xa,lshoulder_ya,lshoulder_za)
        upper_arm()
        elbow(lelbow_theta)
        lower_arm()
        wrist(lwrist_xa,lwrist_ya,lwrist_za)
        hand();

    mirror([1,0,0]) shoulder(rshoulder_xa,rshoulder_ya,rshoulder_za)
        upper_arm()
        elbow(relbow_theta)
        lower_arm()
        wrist(rwrist_xa,rwrist_ya,rwrist_za)
    echo(rwrist_za)
        hand();

    hip(lhip_theta, lhip_phi)
        upper_leg()
        knee(lknee_theta)
        lower_leg()
     ankle(lank_xa,lank_ya,lank_za)
        foot();
    mirror([1,0,0]) hip(rhip_theta, rhip_phi)
        upper_leg()
        knee(rknee_theta)
        echo(rknee_theta)
        lower_leg()
      ankle(rank_xa,rank_ya,rank_za)
      echo(rank_xa)
       foot();
}

Thanks to Jordan's code, and further assistance, I've added place holders for feet and hands. I think, I will make all joints, knees, ankles, hips etc, to give full 360deg articulation,  then maybe impose limits on each axis if required. I have  put  the parts into a rough proportion, based on an adult  figure being approximately 7.5 times the height of the head. I can pose it, but I've yet to scale it down, print it, and see if it looks right. Later on, it can be modified to give shorter legs, bigger heads, child proportions/whatever. The code below, needs my previously designed head added, also I need to refine hands and feet and torso shape. I'm undecided on setting the angle for joints. There are a lot of parameters to adjust. Will possibly need to be able to twist the torso, but at the final small scale I am interested in I doubt it will be noticeable, or a special case could be designed. It is not easy positioning hands, etc, I may revert to restricting movement earlier than i thought. Anyway, it's getting there. //Cheap and dirty stick figure. // Note that measurements are global values and picked up directly // by the modules, while joint positions are parameters // (which in turn come from global values). // This is mostly because you can generally assume that the left and // right arms are the same length, but the shoulders and elbows may // be in different positions. /* [ Measurements ] */ // dimensions in relation to head diameter - hd=350  hd=350; torso_h = hd*3; torso_w = hd*2; torso_d = hd*1; shoulder_h = torso_h *7/8; shoulder_d = hd*.7; neck_h = hd/2; neck_d = hd/2; head_w = hd*.6; head_h = hd*.86; head_d = hd; uarm_l = hd*1.5; uarm_d = hd*.7; elbow_d = hd*.4; larm_d = hd*.4; larm_l = hd*1.2; uleg_l = hd*2; uleg_d = hd*0.8; hip_d=hd*0.8; knee_d=hd*0.5; lleg_l = hd*1.8; lleg_d = hd*0.5; hand_l=hd*.8; hand_w=hd*.5; hand_h=hd*.2; foot_l=hd*1.2; foot_w=hd*.4; foot_h=hd*.3; wrist_d=hd*.3; ankle_d=hd*.4; /* [ Joint positions ] */ lshoulder_xa = -90; lshoulder_ya = 125; lshoulder_za = -90; rshoulder_xa = -90; rshoulder_ya = 55; rshoulder_za = -90; lelbow_theta = 25; relbow_theta = 5; lhip_theta =18; lhip_phi = 0; rhip_theta = 0; rhip_phi = 0; lknee_theta =190; rknee_theta =-170; lwrist_xa=-90; lwrist_ya=0; lwrist_za=98; rwrist_xa=90; rwrist_ya=190; rwrist_za=90; lank_xa=-5; lank_ya=5; lank_za=-6; rank_xa=-10; rank_ya=0; rank_za=-7; // Children: // 0 - neck // 1 - left shoulder // 2 - right shoulder // 3 - left leg // 4 - right leg module torso() {     scale([1, torso_d/torso_w, 1]) cylinder(h=torso_h,d=torso_w);     translate([0,0,torso_h]) children(0);     translate([torso_w/2, 0, shoulder_h]) children(1);     translate([-torso_w/2, 0, shoulder_h]) children(2);     translate([torso_w*0.3, 0, 0]) children(3);     translate([-torso_w*0.3, 0, 0]) children(4); } // Children: // 0 - head module neck() {     cylinder(h=neck_h, d=neck_d);     translate([0,0,neck_h]) children(0); } module head() {     translate([0,0,head_h/2]) scale([head_w/head_h, head_d/head_h, 1]) sphere(d=head_h); } // Children // 0 - upper arm module shoulder(xa,ya,za) {     sphere(d=shoulder_d);     rotate([xa,ya,za]) children(); } // Children // 0 - elbow module upper_arm() {     rotate([0,90,0]) {         cylinder(h=uarm_l, d1=uarm_d,d2=uarm_d*0.6);         translate([0,0,uarm_l]) children();     } } // Children // 0 - lower arm module elbow(theta) {     sphere(d=elbow_d);     rotate([theta,0,0]) children(); } module lower_arm() {     cylinder(d=larm_d, h=larm_l);     translate([0,0,larm_l])children(); } module wrist(xa,ya,za){      sphere(d=wrist_d);     rotate([xa,ya,za]) children(); } module hand(){   translate([-hand_w*.5,-hand_l,-hand_h*.5])cube([ hand_w,hand_l,hand_h]); } module hip(theta, phi) {     sphere(d=hip_d);     rotate([-theta, -phi]) children(); } module upper_leg() {     rotate([180,0,0]) cylinder(h=uleg_l, d1=uleg_d,d2=uleg_d*0.7 );     translate([0,0,-uleg_l]) children(); } module knee(theta) {     sphere(d=knee_d);     rotate([theta,0,0]) children(); } module lower_leg() {      cylinder(h=lleg_l, d1=lleg_d, d2=lleg_d*0.8);     translate([0,0,lleg_l])children(); } module ankle(xa,ya,za){      sphere(d=ankle_d);     rotate([xa,ya,za]) children();    } module foot(){  translate([0,foot_l*.5, foot_h*.5])cube([ foot_w,foot_l,foot_h],true); } $fn=50; torso() {     neck() {         head();     }     shoulder(lshoulder_xa,lshoulder_ya,lshoulder_za)         upper_arm()         elbow(lelbow_theta)         lower_arm()         wrist(lwrist_xa,lwrist_ya,lwrist_za)         hand();     mirror([1,0,0]) shoulder(rshoulder_xa,rshoulder_ya,rshoulder_za)         upper_arm()         elbow(relbow_theta)         lower_arm()         wrist(rwrist_xa,rwrist_ya,rwrist_za)     echo(rwrist_za)         hand();     hip(lhip_theta, lhip_phi)         upper_leg()         knee(lknee_theta)         lower_leg()      ankle(lank_xa,lank_ya,lank_za)         foot();     mirror([1,0,0]) hip(rhip_theta, rhip_phi)         upper_leg()         knee(rknee_theta)         echo(rknee_theta)         lower_leg()       ankle(rank_xa,rank_ya,rank_za)       echo(rank_xa)        foot(); }