Stylesheet Development with PTC ALD > Adding PTC ALD Code to Stylesheet Source > Samples > Blocks > Rotate a Block > Block Rotation with Rules
Block Rotation with Rules
Refer to the para in chapter context in the Arbortext-path/samples/ALD/Blocks/Rotation/blockRotation.xml sample file. The context includes a set of conditions based on the value of the role attribute in the associated stylesheet. Each condition references a different property set.
For example, the condition ELSE IF attribute “role” = “180 rules” of the para in chapter context is included to show how rules on blocks respond to being rotated. It references the block box and rotate 180 property sets. block box draws rules around the block (see Apply Boxing to a Block for further information). rotate 180 rotates a block, plus its configured rules, by 180 degrees clockwise. The relevant code in that property set is given below.
block.orientation = fBlock.ORIENT_180;
Here you have added block orientation property to the fBlock object. Using the constant ORIENT_180 means will rotate the block by 180 degrees clockwise. Use ORIENT_90 or ORIENT_270 to rotate by 90 degrees and 270 degrees clockwise, respectively. Note that as the block is rotated by 180 degrees its content will appear upside down.