A taste of MeshRegions

Christopher Hanusa (chanusa@qc.cuny.edu)
10 October 2017

Let’s make a name plate

Text[Style["Ultimaker",Bold,FontFamily->"Calibri",FontSize->50]]

mesh2d=DiscretizeGraphics[Text[Style["Ultimaker",Bold,FontFamily->"Calibri",FontSize->50]],_Text]

VERY IMPORTANT: Use decimals instead of integers!!!

RegionProduct[mesh2d,Line[{{0.},{10.}}]]

polygonmesh=DiscretizeGraphics[Graphics[{RegularPolygon[6]}]]

Show[{RegionResize[polygonmesh,1.3],RegionResize[mesh2d,1]}]

newpolygon=RegionResize[polygonmesh,1.3];
newtext=RegionResize[mesh2d,1];
shadow=RegionDifference[newpolygon,newtext]

bdrypolygon=RegionBoundary[newpolygon]
bdrytext=RegionBoundary[newtext]

Show[{
RegionProduct[newpolygon,Point[{{0.}}]],
RegionProduct[bdrypolygon,Line[{{0.},{1.}}]],
RegionProduct[shadow,Point[{{1.}}]],
RegionProduct[bdrytext,Line[{{1.},{2.}}]],
RegionProduct[newtext,Point[{{2.}}]]

},PlotRange->All]

Doing the same with an image

http://clipart-library.com/clipart/rTLxeRAzc.htm

flower=;

ImageMesh[flower]

ColorNegate[]

flowermesh=ImageMesh[ColorNegate[]]

RegionResize[flowermesh,{{-1,1},{-1,1}}]

RegionBounds[flowermesh]

ratio=(425.3535533905933`+0.2727272727272701`)/(379.01735065500304`+0.01735065500306008`)

scaledflower=RegionResize[flowermesh,{{-ratio,ratio},{-1,1}}]

background=DiscretizeGraphics[Graphics[{Disk[{0,0},1.3]}]]

Show[{background,scaledflower},PlotRange->All]

middleflat=RegionDifference[background,scaledflower]

outerboundary=RegionBoundary[background];
innerboundary=RegionBoundary[scaledflower];

level0=0.;
level1=0.25;
level2=0.4;
Show[{
RegionProduct[background,Point[{{level0}}]],
RegionProduct[outerboundary,Line[{{level0},{level1}}]],
RegionProduct[middleflat,Point[{{level1}}]],
RegionProduct[innerboundary,Line[{{level1},{level2}}]],
RegionProduct[scaledflower,Point[{{level2}}]]
}]

Export[NotebookDirectory[]<>"flowercoin.stl",%]

Import[NotebookDirectory[]<>"flowercoin.stl"]