Repeating a sub-component within a dynamic component (2 Dimensions)
A repetitive dynamic component is a component containing a sub-component that replicate, such as the tiles within a floor component. In the case of a floor and tiles, the component scales in 2 dimensions, X, and Y.
Following is an image of the Floor component containing 1 Tile sub-component (it simply looks like one tile). The Tile sub-component replicates as the Floor component is scaled in the X and Y directions (using the Scale tool).
Following is an image of the Floor component after it has been scaled. Now the Floor has 8 copies of the replicating Tile subcomponent.
To replicate a subcomponent within a parent component (in two dimensions):
- Create your component with one subcomponent, such as a floor with one tile.
- Context-click on the component. The component's context menu is displayed.
- Select the Dynamic Components > Component Attributes menu item. The Component Attributes dialog box is displayed.
- Ensure that the attributes for all components are visible.
- Create a 'Columns' attribute in the Floor component to hold the number of rows in your dynamic component.
- Create a 'Rows' attribute in the Floor component to hold the number of rows in your dynamic component.
- Create an attribute, in the Floor component, that represents the size of the replicating subcomponent. For example, this example contains a 'TileSize' attribute.
- Set 'TileSize' to some value, such as
12
. - Set the 'LenX' and 'LenY' of the Tile subcomponent to the size in the parent component. For example, set 'LenX' to equal
Floor!TileSize
and 'LenY' to equalFloor!TileSize
(for the Floor Tile subcomponent). - Use a formula in the field next to the Floor component's 'Columns' attribute to determine the number of columns in the parent component. This formula will be based on the size of the replicating subcomponent (Tile) and overall size of the parent component (Floor). For example:
- Use a formula in the field next to the Floor's 'Rows' attribute to determine the number of rows in the parent component. This formula will be based on the tile size of the replicating subcomponent (Tile) and overall size of the parent component (Floor). For example:
- Add the Copies attribute to the Tile subcomponent.
- Use a formula in the field next to the 'Copies' attribute to calculate the number of copies of the replicating subcomponent. The copies are calculated by multiplying the rows by columns and subtracting one (for the original). For example:
- Establish the position of each replicating subcomponent (the exact column and row). Position is determined by establishing a multiplier that represents the row or column and then multiplying the multiplier by the size of the subcomponent to establish its X and Y location.
- Create an attribute to hold the row multiplier, such as
myRow
, in the Tile subcomponent. - Use a formula in the field next to the 'myRow' attribute that iterates through each copy and determines the row where the copy will be placed. For example:
- Create an attribute to hold the column multiplier, such as
myColumn
, in the Tile subcomponent. - Use a formula in the field next to the 'myColumn' attribute that iterates through each copy and determines the column where the copy will be placed. For example:
- Use a formula in the field next to the Tile subcomponent's 'X' attribute to calculate the location of the sub-component. For example:
- Use a formula in the field next to the Tile sub-component's 'Y' attribute to calculate the location of the sub-component. For example:
=CEILING(LenX/TileSize)
LenY/tilesize
to the nearest bigger whole number.=CEILING(LenY/TileSize
)
=Floor!rows*Floor!columns-1
=FLOOR(COPY/Floor!columns)
myRow
will be equal to 2. Note that rows start at 0, so 2 represents the 3rd row.
=COPY-(myRow*Floor!columns)
myColumn
will be equal to 1. Note that columns start at 0, so 1 represents the 2rd row.
X =myColumn*floor!tilesize
Y =myRow*floor!tilesize