-
Notifications
You must be signed in to change notification settings - Fork 23
Usage Basics
At the top of every design we must have a base layout object. This could either be a component such as a baseplate object for all the components to mount to, or it could be a generic layout in which several baseplates or other designs could be nested. The key here is that all subclasses of layout can be treated largely the same. That is to say we could start our design as:
example_layout = layout( ... )
or
example_layout = component(definition=baseplate, ... )
and it will make no difference to the process of adding additional components to the layout.
To add components to any layout or object you use the add() function. In the case of a layout or component object, this takes arguments for the object you wish to add, the position, and the rotation. It is important to remember that generally all layouts and components can be treated the same. For instance one could define several small layouts, then add them all to a single baseplate:
layout1 = layout( ... )
layout1.add(component( ... ))
layout2 = layout( ... )
layout2.add(component( ... ))
baseplate = component(definition=baseplate, ... )
baseplate.add(layout1, ... )
baseplate.add(layout2, ... )
Similarly, there is no difference in adding a beam_path object to a layout, as it is also a subclass of the base layout class:
beam = example_layout.add(beam_path( ... ), ... )
Then for adding compoenent along the beam path, the placement arguments change, but the function is the same:
beam.add(component( ... ), ... )