Documentation
Modes
Grape can be in several modes.
-
Application mode
- Drawing mode (Default): At start-up Grape is in Drawing mode, the CAD area can be used to draw, an initial shape for example.
- Grammar mode: Once the first rule is applied Grape switches to Grammar mode, no more objects can be drawn to the CAD area.
- Edit mode: This is where new rules can be created and existing rules can be edited.
Interface
Rule manager
The rule manager displays a grammar a nested lists of rules. In application mode rules can be applied by selecting them. In edit mode rules can be selected for editing, and additionally new grammars, new rules and new groups can be added.
There are two buttons at the bottom of the manager. The Grammar button can be used to display and load the available grammars (This button will move to the top oft he manager shortly).
The Edit button is displayed only if the user is logged in. It can be used to switch between Application mode and Edit mode.
CAD area
The CAD area works like a fairly limited CAD application. In application mode shapes can be drawn to which rules are to be applied. The result of a rule application will also be shown in the CAD area.
In Edit mode the LHS (left hand side) and RHS (right hand side) of the rule are drawn here.
CAD menu
-
File
- New: Resets the CAD area to new drawing area. All existing objects are deleted.
- Export Screen: Exports the contents of the CAD area to a DXF file.
- Export Derivation: If a derivation has been completed, the individual steps of the derivation are drawn to a grid and exported as a DXF file.
- Edit: Some common edit functions.
- Tools: The available drawing tools.
-
View (Only if the browser supports WebGL)
- 2D
- 3D
-
Layer (Edit mode only)
- Left: Layer for the LHS.
- Right: Layer for the RHS.
- Construction: Layer for construction elements, these elements will not be part of the rule.
- Identification: A layer that cannot be selected, it can be used to turn identification labels on and off.
- Help: Displays a help window with some keyboard shortcuts.
Snap menu
These three buttons can be used to toggle Grid snap, Object snap and Angle snap respectively.
Coordinate box
Displays the coordinates of the cursor.
Message box
Displays messages returned from the system.
Properties area
This area is used to display miscellaneous properties. If an object is selected in the CAD area, its properties are displayed here. If a rule is being edited, its properties are displayed here.
Rule application
To start rule application either a initial rule should be selected in the rule manager (Most grammars offer such rules), or an initial shape can be drawn manually in the CAD area.
Once a rule is applied Grape switches to Grammar mode and the CAD area cannot be edited anymore. If one or several matches were found for the rule, the rule application floater is displayed.
Rules are displayed as follows. The match is displayed in red, the resulting shape is diplayed in black. Once a rule is commited, the highlighted match is erased.
Rule application floater
The rule application floater displays the number of matches found, and which one of these is currently being shown in the CAD area. The floater can be used to cycle through the available matches. It can also be used to apply a rule to the current match, although this isn’t strictly necessary. If another rule is applied, an uncommitted rule is automatically applied. The floater can also be used to cancel rule application.
Exit grammar mode
Once finished with applying rules, Grammar mode can be exited by clicking the Exit Grammar Mode button.
Rule editor
Unlike normal shape grammar conventions the left-hand-side (LHS) and right-hand-side (RHS) are drawn on-top of each other, but on different layers. The layer can be chosen via the Layer menu.
Grammars, rules and groups can be created via the rule manager. New grammars are created via the Grammar listing.
Rule properties
- Name: The name used to display the rule in the rule manager.
-
Schema
- a → b: The LHS will be deleted and replaced by the RHS.
- a → a + b: The RHS will be drawn on top of the LHS.
- a → t(a): A transformation rule where the LHS will be deleted. Special transformation properties will be displayed and the RHS is not drawn, rather it is derived from the LHS.
- a → a + t(a): The same as a → t(a), but the LHS is not deleted.
-
Mapping
- Identity: The LHS cannot be transformed at all while searching of matches. It must be the same shape at the same location. Seldom used, but useful for initial shapes.
- Isometry: While searching for matches, the LHS can be translated, rotated, and mirrored.
- Similarity: While searching for matches, the LHS can be translated, rotated, mirrored and scaled.
- Topology: Only neighbourliness is important in order to obtain a match. This is the basis for parametric rules. Additional constraint properties will be displayed. A rule that uses topology mapping will not take the symmetry of the rule into consideration, this can result in multiple matches with the same result.
- Left/Right: The objects on the LHS and RHS respectively. Objects can be dragged between these two areas to change the objects layer from Left to Right or vice versa.
- Constraints (Topology mapping only): Constraints that apply to the LHS of the rule. These must be fulfilled in order to obtain a match. The constraints do not affect the CAD area.
- Transformations (Transformation schemas only): Here the transformations can be added and edited which are applied to the LHS of a transformation rule.