Example 4 demonstrates how the automatic repetition of the Randomize function can result in a part with a large number of randomly arranged fragments.
volumedata = structure:getvolumedata (0); volumedata.reset (); bauteil=volumedata:addmeshtoraster(); cell01=bauteil:randomize(1,1,1,50); cell02=bauteil:randomize(1,1,1,50); cell03=bauteil:randomize(1,1,1,50); cell04=cell01:randomize(1,1,1,50); cell05=cell01:randomize(1,1,1,50); cell06=cell02:randomize(1,1,1,50); cell07=cell04:randomize(1,1,1,50); cell09=cell01:randomize(1,1,1,50); cell10=cell02:randomize(1,1,1,50); cell11=cell03:randomize(1,1,1,50); cell12=cell04:randomize(1,1,1,50); cell13=cell05:randomize(1,1,1,50); cell14=cell06:randomize(1,1,1,50); cell15=cell07:randomize(1,1,1,50); cell16=bauteil:randomize(1,1,1,50); cell01.cell=structure:findcell("Cell 01"); cell02.cell=structure:findcell("Cell 02"); cell03.cell=structure:findcell("Cell 03"); cell04.cell=structure:findcell("Cell 04"); cell05.cell=structure:findcell("Cell 05"); cell06.cell=structure:findcell("Cell 06"); cell07.cell=structure:findcell("Cell 07"); bauteil.cell=structure:findcell("Cell 08"); cell09.cell=structure:findcell("Cell 09"); cell10.cell=structure:findcell("Cell 10"); cell11.cell=structure:findcell("Cell 11"); cell12.cell=structure:findcell("Cell 12"); cell13.cell=structure:findcell("Cell 13"); cell14.cell=structure:findcell("Cell 14"); cell15.cell=structure:findcell("Cell 15"); cell16.cell=structure:findcell("Cell 16"); cell01.name=("cell 01"); cell01.name=("cell 02"); cell01.name=("cell 03"); cell01.name=("cell 04"); cell01.name=("cell 05"); cell01.name=("cell 06"); cell01.name=("cell 07"); bauteil.name=("cell 08"); cell09.name=("cell 09"); cell10.name=("cell 10"); cell11.name=("cell 11"); cell12.name=("cell 12"); cell13.name=("cell 13"); cell14.name=("cell 14"); cell15.name=("cell 15"); cell16.name=("cell 16");
The structure consists of 16 different, but same-sized cells.
The volume data is loaded and reset. After the part is gridded and the name bauteil is assigned to the basic fragment, 15 additional fragments are created with the randomize command. The reference fragment of the randomization is altered so that, in the end, all 16 random fragments have approximately the same number of grid cells.
Next, a different structure cell is assigned to each fragment. As the arrangement of the fragments is coincidental, the cells are inserted randomly into the part.
Finally, the fragments are given numbered names in the 3S Executor, since the automatic name creation of Netfabb could become very confusing in cases of repeated processes.