standard logo    Personal Education


bishop

Chess Bishop

This is the third piece in the design series of a chess set

The bishop was, once again, based on the pawn design to keep the set looking consistent. The biggest modification was height and a pair of rotated cylinders to represent the helmet. I expect to do a version of the bishop in the future with a more traditional helmet-with-slit top section. To see the lower sections, load and examine the scad file listed below which has the whole design code in it. If you have checked the notes for the pawn or the castle (rook), you will recognize the code for the bishop's base.

The order of translate and rotate commands matter. Explore.

Note:
The syntax of OpenSCAD does not rely on indents, so I have indented the action commands to make them more visible. Lines beginning with two slashes // are comments. Comments can also be added at the end of any line of active code. It is a good idea to put comments into your early code to make it easier to look back later to see what you had in mind.

I think the code shown next is confusing. It does the job, but the second translate() line "seems" to change the vertical location, but, by putting the translation after the rotation, the third value in the translate command is not vertical, but is a horizontal shift on the X axis instead in order to put the rotated cylinders to center properly.


// move up to the spot to put a top "helmet"  onto the bishop
        translate([0,0,38])
// rotate both cylinders by treating them together in a pair of curly brackets
        rotate([0,90,0]){
        translate([0,0,-4]) // adjust for the rotation
// and remove a smaller cylinder from the center of the larger one
        difference(){
 cylinder(8,6,6); // main cylinder made smaller than version 2b
        cylinder(9,2,2); //smaller 'difference' cylinder
        }  // end of difference
    } // end of rotated code
    
    

Lets see if a better sequence is possible. By putting the shift on the X axis first, before rotating, the shift is in the logical location of a translate command with the natural X/Y/Z order. Now, please understand, while learning to code, obvious fixes are not obvious. This change to the code was done while I was writing these notes. I know just a bit more about OpenSCAD today than I did back in December. Not a lot, but a bit more.

Back in December, I fiddled with the shift after I noticed that the top cylinder position wasn't right. The fix worked, even if it wasn't elegant or very clear. I guess the point is that you may stumble along, doing code which works in an early version but cleaning and simplifying it in later versions of your code.


// alternate  version of the code putting the X shift before the rotation
        translate([-4,0,38])
// rotate both cylinders by treating them together in a pair of curly brackets
        rotate([0,90,0]){
// and remove a smaller cylinder from the center of the larger one
        difference(){
        cylinder(8,6,6); // main cylinder made smaller than version 2b
        cylinder(9,2,2); //smaller 'difference' cylinder
        }  // end of difference
    } // end of rotated code

With the change above, I've created a new "final" version of the code: bishop2d.scad, and you can download it along with the earlier, less elegant version: bishop2c.scad.

Available Files:

bishop02c.scad - use this file to explore and study the design
bishop02d.scad - the upgraded version
bishop02c.stl - for those who just want to print this design
GPL3 License