Mold up fix for US Box
This commit is contained in:
		
							parent
							
								
									0149de63e0
								
							
						
					
					
						commit
						51a60d4018
					
				| @ -145,6 +145,61 @@ | ||||
|             "tab_height": "13", | ||||
|             "thick": "9.1999999999999993", | ||||
|             "thick_cut": "1" | ||||
|         }, | ||||
|         "New set 4": { | ||||
|             "$fn": "64", | ||||
|             "base_extra_thickness": "20", | ||||
|             "base_tickness": "8", | ||||
|             "box_thickness": "9.5999999999999996", | ||||
|             "build_box": "false", | ||||
|             "build_fin": "false", | ||||
|             "build_mold": "true", | ||||
|             "draw_profile": "false", | ||||
|             "fin_back_angle": "20", | ||||
|             "fin_back_height": "30", | ||||
|             "fin_back_strength": "30", | ||||
|             "fin_back_widthdraw": "20", | ||||
|             "fin_base": "130", | ||||
|             "fin_counter_angle": "30", | ||||
|             "fin_counter_strength": "10", | ||||
|             "fin_edge_angle": "30", | ||||
|             "fin_edge_strength": "30", | ||||
|             "fin_edge_withdraw": "20", | ||||
|             "fin_end_angle": "110", | ||||
|             "fin_end_strength": "30", | ||||
|             "fin_height": "254", | ||||
|             "fin_start_angle": "70", | ||||
|             "fin_sweep": "25", | ||||
|             "fin_thickness": "9", | ||||
|             "fin_top_withdraw": "35", | ||||
|             "fin_width": "270", | ||||
|             "fin_width_tip": "5", | ||||
|             "height": "25", | ||||
|             "merge_holes_diameter": "6", | ||||
|             "mirror_vec": "[1, 1, 0]", | ||||
|             "mold_base_height": "10", | ||||
|             "mold_extra_width": "15", | ||||
|             "mold_part": "bottom", | ||||
|             "mold_piston_height": "10", | ||||
|             "mold_top_height": "5", | ||||
|             "partition": "none", | ||||
|             "parts": "all", | ||||
|             "pin_back": "9", | ||||
|             "pin_depth": "16.399999999999999", | ||||
|             "pin_dia": "3", | ||||
|             "piston_depth": "5", | ||||
|             "printable": "false", | ||||
|             "resin_escape_diameter": "4", | ||||
|             "scale_factor": "1", | ||||
|             "screw_dia": "4.5", | ||||
|             "screw_pos": "9.5999999999999996", | ||||
|             "show_curve_points": "false", | ||||
|             "show_debug_layers": "false", | ||||
|             "skirt_angle": "80", | ||||
|             "start": "[0, 0]", | ||||
|             "tab_height": "13", | ||||
|             "thick": "9.1999999999999993", | ||||
|             "thick_cut": "1" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -154,6 +154,7 @@ draw_profile = false; | ||||
| build_fin       = false; | ||||
| build_box       = false; | ||||
| build_mold     = true; | ||||
| partition       = "none";    // [none, low, high] | ||||
| 
 | ||||
| parts           = "all";      // [all, top, bottom] | ||||
| 
 | ||||
| @ -284,7 +285,21 @@ if ( build_box ) { | ||||
| /** | ||||
|  * Render Mold | ||||
|  */ | ||||
| if ( build_mold )              buildMold();     | ||||
| if ( build_mold )              //buildMold();     | ||||
| { | ||||
| 
 | ||||
|     difference(){ | ||||
|         buildMold(); | ||||
|         //cube([100,200,30]); | ||||
|         if (partition=="low") | ||||
|              partitionMask(false); | ||||
|         if (partition=="high") | ||||
|              partitionMask(true); | ||||
|               | ||||
|     }                 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| module buildCompletFin() { | ||||
| @ -296,59 +311,23 @@ module buildCompletFin() { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| module buildBox() { | ||||
|     /* | ||||
|     left(80) { | ||||
|         xflip() {      | ||||
|             finfit(fin_base+20, [1,1,0],false,false); | ||||
|         }         | ||||
|      | ||||
|         //up(20) tab_cut(); | ||||
|     } | ||||
|     */ | ||||
|          | ||||
| } | ||||
| module buildBoxMold() { | ||||
| 
 | ||||
|     // To be defined | ||||
| } | ||||
| 
 | ||||
| module baseMask() { | ||||
|     fwd(OFFSET) cube([fin_base*1.1,base_extra_thickness*1.1,fin_thickness*1.1],anchor=BACK); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| module usBoxMask() { | ||||
|     left(80) color("Blue") usBox(fin_base+30,thickness = box_thickness+2*OFFSET,drill=false); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
| module bottomSupport() { | ||||
|     moldHeight = 10; | ||||
|     moldContour =  expandPath(profile,mold_extra_width); | ||||
|     down(moldHeight)  | ||||
|         linear_extrude (moldHeight) polygon(moldContour);  // bottom support | ||||
| } | ||||
| */ | ||||
| 
 | ||||
| module support( part ) { | ||||
|     moldHeight = 10; | ||||
|     moldContour =  expandPath(profile,mold_extra_width); | ||||
|     down( (part == "bottom" ? 1 : 0) * moldHeight)  | ||||
|         linear_extrude (moldHeight) polygon(moldContour);  // bottom support | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Build mold | ||||
|  *  | ||||
|  */ | ||||
| module buildMold() { | ||||
|     // Bottom Mold | ||||
|     if (mold_part != "top") { | ||||
|     if (mold_part != "top") right( printable ? 120 : 0 ) { | ||||
|         // Fin mold | ||||
|         difference() { | ||||
|             support(part="bottom"); | ||||
| @ -365,7 +344,7 @@ module buildMold() { | ||||
|         moldSkirt( part="bottom" ); | ||||
|     } | ||||
|     // Top | ||||
|     if (mold_part != "bottom") xrot(printable ? 180 : 0 ) back( printable ? 60 : 0 )  { | ||||
|     if (mold_part != "bottom") /*up(1* 150)*/ left( printable ? 120 : 0 ) yrot(printable ? 180 : 0 )   { | ||||
|         difference(){ | ||||
|             support(part="top"); | ||||
|             usBoxMask(); | ||||
| @ -376,41 +355,28 @@ module buildMold() { | ||||
|         difference() { | ||||
|             left(80)  finBoxMold( fin_base+30,part="top",skirt=false ); | ||||
|             // Remove fin | ||||
|             //buildCompletFin();  | ||||
|             buildCompletFin();  | ||||
|         } | ||||
|         // Mold skirt | ||||
|         down( fin_thickness * 3 ) moldSkirt( part="top" );     | ||||
|     } | ||||
|       | ||||
|      | ||||
|      | ||||
|     //up(50) buildCompletFin(); | ||||
|      | ||||
|     //left(300) linear_extrude (skirtHeight) polygon(moldSkirtRegion); | ||||
|     /* | ||||
|     if (mold_part !=  "top")  | ||||
|         difference() {  | ||||
|             case(mold_base_height,true); | ||||
|             // Piston | ||||
|             down(piston_depth-OFFSET) fwd(20) bottomInsert();  | ||||
|         } | ||||
|     // Top Mold | ||||
|     if (mold_part !=  "bottom")  | ||||
|         up(printable ? 0 : 60) fwd(printable ? fin_height+50 : 0) down(mold_base_height) mirror([0,0,printable ? 1 : 0 ])  { | ||||
|             difference() { | ||||
|                 union() { | ||||
|                     // case | ||||
|                     case(mold_top_height,false);  | ||||
|                     // Piston | ||||
|                     mirror([1,0,0])         | ||||
|                     down(mold_top_height+piston_depth-OFFSET) fwd(20) topPiston();  | ||||
|                 }; | ||||
|                 resin_escape(40); | ||||
|             } | ||||
|         }       | ||||
|     */     | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| module support( part ) { | ||||
|     moldHeight = 10; | ||||
|     moldContour =  expandPath(profile,mold_extra_width); | ||||
|     if (part == "bottom") { | ||||
|         down( moldHeight )  | ||||
|             linear_extrude (moldHeight) polygon(moldContour);  // bottom support | ||||
|     } else if (part == "top") { | ||||
|         //linear_extrude (moldHeight) polygon(moldContour);  // top support | ||||
|         linear_extrude (moldHeight) polygon(profile);  // top support | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Build the piston skirt  | ||||
|  *  | ||||
| @ -424,6 +390,9 @@ module moldSkirt( part ){ | ||||
|      | ||||
|     //if (part == "bottom") { | ||||
| 
 | ||||
|     moldHeight = fin_thickness * 3; | ||||
|      | ||||
|     up (part=="top" ? moldHeight : 0 ) | ||||
|     skirt( finAndBoxProfile, side = part ,moldThickness = 3 , angle = skirt_angle, moldDeep = fin_thickness ); | ||||
|     //} else if (part == "top") { | ||||
|          | ||||
| @ -540,6 +509,23 @@ module resin_escape(length) { | ||||
| function addBase(path) = concat(path,[[fin_base,-base_extra_thickness],[0,-base_extra_thickness]]); | ||||
| 
 | ||||
| 
 | ||||
| module partitionMask(inverse = false) { | ||||
|     up(10) | ||||
|     partition_mask( | ||||
|                     w=fin_height/2*1.5,  | ||||
|                     h=60,           // height | ||||
|                     l=fin_width*3,  | ||||
|                     cutpath="comb", | ||||
|                     spread=3, | ||||
|                     inverse=inverse, | ||||
|                     anchor=FRONT | ||||
|     ); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Draws a profile based on Bezier path points with optional debug visualization. | ||||
|  *  | ||||
|  | ||||
| @ -17,10 +17,6 @@ OFFSET=0.01; | ||||
|  **/ | ||||
| module boxProfileUS( length ,height=23, tabHeight = 8,tabLength = 20, backRounding = 8, backExtra = 10 ) { | ||||
| 
 | ||||
| 
 | ||||
|     echo ("------ height",height); | ||||
|     echo ("------ tabHeight",tabHeight); | ||||
|     echo ("------ height-tabHeight",height-tabHeight);     | ||||
|     assert (height-tabHeight,"height-tabHeight should be bigger than 0"); | ||||
|     | ||||
|     tabExtra = opp_ang_to_adj(height-tabHeight,45); | ||||
| @ -69,9 +65,9 @@ module usBoxMold( length, height=23, thickness = 9, moldThickness = 4,tabLength | ||||
|     assert (length >0,"length should be bigger than 0"); | ||||
| 
 | ||||
|     moldHeight = thickness + 2 * moldThickness; | ||||
|      | ||||
|      | ||||
|     skirtHeight = 3 * thickness; | ||||
|     echo ("---skirtHeight",skirtHeight); | ||||
|     echo ("---part",part); | ||||
|     deviation = opp_ang_to_adj (skirtHeight,skirtAngle);    // Skirt devitation | ||||
|      | ||||
|     baseInt = profileUS (length); | ||||
| @ -79,45 +75,15 @@ module usBoxMold( length, height=23, thickness = 9, moldThickness = 4,tabLength | ||||
|     topInt  = offset(baseInt,delta=deviation                , chamfer=false, same_length=true );     | ||||
|     topExt  = offset(baseInt,delta=deviation+moldThickness  , chamfer=false, same_length=true ); | ||||
|      | ||||
|     if ( part == "bottom") { | ||||
|         union() { | ||||
|             difference() { | ||||
|                 // Mold | ||||
|             { | ||||
|                 //if ( part == "bottom") | ||||
|                      | ||||
|                     down (moldHeight/2) linear_extrude(moldHeight)     | ||||
|                         offset(r=moldThickness)  | ||||
|                 down (moldHeight/2)  | ||||
|                     linear_extrude(moldHeight)     | ||||
|                         offset(r= (part=="top" ? 0 :  moldThickness))  | ||||
|                             boxProfileUS( length, height ); | ||||
|                  | ||||
|                 /*                         | ||||
|                 if ( part == "top") | ||||
|                      | ||||
|                     down (moldHeight/2) linear_extrude(moldHeight)     | ||||
|                         offset(r=moldThickness)  | ||||
|                             boxProfileUS( length, height );                 | ||||
|                  */            | ||||
|                 if ( part == "top__"  ) { | ||||
|                     //baseInt = profileUS (length); | ||||
|                     //baseInt = profileUS (length); | ||||
|                     //topInt  = offset(baseInt,delta=-deviation,chamfer=false,same_length=true); | ||||
|                     baseInt2  = offset(baseInt,delta=-moldThickness,chamfer=false,same_length=true); | ||||
|                     topInt2  = offset(baseInt,delta=deviation-moldThickness,chamfer=false,same_length=true); | ||||
|                      | ||||
|                     difference(){ | ||||
|                         skin([baseInt   , topInt    ],z=[0,skirtHeight],slices=0); | ||||
|                         skin([baseInt2  , topInt2   ],z=[thickness/2+moldThickness,skirtHeight+OFFSET],slices=0); | ||||
|                     } | ||||
|                      | ||||
|                     /*     | ||||
|                     down (moldHeight/2) linear_extrude(moldHeight)     | ||||
|                         offset(r=moldThickness)  | ||||
|                             boxProfileUS( length, height );                             | ||||
|                     */         | ||||
|                 }                     | ||||
|             }         | ||||
|              | ||||
|              | ||||
|             // US Box to subtract | ||||
|                 usBox(length,height,drill=false,color="Red"); | ||||
| 
 | ||||
|                 // Mask Top   | ||||
| @ -125,30 +91,50 @@ module usBoxMold( length, height=23, thickness = 9, moldThickness = 4,tabLength | ||||
|                     part == "bottom" ? 0 :  | ||||
|                     part == "top"    ? moldHeight :  | ||||
|                     100;         | ||||
|                 debug = false    ; | ||||
|                      | ||||
|                 if (!debug)  | ||||
|                     down( verticalMask ) | ||||
|                     linear_extrude( moldHeight )     | ||||
|                         offset( r = moldThickness*2 )  | ||||
|                             boxProfileUS( length, height );                     | ||||
|                              | ||||
|             } | ||||
|          | ||||
|         if ( part == "bottom"  ) { | ||||
|             //topInt  = offset(baseInt,delta=deviation,chamfer=false,same_length=true); | ||||
|             if (skirt) difference(){ | ||||
|                 skin([baseExt,topExt],z=[0,skirtHeight],slices=0); | ||||
|                 skin([baseInt,topInt],z=[0,skirtHeight+OFFSET],slices=0); | ||||
|             } | ||||
|         }   | ||||
|     }    | ||||
|     | ||||
|     if ( part == "top") {  | ||||
|         difference() { | ||||
|             // Top Mold | ||||
|             linear_extrude(  thickness/2+OFFSET+moldThickness /*moldHeight/2*/ )     | ||||
|                 offset(r=-OFFSET) | ||||
|                     boxProfileUS( length, height ); | ||||
|             // Box to subtract             | ||||
|             usBox(length,height,drill=false,color="Red"); | ||||
|              | ||||
|         }                     | ||||
|     } | ||||
|      | ||||
| } | ||||
| 
 | ||||
| //usBoxMold (130,part="bottom",skirt=false); | ||||
| if ( false ) { | ||||
|     // Bottom | ||||
|    down(0) back(0) usBoxMold( 130 ,part="bottom"  ,skirt=false ); | ||||
|    // Top | ||||
|    down(-50) back(0) usBoxMold( 130  ,part="top"     ,skirt=false ); | ||||
| 
 | ||||
|    down(50) back(0) usBoxMold( 130  ,part="bottom"     ,skirt=true ); | ||||
|     | ||||
|     | ||||
|    //down(0) back(0) usBox(130,height=23,drill=false,color="Green"); | ||||
| }   | ||||
| 
 | ||||
| 
 | ||||
| //back (30) usBoxMold (130,part="top",skirt=false); | ||||
| 
 | ||||
| 
 | ||||
| module finBoxMold( length, finLength=-1, skirtAngle = 80, part="bottom", skirt = true) { | ||||
| @ -160,14 +146,6 @@ module finBoxMold( length, finLength=-1, skirtAngle = 80, part="bottom", skirt = | ||||
|      | ||||
| } | ||||
| 
 | ||||
| //test = profileUS (100); | ||||
| //test2 = offset(test,30); | ||||
| //region1 =  | ||||
| //region([test,test2]); | ||||
| //polygon(region1); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| module thickness_cut(thickness,height) { | ||||
|     color("Orange") | ||||
|     linear_extrude(thickness)  | ||||
| @ -180,14 +158,13 @@ module thickness_cut(thickness,height) { | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //usBoxMold (130,part="bottom",skirt=false); | ||||
| 
 | ||||
| //boxProfileUS( length= 188); | ||||
| //back (30) usBoxMold (130,part="top",skirt=false); | ||||
| 
 | ||||
| //usBox( 130,drill=false ); | ||||
| //usBoxMold( 130,part="top" ); | ||||
| //down(0) back(0) usBox(130,height=23,drill=false,color="Green"); | ||||
| 
 | ||||
| 
 | ||||
|   | ||||
| if (false )down(50) usBoxMold( 130,part="bottom",skirt=false ); | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user