This example is a more complex script. In the structure, there are six different cells with different sizes. These strucures are assigned to core and hull fragments, with the biggest cells inserted into the core of the part and the finer cells inserted into the outer fragments.
volumedata = structure:getvolumedta (0); volumedata:reset (); cell_1 = structure:findcell ("cell 1mm"); cell_2 = structure:findcell ("cell 2mm"); cell_4 = structure:findcell ("cell 4mm"); cell_8 = structure:findcell ("cell 8mm"); cell_16 = structure:findcell ("cell 16mm"); structure:log ("Initialise Part"); struc1_core = volumedata:addmeshtoraster (); structure:log ("Creating Hull"); struc1_hull = struc1_core:createhull (1,1,1,1,1,1); struc1_hull.name = "Structure 1 - Hull"; struc1_core.name = "Structure 1 - Core"; struc1_hull.cell = cell_1; struc1_core.cell = cell_1; structure:log ("Create Structure 2x"); structure:log ("Dividing Blocks 2"); struc2_core = struc1_core:divideblocks (2,2,2); structure:log ("Creating Hull 2"); struc2_hull = struc2_core:createhull (2,2,2,2,2,2); struc2_hull.name = "Structure 2 - Hull"; struc2_core.name = "Structure 2 - Core"; struc2_hull.cell = cell_2; struc2_core.cell = cell_2; structure:log ("Create Structure 4x"); structure:log ("Dividing Blocks 4"); struc4_core = struc2_core:divideblocks (4,4,4); structure:log ("Creating Hull 4"); struc4_hull = struc4_core:createhull (4,4,4,4,4,4); struc4_hull.name = "Structure 4 - Hull"; struc4_core.name = "Structure 4 - Core"; struc4_hull.cell = cell_4; struc4_core.cell = cell_4; structure:log ("Create Structure 8x"); structure:log ("Dividing Blocks 8"); struc8_core = struc4_core:divideblocks (8,8,8); structure:log ("Creating Hull 8"); struc8_hull = struc8_core:createhull (8,8,8,8,8,8); struc8_hull.name = "Structure 8 - Hull"; struc8_core.name = "Structure 8 - Core"; struc8_hull.cell = cell_8; struc8_core.cell = cell_8; structure:log ("Create Structure 16x"); structure:log ("Dividing Blocks 16"); struc16_core = struc8_core:divideblocks (16,16,16); structure:log ("Creating Hull 16"); struc16_hull = struc16_core:createhull (16,16,16,16,16,16); struc16_hull.name = "Structure 16 - Hull"; struc16_core.name = "Structure 16 - Core"; struc16_hull.cell = cell_16; struc16_core.cell = cell_16; structure.simulateafterexecution = true; structure:log ("Finished");
First, the volume data is loaded and reset and the cells are loaded as cell_1, cell_2, cell_4, cell_8, and cell_16. For clarity, these names indicate the size of the cells.
From now on, structure logs are inserted that are displayed when the script is run, depending on how far the script has progressed. After the part is gridded by addmeshtoraster (Name of basic fragment: struc1_core), a hull of this basic fragment is created with the hull thickness 1 in each direction. New names are assigned to the fragments in the 3S Executor (for example, "Structure 1 - Hull").
Next, cell1 is assigned to the fragments.
In the next step, the following process is repeated: From the core fragment of the previous repetition of the process, blocks with twice the size of the last repetition are split off by divideblocks. Then, a hull of these blocks is created with the same thickness as the block size. This results in ten different fragments. The fragments are renamed and the cell fitting the block size is inserted into both fragments.
The raster is divided into fragments with blocks getting bigger and bigger, and the equally sized cells will fit exactly into the fragments. The creation of the hull guarantees that the respective cell remains not only in the grid cells remaining after the next split-off, but also in a hull, which will remain as well. At the end, a simulation of the structure is created.