Aqui se encontra informação adicional para submissão do projecto IPL-2016/2017
A impressora que aqui se mostra foi construída tendo como base dois dos mais importantes modelos disponíveis para a construção de impressoras 3D, nomeadamente, a Prusa i3 e a Mendel90.


Módulo inicial de uma biblioteca para a construção de estruturas matemáticas numa impressora 3D. Exemplos e concretizações podem ser vistos aqui: https://www.youmagine.com/tca/designs
function a2stl(filename,x,y,z,h) h=h/2; fid=fopen(filename,'w'); title_str=sprintf('%s',datestr(now), ": GPLv3 - tca@diale.org"); fprintf(fid,'solid %s\r\n',title_str); zmin=min(min(z)); z=z-zmin+h/2; nx=size(z,1); ny=size(z,2); for i=1:nx-1 for j=1:ny-1 p1=[x(i,j) y(i,j) z(i,j)]; p2=[x(i,j+1) y(i,j+1) z(i,j+1)]; p3=[x(i+1,j+1) y(i+1,j+1) z(i+1,j+1)]; u=normal(p1,p2,p3); ## Build the upper shell p1=p1-h*u; xu(i,j)=p1(1); yu(i,j)=p1(2); zu(i,j)=p1(3); ## Build the lower shell p1=p1+3*h*u; xl(i,j)=p1(1); yl(i,j)=p1(2); zl(i,j)=p1(3); ## q1=[x(i+1,j+1) y(i+1,j+1) z(i+1,j+1)]; ## q2=[x(i+1,j) y(i+1,j) z(i+1,j)]; ## q3=[x(i,j) y(i,j) z(i,j)]; end end for i=1:nx-2 for j=1:ny-2 ## Write the upper shell pu3=[xu(i,j) yu(i,j) zu(i,j)]; pu2=[xu(i,j+1) yu(i,j+1) zu(i,j+1)]; pu1=[xu(i+1,j+1) yu(i+1,j+1) zu(i+1,j+1)]; writefacet(fid,pu1,pu2,pu3); qu3=[xu(i+1,j+1) yu(i+1,j+1) zu(i+1,j+1)]; qu2=[xu(i+1,j) yu(i+1,j) zu(i+1,j)]; qu1=[xu(i,j) yu(i,j) zu(i,j)]; writefacet(fid,qu1,qu2,qu3); ## Write the lower shell pl1=[xl(i,j) yl(i,j) zl(i,j)]; pl2=[xl(i,j+1) yl(i,j+1) zl(i,j+1)]; pl3=[xl(i+1,j+1) yl(i+1,j+1) zl(i+1,j+1)]; writefacet(fid,pl1,pl2,pl3); ql1=[xl(i+1,j+1) yl(i+1,j+1) zl(i+1,j+1)]; ql2=[xl(i+1,j) yl(i+1,j) zl(i+1,j)]; ql3=[xl(i,j) yl(i,j) zl(i,j)]; writefacet(fid,ql1,ql2,ql3); end end ## Glue all the borders for i=1:nx-2 p1=[xu(i,ny-1) yu(i,ny-1) zu(i,ny-1)]; p2=[xl(i,ny-1) yl(i,ny-1) zl(i,ny-1)]; p3=[xu(i+1,ny-1) yu(i+1,ny-1) zu(i+1,ny-1)]; writefacet(fid,p3,p2,p1); p1=[xu(i+1,ny-1) yu(i+1,ny-1) zu(i+1,ny-1)]; p2=[xl(i+1,ny-1) yl(i+1,ny-1) zl(i+1,ny-1)]; p3=[xl(i,ny-1) yl(i,ny-1) zl(i,ny-1)]; writefacet(fid,p1,p2,p3); p1=[xu(i,1) yu(i,1) zu(i,1)]; p2=[xl(i,1) yl(i,1) zl(i,1)]; p3=[xu(i+1,1) yu(i+1,1) zu(i+1,1)]; writefacet(fid,p1,p2,p3); p1=[xu(i+1,1) yu(i+1,1) zu(i+1,1)]; p2=[xl(i+1,1) yl(i+1,1) zl(i+1,1)]; p3=[xl(i,1) yl(i,1) zl(i,1)]; writefacet(fid,p3,p2,p1); end for i=1:ny-2 p1=[xu(nx-1,i) yu(nx-1,i) zu(nx-1,i)]; p2=[xl(nx-1,i) yl(nx-1,i) zl(nx-1,i)]; p3=[xu(nx-1,i+1) yu(nx-1,i+1) zu(nx-1,i+1)]; writefacet(fid,p1,p2,p3); p1=[xu(nx-1,i+1) yu(nx-1,i+1) zu(nx-1,i+1)]; p2=[xl(nx-1,i+1) yl(nx-1,i+1) zl(nx-1,i+1)]; p3=[xl(nx-1,i) yl(nx-1,i) zl(nx-1,i)]; writefacet(fid,p3,p2,p1); p1=[xu(1,i) yu(1,i) zu(1,i)]; p2=[xl(1,i) yl(1,i) zl(1,i)]; p3=[xu(1,i+1) yu(1,i+1) zu(1,i+1)]; writefacet(fid,p3,p2,p1); p1=[xu(1,i+1) yu(1,i+1) zu(1,i+1)]; p2=[xl(1,i+1) yl(1,i+1) zl(1,i+1)]; p3=[xl(1,i) yl(1,i) zl(1,i)]; writefacet(fid,p1,p2,p3); end fprintf(fid,'endsolid'); fclose(fid); end function writefacet(fid,p1,p2,p3) n=normal(p1,p2,p3); fprintf(fid,'facet normal %.7E %.7E %.7E\r\n',n(1),n(2),n(3)); fprintf(fid,'outer loop\r\n'); fprintf(fid,'vertex %.7E %.7E %.7E\r\n',p1); fprintf(fid,'vertex %.7E %.7E %.7E\r\n',p2); fprintf(fid,'vertex %.7E %.7E %.7E\r\n',p3); fprintf(fid,'endloop\r\n'); fprintf(fid,'endfacet\r\n'); end function retval=normal(p1,p2,p3) v1=p2-p1; v2=p3-p1; v3=cross(v1,v2); retval=v3./(eps+sqrt(sumsq(v3))); if retval==0 retval=[0 0 1]; end end
Pedaços de gcode para o funcionamento da impressora:
G21 ;metric values G90 ;absolute positioning M82 ;set extruder to absolute mode M107 ;start with the fan off G28 X0 Y0 ;move X/Y to min endstops G28 Z0 ;move Z to min endstops G1 Z15.0 F{travel_speed} ;move the platform down 15mm G92 E0 ;zero the extruded length G1 F200 E20 ;extrude 20mm of feed stock G92 E0 ;zero the extruded length again G1 F{travel_speed} ;Put printing message on LCD screen M117 Printing... ;-- START GCODE --
depois o código e finalmente acaba com
;-- END GCODE -- M104 S0 ;extruder heater off M140 S0 ;bed heater off G91 ;relative positioning G1 E-3 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure G1 Z+80 F{travel_speed} ;move Z up G90 ;absolute positioning G1 X0 Y180 F{travel_speed} ;move Z up a bit and retract filament even more the way M84 ;steppers off ;Some sound to celebrate the end of this printing ;) ;Greenwich Time Signal M300 S1000 P100 M300 S0 P900 M300 S1000 P100 M300 S0 P900 M300 S1000 P100 M300 S0 P900 M300 S1000 P100 M300 S0 P900 M300 S1000 P100 M300 S0 P900 M300 S1000 P500 ;-- end of END GCODE --
Created: 29-10-2016 [16:08]
Last updated: 16-02-2026 [16:02]
For attribution, please cite this page as:
Charters, T., "Mat3D - Impressão 3D para visualização matemática": https://nexp.pt/3dphack.html (16-02-2026 [16:02])
(cc-by-sa) Tiago Charters - tiagocharters@nexp.pt