Introduction
The latest kitchen framework known as K2, is the second generation of abstract kitchen. This framework located in cm/abstract/k2 strives for fast implementation of kitchen assortments, allows the end user to switch and mix different assortments on the fly, and have lower maintenance costs for assortment updates. This abstract offers several key features including:
- Behaviors – Classes that define a specific functionality of a snapper.
- Engine – Created by invalidation behaviors to run a series of functions.
- XpShape – Class that describes the shape/sides of a cabinet using a sequence of faces.
- Spawners – Classes that handle the instantiation of snappers and what behaviors they can have.
- Child Snappers – Snappers that exist within another snapper.
- Chooser – Dialog to select and insert layouts into cabinets.
- K2Creator – Catalog interface to define a K2 assortment by drag and dropping behaviors to describe a snapper.
Behaviors
K2 is written around the behavior concept. The K2Snapper base class in abstract will contain a sequence of behaviors. The behaviors are dynamic, meaning that they can be exchanged on the fly. K2Behaviors are stateless depending on the stateless method.
/** * Return if this is stateless. If so, multiple different cabinets can share * the same instance of this behavior. If not, each will get a copy. */ extend public bool stateless() { if (?bool v = this."stateless") return v; return true; }
This stateless prop can be set during construction.
/** * Constructor */ public constructor() { super("localBound"); this."stateless" = false; }
In K2, there is a behavior debug dialog that can be opened by right-clicking on a snapper. This dialog will show the behaviors and the shape used by the snapper, and the behavior store. Behaviors can be added to and removed from the snapper through this dialog for debug purposes.
Engine
Engines are classes that contain a function library. These libraries are run in sequence in response to events. In K2, engines are created by invalidation behaviors through the invalidation manager. A K2EngineInvalidationBehavior will create a K2Engine, and then the functions appended to the engine’s function libraries are executed. In K2, different engines can be created to handle specific tasks.
For example, if we want bottom moldings to be automatically inserted across cabinets when base cabinets are snapped together, a K2AutoMoldingBehavior will register a K2MoldingAlternativeEngine during invalidation, and this engine will be started by the invalidation manager. The logic of snapping and spanning the molding across a group of connected cabinets will be handled by the functions in the engine.
Undo operations has also been streamlined in the engine making large repetitive operations more efficient. Consider moving system-wide updates or updates involving many connected snappers to an engine.
XpShape
An XpShape class contains the dimensions of a snapper and defines their shape through a sequence of faces (XpFace). Each face contains information such as start point, end point, elevation, height, info on connected faces, etc. The faces are identifiable using tags (#left, #back, #front, #right). The snapper will use the shape and its faces to generate its graphics. This can be done by extruding the faces.
For example, a rectangular cabinet that uses an XpBoxShape will contain the following faces:
While a corner cabinet that uses an XpSymCorner90Shape will contain the following faces:
Apart from representing the shape, faces are also used when identifying alternatives. For example, alternatives for moldings, worktops, etc. to snap to a cabinet. In the example of K2MoldingAlternativeEngine earlier, the engine will utilize the faces to generate alternatives to figure out where to place them.
Spawners
Spawners (SnapperSpawner and AnimationSpawner) are used to instantiate cabinets, worktops, insert nodes and worktop built-ins. The spawner can set the initial properties of a snapper (or animation), decide its shape, and populate it with behaviors.
Child Snappers
In K2, inserts are treated as child snappers to the cabinets. Where each component of the insert (front, drawer, shelf, etc) all children to the cabinet. Other components that would be snapped onto the cabinet such as moldings and handles will also be adopted by the cabinet as children.
Chooser
Shows inserts in a grid-like fashion. Allows selecting inserts and inserting them into other existing cabinets via an animation. Differences from the chooser in the old abstract is, this chooser can search for specific inserts by tags or description using the new search bar, as well as a button to start an insert animation.
K2Creator
The K2Creator is a catalog dialog created to define products through a drag and drop interface. Through this interface, information such as a snapper’s dimension domains, parts information, and behaviors can be defined in a structured way.
Definitions can be dragged and dropped.
Or selected from a list of definitions.
Inserts are also defined using the dialog. Inserts make use of nodes to represent its components. For example, an insert with 4 drawers would have 4 nodes, each one a drawer node. These nodes will then become child snappers to the cabinet if the cabinet were to use this layout.
With this dialog, it will be entirely possible to create a kitchen extension without the use of any code. A product line can be entirely defined using K2Creator, and the created products will even be able to interact with products from other extensions. This allows the end user to switch and mix different kitchen assortments. In custom extensions, it is expected that the only code that would be written would be any custom behaviors or engines to solve extension specific cases that is not already handled in the framework. There would only be very rare instances where subclassing is necessary. These definitions can also be saved and exported in JSON which can then be used in other software. The structured tree views, the ability to drag and drop, support for behaviors, as well as the JSON export makes the K2 creator a powerful tool for creating kitchen assortments.
Comments
0 comments
Please sign in to leave a comment.