{"id":128,"date":"2018-03-19T18:09:32","date_gmt":"2018-03-19T18:09:32","guid":{"rendered":"http:\/\/www.vandelle.com\/blog\/3dprinting\/?p=128"},"modified":"2018-03-19T18:09:32","modified_gmt":"2018-03-19T18:09:32","slug":"modelize-your-first-3d-shape-with-openscad-correction","status":"publish","type":"post","link":"https:\/\/www.vandelle.com\/blog\/3dprinting\/2018\/03\/19\/modelize-your-first-3d-shape-with-openscad-correction\/","title":{"rendered":"Modelize your first 3D shape with openSCAD #Correction"},"content":{"rendered":"<h2><\/h2>\n<h2>9. Correction<\/h2>\n<h4>Correction Exercise 2:<\/h4>\n<pre>\/\/Exercise 2\n\n$fn = 100;\n\ntranslate([0,-20,0]) cube([20,20,2]);\n\ntranslate([0,-20,0]) rotate([0,-90,0]) cube([20,20,2]);<\/pre>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<h4>Correction Exercise 3:<\/h4>\n<pre>\/\/Exercise 3\n\n$fn = 100;\n\ndifference(){\n\ntranslate([0,-20,0]) cube([20,20,2]);\n\n#translate([10,-10,-5]) cylinder(10,2,2);\n\n}\n\ndifference(){\n\ntranslate([0,-20,0]) rotate([0,-90,0]) cube([20,20,2]);\n\n#translate([-5,-10,10]) rotate([0,90,0]) cylinder(10,2,2);\n\n}<\/pre>\n<p><strong>\u00a0<\/strong><\/p>\n<h4><strong>\u00a0Correction Final Exercises:<\/strong><\/h4>\n<pre>\/\/Final Exercise 1\n\nmodule Base(){\n\n\u00a0\u00a0\u00a0 difference(){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cube([20,20,2]);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([10,10,-5]) cylinder(10,2,2);\n\n\u00a0\u00a0\u00a0 }\n\n}\n\n\n\n\nunion(){\n\n\u00a0\u00a0\u00a0 translate([0,-20,0]) Base();\n\n\u00a0\u00a0\u00a0 translate([0,-20,0]) rotate([0,-90,0]) Base();\n\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre>\/\/Final Exercise 2\n\n$fn = 100;\n\n\/\/global variables\n\nhauteur = 3;\n\nrayon = 19;\n\n\n\n\nmodule ring(h,r){\n\n\u00a0\u00a0\u00a0 difference(){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cylinder(h,r+0.8,r+0.8);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([0,0,-1]) cylinder(hauteur+2,r*0.7,r*0.7);\n\n\u00a0\u00a0\u00a0 }\n\n}\n\n\n\n\nmodule Text(){\n\n\u00a0\u00a0\u00a0 linear_extrude(height=1) union() {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0 translate([-2,0,0])resize([4.7,27])rotate([0,0,90])offset(0.7) text(\"Great\",\"Arial:style=Bold\");\n\n\u00a0\u00a0\u00a0\u00a0\u00a0 translate([5,0,0])resize([4.7,27])rotate([0,0,90])offset(0.7) text(\"Tuto\",\"Arial:style=Bold\");\n\n\u00a0\u00a0\u00a0 }\n\n}\n\n\n\n\nmodule Base(){\n\n\u00a0\u00a0\u00a0 translate([1,-rayon+5,3]) Text()\n\n\u00a0\u00a0\u00a0 cylinder(hauteur,19,19);\n\n\u00a0\u00a0\u00a0 difference(){\u00a0\u00a0\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cylinder(hauteur,19,19); \/\/base cylinder\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/encrusted text zone\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 hull(){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0translate([-3,-9.5,2.1]) cylinder(1,6,6);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([-3,9.5,2.1]) cylinder(1,6,6);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([4,9.5,2.1]) cylinder(1,6,6);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([4,-9.5,2.1]) cylinder(1,6,6);\n\n\u00a0\u00a0\u00a0 }\n\n\u00a0 }\n\n}\n\n\n\n\/\/module calls\n\nunion(){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([rayon,rayon,0]) Base();\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([-rayon*0.13,rayon,0]) ring(3,4);\n\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>9. Correction Correction Exercise 2: \/\/Exercise 2 $fn = 100; translate([0,-20,0]) cube([20,20,2]); translate([0,-20,0]) rotate([0,-90,0]) cube([20,20,2]); \u00a0 \u00a0 Correction Exercise 3: \/\/Exercise 3 $fn = 100; difference(){ translate([0,-20,0]) cube([20,20,2]); #translate([10,-10,-5]) cylinder(10,2,2); } difference(){ translate([0,-20,0]) rotate([0,-90,0]) cube([20,20,2]); #translate([-5,-10,10]) rotate([0,90,0]) cylinder(10,2,2); } \u00a0 \u00a0Correction Final Exercises: \/\/Final Exercise 1 module Base(){ \u00a0\u00a0\u00a0 difference(){ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cube([20,20,2]); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 translate([10,10,-5]) cylinder(10,2,2); [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":0,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vandelle.com\/blog\/3dprinting\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}