how can i create a polygon that would encompass all this shapes? February 11, 2018 03:01PM |
Registered: 7 years ago Posts: 17 |
Re: how can i create a polygon that would encompass all this shapes? February 11, 2018 03:32PM |
Registered: 11 years ago Posts: 14,685 |
Re: how can i create a polygon that would encompass all this shapes? February 11, 2018 04:31PM |
Registered: 7 years ago Posts: 17 |
Re: how can i create a polygon that would encompass all this shapes? February 11, 2018 10:27PM |
Registered: 10 years ago Posts: 978 |
Re: how can i create a polygon that would encompass all this shapes? February 12, 2018 01:54AM |
Registered: 10 years ago Posts: 590 |
Re: how can i create a polygon that would encompass all this shapes? February 12, 2018 02:00AM |
Registered: 7 years ago Posts: 17 |
Re: how can i create a polygon that would encompass all this shapes? February 12, 2018 08:09AM |
Registered: 10 years ago Posts: 590 |
Re: how can i create a polygon that would encompass all this shapes? February 13, 2018 03:01AM |
Registered: 7 years ago Posts: 17 |
Re: how can i create a polygon that would encompass all this shapes? February 13, 2018 10:47AM |
Registered: 7 years ago Posts: 17 |
Quote
enif
Quote
emaayan
it certainly does , now if i could just offset, but i'm guessing i'm gonna have to re-do the function that creates the cells, to use circles and not cylinders so the hull would be 2d..
You could also use projection() to project the hull into a 2D-polygon.
Re: how can i create a polygon that would encompass all this shapes? February 13, 2018 01:36PM |
Registered: 10 years ago Posts: 590 |
Re: how can i create a polygon that would encompass all this shapes? February 13, 2018 02:14PM |
Registered: 7 years ago Posts: 17 |
Re: how can i create a polygon that would encompass all this shapes? February 14, 2018 05:51AM |
Registered: 10 years ago Posts: 590 |
// cell configuration n=-1; p=1; simpleOne=[ [p,n,p] ,[p,n,p] ,[p,n,n] ,[p,n] ,[p,n] ,[p] ]; module batterycase(cells,dia=18,len=65,wall=10,wallz=4){ // cell position of cells[r][c] function cellpos(r,c)=[(2*$row+($col%2)),2*cos30*$col,0]; // Local module to iterate through all cells // Variables $row, $col are global, so they can be used in all children module drawHoles(){ for($row=[0:len(cells)-1]) for($col=[0:len(cells[$row])-1]) translate(radius*cellpos($row,$col)) children(); } // Local module to draw a + or - module pole(s) {for(a=[0: (s>0?90:180):359])rotate(a)translate([0,-1,0])cube([4,2,1]);} cos30 = cos(30); radius=dia/2+0.5; difference(){ // outer shell union()drawHoles() cylinder(r=dia/2+wall,h=len+2*wallz,$fn=6); // inner cavity union() translate([0,0,2*wallz])drawHoles() rotate(30)cylinder(r=dia/2/cos30+1,h=len-2*wallz,$fn=6); // individual cell cylinders drawHoles(){ // cell cavity translate([0,0,-0.1]) cylinder(r=dia/2,h=len+2*wall+0.2); // show polarity on top and bottom %translate([0,0,2*wallz+len-1])pole(cells[$row][$col]); %translate([0,0,-1])pole(-cells[$row][$col]); // ... and whatever else is needed } } } batterycase(simpleOne);
Re: how can i create a polygon that would encompass all this shapes? February 14, 2018 08:37AM |
Registered: 7 years ago Posts: 17 |