-
Notifications
You must be signed in to change notification settings - Fork 23
Home
An instance of the layout class or any of its subclasses (components, beams, etc.).
A layout is the base class of most objects in PyOpticL. Simply, a layout is a grouping of objects. All objects within the layout are positioned relative to the layouts origin.
A subclass of layout. This is a layout with it's own physical geometry, drilling, and optical properties. These aspects of the component are defined by instantiating it with a component definition.
A component definition is an abstract class which allows for the definition of various properties of a component:
- Geometry: Mesh or part based
- Drilling: Pre-defined drilling for part placement / mounting
- Subcomponents: Pre-defined components grouped with the parent component
- Interfaces: Definitions of the optical properties of the component
An abstract representation of an optical interface. This can be used to represent optical interactions such as reflection, refraction, thin lenses, and beyond. Any number of interfaces along with their positioning and properties can be defined with a component definition.
A subclass of layout. This object allows for simulation of a gaussian beam propagating through the layout. It supports focusing, polarization, wavelength, and power tracking all dictated by the interface parameters within the layout. It also overrides the add function of the layout class to allow for objects to be placed along the beam. This allows simple layout design via specifying only the rotation of the component and the distance from the last component.
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( ... ), ... )
General conventions:
- Component definition naming should follow clear convention. In the case of an off-the-shelf component, the name should follow: type_of_component_partnumber, ie mirror_mount_km01 For custom components try to use highly descriptive names such as isomet_aom_bracket_for_km100.
- Transparency in calculations. Always try to make it clear where positions or value are derived from. If possible, it is always best to define any important positions as class constants with clear names, then reference them as needed. Hand calculating values from measurements and then hardcoding them in is typically discouraged.
The following properties are available to be define in component definition:
Pre-defined class constants such as:
- object_color: The color of the geometry
- object_icon: The icon displayed in FreeCAD tree view
- object_group: The group the object belongs to
- object_transparency: The transparency of the geometry As well as any additional constants such as positions used for geometry or mounting.
The init function is where you should define all user-adjustable parameter
This function defined the objects geometry, it should return a FreeCAD Part object. Refer to FreeCAD documentation for more info on how to create parts.
Define geometry mesh. This can be used instead of shape() for mesh-based components. See model importing for more details on adding a model to the library
This function should return a list of components which will be automatically added to the component when added to a layout. Use the subcomponent namedTuple object to define the definition and placement of the subcomponent.
This defines the drilling which will be automatically cut from all parents and peers of this object in the layout. It must return a FreeCAD part object.
Define any optical interfaces for this component. This should return a list of optical interfaces that define the optical properties of the component.