RUG/Pennsylvania/State College/Vertex Param

From RepRap
Jump to: navigation, search

Back to State College RepRap Main

How to Parametrize Mendel vertices to vary machine height... I think

It's time for a new project, and therefore a new project blog. The goal of this undertaking is to develop an OpenSCAD script that allows the user to vary the angles incorporated into the design of the base vertices for our printers. But what's the purpose? By making the angles larger, it will allow us to increase the printable height of the machines, offering yet another greater degree of freedom in our design. I'm hoping to start with existing code, but I may just steal parts from that or even write my own if it turns out to be easier.

Progress Blog

3.22.12

Project inception: Eric and Dave gave me the idea, and I decided to run with it.

Found this, it's a basic vertex written in SCAD, but seems like a bit of a pain to deal with. I think I'll just pull some of it's dimensions for reference, but just start with my own fresh code instead.

I was able to model the basic ends, but decided on an even better basic design. Rather than using the basic block-style structure, a swept arc could be used to create the basic structure. Not only is this easier to get stared with the coding, the parametrization will be much simpler and more fluid. I may try both designs and then just see which one looks/performs better. Anyways, that's all in the future. Here's what I got done today with the OpenSCAD code. Enjoy!

//Parametrization of Vertices
//Kevin Trippel

m8 = 9.9;
m8wide = m8 + 3;
heights = 13.9;



//Create basic shape for ends
difference(){
linear_extrude (height = heights) polygon(points = [[9,0],[0,9],[0,21],[9,30],[29,30],[29,0]], paths = [[0,1,2,3,4,5]]);

linear_extrude (height = heights) polygon(points = [[9,2],[2,9],[2,21],[9,28],[29,28],[29,2]], paths = [[0,1,2,3,4,5]]);
rotate([90,0,0]) translate ([20,heights/2,-30]) cylinder(h = 350, r = m8/2, center = false);

}

//Begin Structural Components
//Horizontal Cross-member

difference(){
translate ([0,13.5,0]) cube(size = [29,3,heights], center = false);
rotate([90,0,0]) translate ([20,heights/2,-29.5]) cylinder(h = 30, r = m8wide/2, center = false);
translate([7,15,0]) cylinder(h = heights, r = m8/2, center = false);

}

//Bottom

difference(){
linear_extrude (height = 2) polygon(points = [[9,0],[0,9],[0,21],[9,30],[29,30],[29,0]], paths = [[0,1,2,3,4,5]]);
translate([7,15,0]) cylinder(h = heights, r = m8/2, center = false);

}
//Vertical Cylinder

difference(){
translate([7,15,0]) cylinder(h = heights, r = m8wide/2, center = false);
translate([7,15,0]) cylinder(h = heights, r = m8/2, center = false);
}

//Vertical Cylinder Gusset

difference(){
translate([0,9,0]) cube(size = [7,12,heights], center = false);
translate([7,15,0]) cylinder(h = heights, r = m8/2, center = false);
}

//Horizontal Cylinder

difference(){
rotate([90,0,0]) translate ([20,heights/2,-30]) cylinder(h = 30, r = m8wide/2, center = false);
rotate([90,0,0]) translate ([20,heights/2,-30]) cylinder(h = 30, r = m8/2, center = false);

}

//Horizontal Cylinder Gusset

difference(){
translate([20-(m8wide/2),0,0]) cube (size = [m8wide, 30, heights/2], center = false);
rotate([90,0,0]) translate ([20,heights/2,-30]) cylinder(h = 65, r = m8wide/2, center = true);
}

3.27.12

Parametrization: Now that I've got the basic form for the ends figured out,it's time to begin the fun part. I need to take the dimensions, and make them a function of an angle. Doing this will make the translation and rotation of the part easier, converting the starting polygon vertices into their rotated counterparts. This will involve what will turn into hundreds of trig functions, all dependent on one user-submitted angle (later, this will be dependent on the user submitted height, I'm just moving one step at a time here).

After much work, I've found an easier way to approach the translation and rotation to comply with the user submitted angle. Rahter than working with the original code (updated version above), I've decided to use the STLs generated from that code and import them. This will make translation, rotation, etc. much simpler and less complicated when involving trig functions.

The initial code still needs tweaks and more accurate relations to calculate the translations, but for now it seems to be a step in the right direction. Here's where things stand as of now, although I plan to continue work on it later today.

//Kevin Trippel
//Project Tall Cat
//Include endpiece.stl


//Set desired Mendel height (in mm) below:
h = 183.75;

theta = (-180) + atan(h/183.75);
theta2 = atan(h/183.75);
a = (90-((1/2)*(180-theta2)));

import_stl("endpiece.stl", convexity = 50);

translate([29 + 10*cos(a) + 29*cos(2*a), 30 + 10*sin(a) + 29*sin(2*a),0]) rotate ([0,0,theta]) import_stl("endpiece.stl", convexity = 50);

linear_extrude (height=2) polygon(points = [[30,0],[29,30],[29 + 10*cos(a), 30 + 10*sin(a)], [50,50]], paths = [0,1,2,3]);

3.29.12

After 3 days of working on the project, it seems that things are starting to get complicated. Modeling the end piece was easy, as was starting the basic code for the actual parametric program. Now comes the fun part of geometric and trigonometric relations. Yay!

After about 2 hours and lots of struggling, I'm almost there. I have the parameters set to rotate give a certain height, and it maintains the spacing between the vertical holes while also aligning the pieces to the correct angles. The task now is to get the supports supports to generate. I got the bottom connecting piece together, but the vertical pieces are proving difficult. The current code is showing an error in generating the polygon which I can't find. I may just try rewriting it from scratch to see if it can weed out the mistake on its own. Here's the updated code for the second file (the first code for the endpiece stl is still same as above).

//Kevin Trippel
//Project Tall Cat
//Include endpiece.stl


//Set desired Mendel height (in mm) below:
h = 275;

theta = atan(h/183.75);
a = (90-((1/2)*(180-theta)));
b = 40;
t = 80;
rt = 60+(33.106*cos(64.983+(theta/2)));

//Place and rotate left end piece
rotate ([0,0,theta/2]) import_stl("endpiece.stl", convexity = 50);

//Place and rotate right end piece
mirror ([1,0,0])translate([-rt, 0,0]) rotate ([0,0,theta/2]) import_stl("endpiece.stl", convexity = 50);


//Create support bottom
linear_extrude (height = 2) polygon(points = [[29*cos(theta/2),29*sin(theta/2)],[29*cos(theta/2)-(30*sin(theta/2)),(29*sin(theta/2))+(30*cos(theta/2))],[rt-(41.7253*cos(45.971+(theta/2))),29*sin(theta/2)+(30*cos(theta/2))],[rt-(29*cos(theta/2)),29*sin(theta/2)]], paths = [[0,1,2,3]]);
//Create suport braces (Top, middle, then bottom)

linear_extrude (height = 2) polygon(points = [[(29*cos(theta/2))-(30*sin(theta/2)),((29*sin(theta/2)))+(30*cos(theta/2))],[rt-(41.7253*cos(45.971+(theta/2))),(29*sin(theta/2))+(30*cos(theta/2))],[(rt-(41.7253*cos(45.971+(theta/2))))-(2*cos(90-theta/2)),(29*sin(theta/2))+(30*cos(theta/2))-(2*sin(90-(theta/2)))],[(29*cos(theta/2))-(30*sin(theta/2))+(2*sin(90-(theta/2))),(29*cos(theta/2))+(30*cos(theta/2))-(2*sin(90-(theta/2)))]]);


3.30.12

This morning in class I finally figured out how to get over the last hurdle. One skipped class and an hour later, it's done. That's right, the code works. You put in your desired height, and then it'll spit out the proper side vertex (top vertex with a simple change in code, improvement to that coming soon.)

I need to double check a few dimensions about the machines, but that's the easy part. Here's the final OpenSCAD code, Beta version 1.0. It'll be uploaded to thingiverse once we do a test print and verify that it at least kind of does what it's supposed to. Enjoy!


//Kevin Trippel
//Parametric Vertices
//Include endpiece.stl


//Set desired Mendel height (in mm) below:
h = 250;

//Define variables that are a function of h
theta = atan(h/183.75);
rt = 60+(33.106*cos(64.983+(theta/2)));
sint = sin(theta/2);
cost = cos(theta/2);

//Place and rotate left end piece
rotate ([0,0,theta/2]) import_stl("endpiece.stl", convexity = 50);

//Place and rotate right end piece
mirror ([1,0,0])translate([-rt, 0,0]) rotate ([0,0,theta/2]) import_stl("endpiece.stl", convexity = 50);


//Create support bottom 
linear_extrude (height = 2) polygon(points = [[29*cost,29*sint],[29*cost-(30*sint),(29*sint)+(30*cost)],[rt-(41.7253*cos(45.971+(theta/2))),29*sint+(30*cost)],[rt-(29*cost),29*sint]], paths = [[0,1,2,3]]); 


//Create suport braces (Top, middle, then bottom) 

//Top
linear_extrude (height = 13.9) polygon(points = [[29*cost-(30*sint),(29*sint)+(30*cost)],[rt-(41.7253*cos(45.971+(theta/2))),29*sint+(30*cost)],[rt-(41.7253*cos(45.971+(theta/2)))-(2*cos(90-(theta/2))),29*sint+(30*cost)-(2*sin(90-(theta/2)))],[29*cost-(30*sint)+(2*cos(90-(theta/2))),(29*sint)+(30*cost)-(2*sin(90-(theta/2)))]], paths = [[0,1,2,3]]); 

//Middle
linear_extrude (height = 13.9) polygon (points = [[29*cost-(30*sint)+(16.5*sin(theta/2)),(29*sint)+(30*cost)-(16.5*cos(theta/2))],[29*cost-(30*sint)+(13.5*sin(theta/2)),(29*sint)+(30*cost)-(13.5*cos(theta/2))],[rt-(41.7253*cos(45.971+(theta/2)))-(13.5*sin(theta/2)),29*sint+(30*cost)-(13.5*cos(theta/2))],[rt-(41.7253*cos(45.971+(theta/2)))-(16.5*sin(theta/2)),29*sint+(30*cost)-(16.5*cos(theta/2))]], paths = [[0,1,2,3]]);

//Bottom
linear_extrude (height = 13.9) polygon (points = [[29*cost,29*sint],[29*cost-(2*sin(theta/2)),29*sint+(2*cos(theta/2))],[rt-(29*cost)+(2*sin(theta/2)),29*sint+(2*cos(theta/2))],[rt-(29*cost),29*sint]], paths = [[0,1,2,3]]);