12.3.15. Grid

A grid drawn into a canvas.

12.3.15.1. Attributes

  • .kind: one of hexagonal, triangles, polar, squares, rectangles, 8+4, bricks, circles, vlines, hlines, voronoi
reference/shapes/grid_kinds.png

figure with different kinds of grids. For the code, see xxx

  • .style: controls what to draw in the grid: one of wireframe, dots, regions
  • .angle: controls the angle of the axis of the grid, with respect to the page
  • .offset: allows ofsetting the grid to offset it in the canvas. Value can be a length measure, or a percentage of the grid unit
  • .skew: skews the pattern. as value an angle, or a percentage can be given
  • .line: line attributes for the lines (color, thickness). See xxxxxxxx
  • .randomness: points will be shifted randomly (as much as the given parameter)

Of course, plus all the generic shape attributes. Note that you prabably want to fix the .layer attribute to put the grid on the bottom of your drawing, if you plan to draw later

12.3.15.2. Methods

  • cell(a,b) returns the cell at the given coordinates
  • colorize(colorizer): colorizes the cells
  • decorate(decorator): decorates each cell. This allows printing tesselations. See >tesellations

12.3.15.3. Examples

Grid allows to make patterned sheets for drawing right from the command line:

bash> blex page p -size A4 -grid hexagonal --size 4cm
bash> blex p.save file.pdf
  • Blex is just a shortcut for bleps x that take all the input as sentences, useful for creating oneliners. among invocations, bleps remember objects created, so the previous example is made up of two bash commands, and bleps remember name p.