jumper wire position

jumper wire position

/*
	Assembly: LogoBotAssembly

	Master assembly for the LogoBot

	Local Frame:
		Centred on the origin, such that bottom edge of wheels sit on XY plane.
		Front of the robot faces towards y+

	Parameters:
		PenLift - Set to true to include a PenLift, defaults to false

	Returns:
		Complete LogoBot model

*/

// Connectors
// ----------
// These are used within this module to layout the various vitamins/sub-assemblies
// The same connectors are used to shape associated portions of the LogoBotBase_STL

LogoBot_Con_Breadboard          = [[0, 12, 0],[0,0,-1], -90,0,0];

LogoBot_Con_LeftMotorDriver     = [[-20, 16, 3],[0,0,1],180,0,0];
LogoBot_Con_RightMotorDriver    = [[20, 16, 3],[0,0,1],180,0,0];

LogoBot_Con_Caster = [ [0, -BaseDiameter/2 + 10, 0], [0,0,1], 0, 0, 0];

LogoBot_Con_PenLift = [ [-20, -5, 10], [0,1,0], 0, 0, 0];

// Assembly
// --------

function LogoBotAssembly_NumSteps() = 10 + (PenLift ? 1 : 0);

module LogoBotAssembly ( PenLift=false ) {

    Assembly("LogoBot");

	translate([0, 0, GroundClearance]) {

		// Default Design Elements
		// -----------------------

		// Base
		LogoBotBase_STL();

        step(1,
            "Connect the breadboard assembly to the underside of the base",
            "400 300 0 17 12 112 0 222 513")
		    attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170), ExplodeSpacing=-20)
		    BreadboardAssembly();

		// Bumper assemblies (x2)
		step(2, "Connect the two bumper assemblies", "400 300 -6 7 19 64 1 212 625" )
		    for (x=[0,1], y=[0,1])
			mirror([0,y,0])
			mirror([x,0,0])
			translate([(BaseDiameter/2-10) * cos(45), (BaseDiameter/2-10) * sin(45), -8 ])
			rotate([0,0,-30])
			MicroSwitch();

		// Motor + Wheel assemblies (x2)
		step(3, "Connect the two wheel assemblies", "400 300 -4 6 47 66 0 190 740")
            for (i=[0:1])
                mirror([i,0,0])
                translate([BaseDiameter/2 + MotorOffsetX, 0, MotorOffsetZ])
                translate([-15,0,0])
                attach(DefConDown, DefConDown, ExplodeSpacing = 40)
                translate([15,0,0])
                rotate([-90, 0, 90]) {
                    assign($rightSide= i == 0? 1 : 0)
                        WheelAssembly();
                }

		step(4, "Push the two motor drivers onto the mounting posts", "400 300 -6 7 19 64 1 212 625") {
		    // Left Motor Driver
		    attach(LogoBot_Con_LeftMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperLeft), ExplodeSpacing=-20)
			    ULN2003DriverBoard();

		    // Right Motor Driver
		    attach(LogoBot_Con_RightMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperRight), ExplodeSpacing=-20)
			    ULN2003DriverBoard();
		}

		// Connect jumper wires
		step(5,
		    "Connect the jumper wires between the motor drivers and the Arduino",
		    "400 300 9 26 54 38 0 161 766")
		    {
		        // TODO: Insert appropriate connectors
		        JumperWire(
                    type = JumperWire_FM4,
                    con1 = [[34,43,10], [0,0,-1], 0,0,0],
                    con2 = [[11.5,31.5, -6], [0,0,-1], 0,0,0],
                    length = 70,
                    conVec1 = [1,0,0],
                    conVec2 = [0,-1,0],
                    midVec = [0.5,-1,0]
                );

                // TODO: Insert appropriate connectors
		        JumperWire(
                    type = JumperWire_FM4,
                    con1 = [[-31.5,43,10], [0,0,-1], 0,0,0],
                    con2 = [[-9,31.5, -6], [0,0,-1], 0,0,0],
                    length = 70,
                    conVec1 = [1,0,0],
                    conVec2 = [0,-1,0],
                    midVec = [0,0,-1]
                );

		    }

		// Battery assembly
		step(6, "Clip in the battery pack", "400 300 -6 7 19 64 1 212 625")
		    translate([-25, -45, 12])
			rotate([90, 0, 90])
			battery_pack_double(2, 4);

		// Power Switch

		// LED
		step(7, "Clip the LED into place", "400 300 -6 7 19 64 1 212 625")
		    translate([0, -10, BaseDiameter/2])
			LED();

		// Piezo
		step(8, "Clip the piezo sounder into place", "400 300 -6 7 19 64 1 212 625")
		    translate([-37, -32, 10])
			murata_7BB_12_9();

		// Caster
		//   Example of using attach
		// TODO: Correct ground clearance!
		step(9, "Push the caster assembly into the base so that it snaps into place",
		    "400 300 -6 7 19 115 1 26 625")
		    attach(LogoBot_Con_Caster, MarbleCastor_Con_Default, Explode=Explode, ExplodeSpacing=15)
			MarbleCasterAssembly();

		// Conditional Design Elements
		// ---------------------------

		// PenLift
		//   Placeholder of a micro servo to illustrate having conditional design elements
		if (PenLift) {
			// TODO: wrap into a PenLift sub-assembly
			step(10, "Fit the pen lift assembly", "400 300 -6 7 19 64 1 212 625")
			    attach( LogoBot_Con_PenLift, MicroServo_Con_Horn)
				MicroServo();
		}

		// Shell + fixings
		step(PenLift ? 11 : 10,
		    "Push the shell down onto the base and twist to lock into place",
		    "400 400 11 -23 65 66 0 217 1171")
	        attach(DefConDown, DefConDown, ExplodeSpacing=BaseDiameter/2)
	        BasicShell_STL();
	}

	End("LogoBot");
}

/*
	STL: LogoBotBase_STL

	The printable base plate for the robot.

	The _STL suffix denotes this is a printable part, and is used by the bulk STL generating program

	Local Frame:
		Base lies on XY plane, centered on origin, front of robot is towards y+

	Parameters:
		None

	Returns:
		Base plate, rendered and colored
*/

module LogoBotBase_STL() {

    STL("LogoBotBase");

    // turn off explosions inside STL!!!
    $Explode = false;

	// Color it as a printed plastic part
	color(PlasticColor)
	    if (UseSTL) {
	        import(str(STLPath, "LogoBotBase.stl"));
	    } else {
	        union() {
	            // Start with an extruded base plate, with all the relevant holes punched in it
                linear_extrude(BaseThickness)
                    difference() {
                        // Union together all the bits to make the plate
                        union() {
                            // Base plate
                            circle(r=BaseDiameter/2);
                        }

                        // hole for breadboard
                        attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170))
                            difference() {
                                translate([2,2,0])
                                    square([Breadboard_Width(Breadboard_170)-4, Breadboard_Depth(Breadboard_170)-4]);

                                // attach mounting points, has the effect of not differencing them
                                attach(Breadboard_Con_BottomLeft(Breadboard_170),DefCon) {
                                    circle(r=4/2 + dw);
                                    translate([0, -2 - dw, 0])
                                        square([10, 4 + 2*dw]);
                                }

                                attach(Breadboard_Con_BottomRight(Breadboard_170),DefCon) {
                                    circle(r=4/2 + dw);
                                    rotate([0,0,180])
                                        translate([0, -2 - dw, 0])
                                        square([10, 4 + 2*dw]);
                                }
                            }

                        // mounting holes for breadboard
                        attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170)) {
                            attach(Breadboard_Con_BottomLeft(Breadboard_170),DefCon)
                                circle(r=4.3/2);

                            attach(Breadboard_Con_BottomRight(Breadboard_170),DefCon)
                                circle(r=4.3/2);
                        }

                        // weight loss holes under the motor drivers
                        attach(LogoBot_Con_LeftMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperLeft))
                            roundedSquare([ULN2003Driver_BoardWidth - 2*ULN2003Driver_HoleInset, ULN2003Driver_BoardHeight - 2*ULN2003Driver_HoleInset], tw);

		                // Right Motor Driver
		                attach(LogoBot_Con_RightMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperRight))
			                roundedSquare([ULN2003Driver_BoardWidth - 2*ULN2003Driver_HoleInset, ULN2003Driver_BoardHeight - 2*ULN2003Driver_HoleInset], tw);

                        // slots for wheels
                        for (i=[0:1])
                            mirror([i,0,0])
                            translate([BaseDiameter/2 + MotorOffsetX, 0, MotorOffsetZ])
                            rotate([-90, 0, 90]) {
                                translate([-1,0,0])
                                    roundedSquare([WheelThickness + tw, WheelDiameter + tw], (WheelThickness + tw)/2, center=true);
                            }

                        // weight loss under battery pack
                        translate([-57/2, -45])
                            roundedSquare([57, 30], tw);

                        // Centre hole for pen
                        circle(r=PenHoleDiameter/2);

                        // Chevron at the front so we're clear where the front is!
                        translate([0, BaseDiameter/2 - 10, 0])
                            Chevron(width=10, height=6, thickness=3);

                        // Caster
                        //   Example of using attach to punch an appropriate fixing hole
                        attach(LogoBot_Con_Caster, PlasticCastor_Con_Default)
                            circle(r = connector_bore(PlasticCastor_Con_Default) / 2);

                        // A load of fixing holes around the edge...  just as an example of how to do it
                        // NB: This is one of the examples we discussed during the wk1 session
                        // TODO: Decide if we want these back...
                        *for (i=[0:9])
                            rotate([0, 0, i * 360/10])
                            translate([BaseDiameter/2 - 5, 0, 0])
                            circle(r=4.3/2);  // M4 fixing holes

                        // Remove shell fittings
                        Shell_TwistLockCutouts();
                    }

                // Now union on any other bits (i.e. sticky-up bits!)

                // clips for the motors
                LogoBotBase_MotorClips();

                LogoBotBase_MotorDriverPosts();

            }
        }
}

module LogoBotBase_STL_View() {
    echo("400 300 0 0 0 58 0 225 681");
}

module LogoBotBase_MotorClips() {
    // TODO: feed these local variables from the motor vitamin global vars
    mbr = 28/2;  // motor body radius
    mao = 8;     // motor axle offset from centre of motor body
    mth = 7;     // motor tab height

    // clips
    for (i=[0:1], j=[0,1])
        mirror([i,0,0])
        translate([BaseDiameter/2 + MotorOffsetX - 6 - j*12, 0, MotorOffsetZ + mao])
        rotate([-90, 0, 90])
        rotate([0,0, 0])
        linear_extrude(5) {
            difference() {
                union() {

                    difference() {
                        hull() {
                            // main circle
                            circle(r=mbr + dw);

                            // extension to correctly union to the base plate
                            translate([-(mbr * 1.5)/2,  MotorOffsetZ + mao -1,0])
                                square([mbr * 1.5, 1]);
                        }

                        // trim the top off
                        rotate([0,0,180 + 30])
                            sector2D(r=mbr+30, a=120);
                    }

                    // welcoming hands
                    for (k=[0,1])
                        mirror([k,0,0])
                        rotate([0,0,180+30])
                        translate([mbr, -dw, 0])
                        polygon([[1.5,0],[4,5],[3,5],[0,dw]],4);
                }

                // hollow for the motor
                circle(r=mbr);

            }
        }
}

module LogoBotBase_MotorDriverPosts() {
    // mounting posts for motor drivers
    // left driver example
    // TODO: Replace this with a loop
    // using a mirror because the layout is symmetrical
    for (i=[0,1])
        mirror([i,0,0])
        attach(
            offsetConnector(invertConnector(LogoBot_Con_LeftMotorDriver), [0,0, -LogoBot_Con_LeftMotorDriver[0][2]]),
            ULN2003DriverBoard_Con_UpperLeft)
        {
            // Now we're inside the driver boards local coordinate system, which is relative to the LowerLeft mount point.
            // To position things relative to the local frame, we need to "reverse" attach them by swapping the order
            // of the connectors.
            attach(ULN2003DriverBoard_Con_UpperLeft, ULN2003DriverBoard_Con_LowerLeft)
                LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            attach(ULN2003DriverBoard_Con_UpperRight, ULN2003DriverBoard_Con_LowerLeft)
                 LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            attach(ULN2003DriverBoard_Con_LowerRight, ULN2003DriverBoard_Con_LowerLeft)
                 LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            // the lower left post doesn't need translating
            LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);
        }
}

module LogoBotBase_MountingPost(r1=5/2, h1=3, r2=3/2, h2=3) {
    cylinder(r=r1, h=h1);
    translate([0,0,h1-eta])
        cylinder(r1=r2, r2=r2 * 0.7, h=h2 +eta);
}

/*
	Assembly: LogoBotAssembly

	Master assembly for the LogoBot

	Local Frame:
		Centred on the origin, such that bottom edge of wheels sit on XY plane.
		Front of the robot faces towards y+

	Parameters:
		PenLift - Set to true to include a PenLift, defaults to false

	Returns:
		Complete LogoBot model

*/

// Connectors
// ----------
// These are used within this module to layout the various vitamins/sub-assemblies
// The same connectors are used to shape associated portions of the LogoBotBase_STL

LogoBot_Con_Breadboard          = [[0, 12, 0],[0,0,-1], -90,0,0];

LogoBot_Con_LeftMotorDriver     = [[-20, 16, 3],[0,0,1],180,0,0];
LogoBot_Con_RightMotorDriver    = [[20, 16, 3],[0,0,1],180,0,0];

LogoBot_Con_Caster = [ [0, -BaseDiameter/2 + 10, 0], [0,0,1], 0, 0, 0];

LogoBot_Con_PenLift = [ [-20, -5, 10], [0,1,0], 0, 0, 0];

// Assembly
// --------

function LogoBotAssembly_NumSteps() = 10 + (PenLift ? 1 : 0);

module LogoBotAssembly ( PenLift=false ) {

    Assembly("LogoBot");

	translate([0, 0, GroundClearance]) {

		// Default Design Elements
		// -----------------------

		// Base
		LogoBotBase_STL();

        step(1,
            "Connect the breadboard assembly to the underside of the base",
            "400 300 0 17 12 112 0 222 513")
		    attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170), ExplodeSpacing=-20)
		    BreadboardAssembly();

		// Bumper assemblies (x2)
		step(2, "Connect the two bumper assemblies", "400 300 -6 7 19 64 1 212 625" )
		    for (x=[0,1], y=[0,1])
			mirror([0,y,0])
			mirror([x,0,0])
			translate([(BaseDiameter/2-10) * cos(45), (BaseDiameter/2-10) * sin(45), -8 ])
			rotate([0,0,-30])
			MicroSwitch();

		// Motor + Wheel assemblies (x2)
		step(3, "Connect the two wheel assemblies", "400 300 -4 6 47 66 0 190 740")
            for (i=[0:1])
                mirror([i,0,0])
                translate([BaseDiameter/2 + MotorOffsetX, 0, MotorOffsetZ])
                translate([-15,0,0])
                attach(DefConDown, DefConDown, ExplodeSpacing = 40)
                translate([15,0,0])
                rotate([-90, 0, 90]) {
                    assign($rightSide= i == 0? 1 : 0)
                        WheelAssembly();
                }

		step(4, "Push the two motor drivers onto the mounting posts", "400 300 -6 7 19 64 1 212 625") {
		    // Left Motor Driver
		    attach(LogoBot_Con_LeftMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperLeft), ExplodeSpacing=-20)
			    ULN2003DriverBoard();

		    // Right Motor Driver
		    attach(LogoBot_Con_RightMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperRight), ExplodeSpacing=-20)
			    ULN2003DriverBoard();
		}

		// Connect jumper wires
		step(5,
		    "Connect the jumper wires between the motor drivers and the Arduino",
		    "400 300 9 26 54 38 0 161 766")
		    {
		        // TODO: Insert appropriate connectors
		        JumperWire(
                    type = JumperWire_FM4,
                    con1 = [[34,43,10], [0,0,-1], 0,0,0],
                    con2 = [[11.5,31.5, -8], [0,0,-1], 0,0,0],
                    length = 70,
                    conVec1 = [1,0,0],
                    conVec2 = [0,-1,0],
                    midVec = [0.5,-1,0]
                );

                // TODO: Insert appropriate connectors
		        JumperWire(
                    type = JumperWire_FM4,
                    con1 = [[-31.5,43,10], [0,0,-1], 0,0,0],
                    con2 = [[-9,31.5, -8], [0,0,-1], 0,0,0],
                    length = 70,
                    conVec1 = [1,0,0],
                    conVec2 = [0,-1,0],
                    midVec = [0,0,-1]
                );

		    }

		// Battery assembly
		step(6, "Clip in the battery pack", "400 300 -6 7 19 64 1 212 625")
		    translate([-25, -45, 12])
			rotate([90, 0, 90])
			battery_pack_double(2, 4);

		// Power Switch

		// LED
		step(7, "Clip the LED into place", "400 300 -6 7 19 64 1 212 625")
		    translate([0, -10, BaseDiameter/2])
			LED();

		// Piezo
		step(8, "Clip the piezo sounder into place", "400 300 -6 7 19 64 1 212 625")
		    translate([-37, -32, 10])
			murata_7BB_12_9();

		// Caster
		//   Example of using attach
		// TODO: Correct ground clearance!
		step(9, "Push the caster assembly into the base so that it snaps into place",
		    "400 300 -6 7 19 115 1 26 625")
		    attach(LogoBot_Con_Caster, MarbleCastor_Con_Default, Explode=Explode, ExplodeSpacing=15)
			MarbleCasterAssembly();

		// Conditional Design Elements
		// ---------------------------

		// PenLift
		//   Placeholder of a micro servo to illustrate having conditional design elements
		if (PenLift) {
			// TODO: wrap into a PenLift sub-assembly
			step(10, "Fit the pen lift assembly", "400 300 -6 7 19 64 1 212 625")
			    attach( LogoBot_Con_PenLift, MicroServo_Con_Horn)
				MicroServo();
		}

		// Shell + fixings
		step(PenLift ? 11 : 10,
		    "Push the shell down onto the base and twist to lock into place",
		    "400 400 11 -23 65 66 0 217 1171")
	        attach(DefConDown, DefConDown, ExplodeSpacing=BaseDiameter/2)
	        BasicShell_STL();
	}

	End("LogoBot");
}

/*
	STL: LogoBotBase_STL

	The printable base plate for the robot.

	The _STL suffix denotes this is a printable part, and is used by the bulk STL generating program

	Local Frame:
		Base lies on XY plane, centered on origin, front of robot is towards y+

	Parameters:
		None

	Returns:
		Base plate, rendered and colored
*/

module LogoBotBase_STL() {

    STL("LogoBotBase");

    // turn off explosions inside STL!!!
    $Explode = false;

	// Color it as a printed plastic part
	color(PlasticColor)
	    if (UseSTL) {
	        import(str(STLPath, "LogoBotBase.stl"));
	    } else {
	        union() {
	            // Start with an extruded base plate, with all the relevant holes punched in it
                linear_extrude(BaseThickness)
                    difference() {
                        // Union together all the bits to make the plate
                        union() {
                            // Base plate
                            circle(r=BaseDiameter/2);
                        }

                        // hole for breadboard
                        attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170))
                            difference() {
                                translate([2,2,0])
                                    square([Breadboard_Width(Breadboard_170)-4, Breadboard_Depth(Breadboard_170)-4]);

                                // attach mounting points, has the effect of not differencing them
                                attach(Breadboard_Con_BottomLeft(Breadboard_170),DefCon) {
                                    circle(r=4/2 + dw);
                                    translate([0, -2 - dw, 0])
                                        square([10, 4 + 2*dw]);
                                }

                                attach(Breadboard_Con_BottomRight(Breadboard_170),DefCon) {
                                    circle(r=4/2 + dw);
                                    rotate([0,0,180])
                                        translate([0, -2 - dw, 0])
                                        square([10, 4 + 2*dw]);
                                }
                            }

                        // mounting holes for breadboard
                        attach(LogoBot_Con_Breadboard, Breadboard_Con_BottomLeft(Breadboard_170)) {
                            attach(Breadboard_Con_BottomLeft(Breadboard_170),DefCon)
                                circle(r=4.3/2);

                            attach(Breadboard_Con_BottomRight(Breadboard_170),DefCon)
                                circle(r=4.3/2);
                        }

                        // weight loss holes under the motor drivers
                        attach(LogoBot_Con_LeftMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperLeft))
                            roundedSquare([ULN2003Driver_BoardWidth - 2*ULN2003Driver_HoleInset, ULN2003Driver_BoardHeight - 2*ULN2003Driver_HoleInset], tw);

		                // Right Motor Driver
		                attach(LogoBot_Con_RightMotorDriver, invertConnector(ULN2003DriverBoard_Con_UpperRight))
			                roundedSquare([ULN2003Driver_BoardWidth - 2*ULN2003Driver_HoleInset, ULN2003Driver_BoardHeight - 2*ULN2003Driver_HoleInset], tw);

                        // slots for wheels
                        for (i=[0:1])
                            mirror([i,0,0])
                            translate([BaseDiameter/2 + MotorOffsetX, 0, MotorOffsetZ])
                            rotate([-90, 0, 90]) {
                                translate([-1,0,0])
                                    roundedSquare([WheelThickness + tw, WheelDiameter + tw], (WheelThickness + tw)/2, center=true);
                            }

                        // weight loss under battery pack
                        translate([-57/2, -45])
                            roundedSquare([57, 30], tw);

                        // Centre hole for pen
                        circle(r=PenHoleDiameter/2);

                        // Chevron at the front so we're clear where the front is!
                        translate([0, BaseDiameter/2 - 10, 0])
                            Chevron(width=10, height=6, thickness=3);

                        // Caster
                        //   Example of using attach to punch an appropriate fixing hole
                        attach(LogoBot_Con_Caster, PlasticCastor_Con_Default)
                            circle(r = connector_bore(PlasticCastor_Con_Default) / 2);

                        // A load of fixing holes around the edge...  just as an example of how to do it
                        // NB: This is one of the examples we discussed during the wk1 session
                        // TODO: Decide if we want these back...
                        *for (i=[0:9])
                            rotate([0, 0, i * 360/10])
                            translate([BaseDiameter/2 - 5, 0, 0])
                            circle(r=4.3/2);  // M4 fixing holes

                        // Remove shell fittings
                        Shell_TwistLockCutouts();
                    }

                // Now union on any other bits (i.e. sticky-up bits!)

                // clips for the motors
                LogoBotBase_MotorClips();

                LogoBotBase_MotorDriverPosts();

            }
        }
}

module LogoBotBase_STL_View() {
    echo("400 300 0 0 0 58 0 225 681");
}

module LogoBotBase_MotorClips() {
    // TODO: feed these local variables from the motor vitamin global vars
    mbr = 28/2;  // motor body radius
    mao = 8;     // motor axle offset from centre of motor body
    mth = 7;     // motor tab height

    // clips
    for (i=[0:1], j=[0,1])
        mirror([i,0,0])
        translate([BaseDiameter/2 + MotorOffsetX - 6 - j*12, 0, MotorOffsetZ + mao])
        rotate([-90, 0, 90])
        rotate([0,0, 0])
        linear_extrude(5) {
            difference() {
                union() {

                    difference() {
                        hull() {
                            // main circle
                            circle(r=mbr + dw);

                            // extension to correctly union to the base plate
                            translate([-(mbr * 1.5)/2,  MotorOffsetZ + mao -1,0])
                                square([mbr * 1.5, 1]);
                        }

                        // trim the top off
                        rotate([0,0,180 + 30])
                            sector2D(r=mbr+30, a=120);
                    }

                    // welcoming hands
                    for (k=[0,1])
                        mirror([k,0,0])
                        rotate([0,0,180+30])
                        translate([mbr, -dw, 0])
                        polygon([[1.5,0],[4,5],[3,5],[0,dw]],4);
                }

                // hollow for the motor
                circle(r=mbr);

            }
        }
}

module LogoBotBase_MotorDriverPosts() {
    // mounting posts for motor drivers
    // left driver example
    // TODO: Replace this with a loop
    // using a mirror because the layout is symmetrical
    for (i=[0,1])
        mirror([i,0,0])
        attach(
            offsetConnector(invertConnector(LogoBot_Con_LeftMotorDriver), [0,0, -LogoBot_Con_LeftMotorDriver[0][2]]),
            ULN2003DriverBoard_Con_UpperLeft)
        {
            // Now we're inside the driver boards local coordinate system, which is relative to the LowerLeft mount point.
            // To position things relative to the local frame, we need to "reverse" attach them by swapping the order
            // of the connectors.
            attach(ULN2003DriverBoard_Con_UpperLeft, ULN2003DriverBoard_Con_LowerLeft)
                LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            attach(ULN2003DriverBoard_Con_UpperRight, ULN2003DriverBoard_Con_LowerLeft)
                 LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            attach(ULN2003DriverBoard_Con_LowerRight, ULN2003DriverBoard_Con_LowerLeft)
                 LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);

            // the lower left post doesn't need translating
            LogoBotBase_MountingPost(r1=(ULN2003Driver_HoleDia+2)/2, h1 = LogoBot_Con_LeftMotorDriver[0][2], r2=ULN2003Driver_HoleDia/2, h2=3);
        }
}

module LogoBotBase_MountingPost(r1=5/2, h1=3, r2=3/2, h2=3) {
    cylinder(r=r1, h=h1);
    translate([0,0,h1-eta])
        cylinder(r1=r2, r2=r2 * 0.7, h=h2 +eta);
}


Add a basic OpenSCAD file.

Add a basic OpenSCAD file.

//All units are in cm

module usb_port ()
{
	difference() {
		cube([0.65, 1.4, .5], center=true);
		cube([0.45, 1.2, .6], center=true);
	}
}

module female_header ()
{
	difference() {
		cube([0.3, 0.3, 0.9], center=true);
		cube([0.1, 0.1, 1], center=true);
	}
}

module console_body()
{
	difference() {
		union() {
			difference() {
				difference() {
					// The main body, hollow
					cube([12, 12, 8], center=true);
					cube([11.5, 11.5, 7.5], center=true);
				}

				// Slot cutout
				translate([0, 3, 3.1]) {
					cube([10, 2, 2.1], center=true);
				}
			}

			difference() {
				// The physical Slot (the part that collects dust and soda)
				translate([0, 3, 3.1]) {
					difference() {
						translate([0, 0, -.1]) {
							cube([10.75, 2.75, 2], center=true);
						}
						cube([10, 2, 2], center=true);
					}
				}

				// Cutouts for Slot USB in physical slot
				for(i=[-1, 1]) {
					translate([3.8*i, 3, 2]){
						cube([0.75, 1.5, 0.7], center=true);
					}
				}
			}
		}

		// Front USB cutouts
		for(i=[-1, 1]) {
			translate([3.8*i, -6, 0]){
				rotate([90, 90, 0]) {
					cube([0.75, 1.5, 0.7], center=true);
				}
			}
		}
	}
}

module console()
{
	// Console Shell
	console_body();

	// USB ports on front
	translate([0, -5.75, 0]) {
		rotate([90, 0, 0]) {
			for(i=[-1, 1]) {
				translate([3.8*i, 0, 0]) {
					rotate([0, 0, 90]) {
						usb_port();
					}
				}
			}
		}
	}

	cube([8, 8, 10], center=true);

	// USB ports in Slot
	for(i=[-1, 1]) {
		translate([3.8*i, 3, 3-.6]) {
			usb_port();
		}
	}

	// GPIO
	translate([-((13*0.254)/2), 3, 2]){
		for(i = [0:13]) {
			for(j=[-1, 1]) {
				translate([i*0.254, (0.254/2)*j, 0]) {
					female_header();
				}
			}
		}
	}

	// The following are not specified because the specification doesn't care.
	// TODO: HDMI Jack
	// TODO: Power Jack
	// TODO: Ethernet Jack
	// TODO: RCA Video Jack
	// TODO: 3.5mm Phono Jack

}

console();

error: pathspec 'moro.scad' did not match any file(s) known to git


main: print build area Z

main: print build area Z


Extruder top mount for Kossel

Extruder top mount for Kossel

beam_size = 15;

module beam(length) {
    cube([beam_size, beam_size, length], true);
}

long_beam_distance = 383;
long_beam_length = 750;
short_beam_length = 360;
short_beam_offset = 16.8; // ???

module frame() {
    half_beam_size = beam_size / 2;
    module long_beam() {
        translate([0, 0, long_beam_length / 2])
            beam(long_beam_length);
    }

    module short_beam() {
        translate([0, 0, half_beam_size])
        rotate([0, 90, 0])
            beam(short_beam_length);
    }

    module side() {
        translate([0, -short_beam_offset, 0])
            short_beam();
        translate([0, -short_beam_offset, beam_size * 2])
            short_beam();
        translate([0, -short_beam_offset, long_beam_length - beam_size])
            short_beam();
    }
    translate([0,-long_beam_distance*sqrt(3)/3,0]) {
        long_beam();
        rotate([0, 0, 60])
            translate([long_beam_distance, 0, 0])
                rotate([0, 0, 60])
                    long_beam();
        rotate([0, 0, 120])
            translate([long_beam_distance, 0, 0])
                rotate([0, 0, 120])
                    long_beam();

        rotate([0, 0, 60])
            translate([long_beam_distance/2, 0, 0])
                side();

        rotate([0, 0, 300])
            translate([-long_beam_distance/2, 0, 0])
                side();

        rotate([0, 0, 60])
            translate([long_beam_distance, 0, 0])
                rotate([0, 0, 120])
                    translate([long_beam_distance/2, 0, 0])
                        side();
    }
}

module bed() {
    bed_diameter = 250;
    translate([0, 0, beam_size * 3 + 4])
        cylinder(r = bed_diameter / 2, h = 3);
}

frame();
bed();

module one_third() {
    short_wall_distance = 20;
    long_wall_distance = 43;
    short_wall_width = 120;
    long_wall_width = 380;

    //short_wall_distance = 7;
    //long_wall_distance = 50;
    //short_wall_width = 153;
    //long_wall_width = 329;

    //short_wall_distance = 5;
    //long_wall_distance = 50;
    //short_wall_width = 155.9;
    //long_wall_width = 324.75;

    //short_wall_distance = 7.35;
    //long_wall_distance = 50;
    //short_wall_width = 153;
    //long_wall_width = 330;
    wall_ext=3.3;
    color("red") {
        translate([0,-35.62 -7.5,750+ 3])
            cube([15,356,6],true);
    }
    color("blue") {
        translate([0,356/2+25-35.62 -7.5,750+ 3])
            cube([15,50,6],true);
    }
    wall_height = 720;
    #translate([0,-long_beam_distance*sqrt(3)/3 -9-short_wall_distance,750/2+15]) {
        color("Green") cube([short_wall_width,3,wall_height], true);
        color("PaleGreen") cube([short_wall_width+wall_ext,0.05,wall_height], true);
    }
    #rotate([0,0,60]) translate([0,-(356/2-35.62 -7.5+1.5+long_wall_distance),750/2+15]) {
        color("Green") cube([long_wall_width,3,wall_height], true);
        color("PaleGreen") cube([long_wall_width+wall_ext,0.05,wall_height], true);
    }

//    xx = 260;
//    yy = 90;
//    translate([xx,yy,0]) color("green") cube([2,2,10000],true);
//    translate([-xx,-yy,0])
//    rotate([0,0,60]) translate([0,-(356/2-35.62 -7.5+1.5+long_wall_distance),750/2+15]) {
//        color("Green") cube([long_wall_width,3,wall_height], true);
//        color("PaleGreen") cube([long_wall_width+wall_ext,0.05,wall_height], true);
//    }

}

//one_third();
//rotate([0,0,120]) one_third();
//rotate([0,0,-120]) one_third();

module extruder_holder(part="all") {
    brace_wall_thickness = 4;
    rotor_r = 18;
    clamp_h = 22;
    clamp_thickness = 7;
    offset_y = -25;
    height = 152.5;

    module brace_negative() {
        difference() {
            union() {
                translate([0,0,500+beam_size/2])cube([1000,1000,1000],true);
                translate([0,500+beam_size/2,0])cube([1000,1000,1000],true);
                translate([0,500-beam_size/2,500-beam_size/2])cube([1000,1000,1000],true);
            }
            translate([0,0,-beam_size/2]) cube([1000+1, 3, 5],true);
            translate([0,-beam_size/2,0]) cube([1000+1, 5, 3],true);
        }
    }

    module brace(length = 50) {
        difference() {
            cube([length, beam_size + brace_wall_thickness*2, beam_size + brace_wall_thickness*2],true);
            brace_negative();
        }
    }

    module brace_screw_mold() {
        cylinder(d=3, h=1000, center=true, $fn=60);
        translate([0,0,-500- beam_size/2-brace_wall_thickness]) cylinder(d=6, h=1000, center=true, $fn=60);
        translate([0,0,500- beam_size/2]) cylinder(d=7, h=1000, center=true, $fn=60);
    }

    module clamp_hole() {
        cylinder(r=rotor_r, h=clamp_h+1, center=true);
    }

    module screw_mold(length=8, head_length=100) {
        cylinder(d=3, h=length+head_length*2, center=true, $fn=60);
        translate([0,0,head_length/2+length/2]) cylinder(d=6.2, h=head_length, center=true, $fn=6);
        translate([0,0,-head_length/2-length/2]) cylinder(d=6, h=head_length, center=true, $fn=60);
    }

    module clamp_screws_mold() {
        module clamp_screw_mold() {
            rotate([0,90,0]) translate([0,0,-3]) screw_mold(16);
        }
        screw_offset_y = rotor_r + clamp_thickness+5;
        screw_offset_z = 6;
        translate([0,screw_offset_y,screw_offset_z]) clamp_screw_mold();
        translate([0,screw_offset_y,-screw_offset_z]) clamp_screw_mold();
        translate([0,-screw_offset_y,screw_offset_z]) clamp_screw_mold();
        translate([0,-screw_offset_y,-screw_offset_z]) clamp_screw_mold();
    }
    module clamp() {
        difference() {
            union() {
                cylinder(r=rotor_r+clamp_thickness, h=clamp_h, center=true);
                cube([16,(rotor_r + clamp_thickness+10)*2,clamp_h],true);
            }
            clamp_hole();
            //clamp_screws_mold();
        }
    }

    module extruder_holder_arms() {
        base_x_offset = (offset_y + (long_beam_distance + short_beam_offset*2*sqrt(3))*sqrt(3)/3)/sqrt(3);
        module arms() {
            difference() {
                union() {
                    translate([base_x_offset,0,0]) rotate([0,0,-120]) brace(60);
                    arm_w = 10;
                    translate([0,clamp_h/2,0]) rotate([90,0,0]) linear_extrude(height=clamp_h) {
                        polygon([[base_x_offset+arm_w, -arm_w],
                            [+arm_w+10, -arm_w-height-5],
                            [-arm_w+10, +arm_w-height-5],
                            [base_x_offset-arm_w, +arm_w]]);
                    };
                    translate([0,0,-height+20]) cube([60,clamp_h,20],true);
                    translate([0,0,-height+30]) cube([16,clamp_h,30],true);
                }
                translate([base_x_offset,0,0]) rotate([0,0,-120]) brace_negative();
                translate([0,0,-height]) rotate([90,0,0]) clamp_hole();
//                translate([0,0,-height]) rotate([90,0,0]) clamp_screws_mold();
                translate([0,-500-clamp_h/2,0]) cube([1000,1000,1000],true);

                translate([base_x_offset,0,0]) rotate([0,0,-120]) {
                    translate([-5,0,0]) brace_screw_mold();
                    translate([10,0,0]) rotate([-90,0,0]) brace_screw_mold();
                    translate([-20,0,0]) rotate([-90,0,0]) brace_screw_mold();
                }

                translate([120,0,-20]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([110,0,-20]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([120,0,-30]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([110,0,-30]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([100,0,-30]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([110,0,-40]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([100,0,-40]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([100,0,-50]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([90,0,-50]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([90,0,-60]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([80,0,-60]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([80,0,-70]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([70,0,-70]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([70,0,-80]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([60,0,-80]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([70,0,-90]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([60,0,-90]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([60,0,-100]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([50,0,-100]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([50,0,-110]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([40,0,-110]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([40,0,-120]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
                translate([40,0,-130]) rotate([90,0,0]) cylinder(d=3,h=1000,center=true);
            }
        }
        translate([0,offset_y,0]) {
            difference() {
                union() {
                    translate([0,0,-height]) rotate([90,90,0]) clamp();
                    arms();
                    mirror([1,0,0]) arms();
                }
                translate([0,0,-height]) rotate([90,90,0]) clamp_screws_mold();
                translate([0,6,-height+37]) rotate([0,90,0]) screw_mold(10,10);
                translate([0,-6,-height+37]) rotate([0,90,0]) screw_mold(10,10);

            }
        }
    }

    if (part == "left") {
        intersection() {
            extruder_holder_arms();
            translate([500,0,500-height]) cube([1000,1000,1000],true);
        }
    } else if (part == "right") {
        intersection() {
            extruder_holder_arms();
            translate([-500,0,500-height]) cube([1000,1000,1000],true);
        }
    } else if (part == "bottom") {
        intersection() {
            extruder_holder_arms();
            translate([0,0,-500-height]) cube([1000,1000,1000],true);
        }
    } else {
        extruder_holder_arms();
    }
}

!translate([0,0,long_beam_length-beam_size/2]) extruder_holder("all");
translate([0,0,260+beam_size * 3 + 7]) color("red") cube([4,4,520],true);

error: pathspec 'kossel/kossel_extruder_top_mount.scad' did not match any file(s) known to git