plask.geometry
¶
PLaSK geometry classes.
Classes and functions defined in this module can be used to create and modify geometry description in PLaSK. See secgeometrypython for more details.
Example
To create a simple stack with two identical rectangles and check its total size, use the following commands:
>>> rectangle = geometry.Block2D(4, 2, 'GaAs')
>>> stack = geometry.Stack2D()
>>> stack.prepend(rectangle)
<plask.geometry.PathHint at 0x40a52f8>
>>> stack.prepend(rectangle)
<plask.geometry.PathHint at 0x40a50d8>
>>> stack.bbox
plask.geometry.Box2D(0, 0, 4, 4)
Now, to create a Cartesian twodimensional geometry over it:
>>> geometry.Cartesian2D(stack)
<plask.geometry.Cartesian2D object at (0x571acd0)>
You may also modify any existing geometry object:
>>> rectangle.height = 3
>>> stack.bbox
plask.geometry.Box2D(0, 0, 4, 6)
See also
Section Geometry Specification for detailed information of geometry.
XPL section geometry
for reference of the geometry definition
in the XPL file.
Classes¶
Container with its items located according to specified alignment. 

Container with its items located according to specified alignment. 

Align2D() 

Align3D() 

Container that repeats its item, shifting each repetition by the specified step. 

Container that repeats its item, shifting each repetition by the specified step. 

Rectangle(width, height, material) Rectangle(dims, material) 

Cuboid(depth, width, height, material) Cuboid(dims, material) 

Rectangular twodimensional box. 

Cuboidal threedimensional box. 

Geometry in 2D Cartesian space. 

Geometry in 3D space. 

Circle (2D geometry object). 

Transform that clips the held geometry object to the specified clipbox (2D version). 

Transform that clips the held geometry object to the specified clipbox (3D version). 

Base class for all 2D containers. 

Base class for all 3D containers. 

Cuboidal block (3D geometry object). 

Vertical cylinder (3D geometry object). 

Geometry in 2D cylindrical space. 

Extrusion in the longitudinal direction of the 2D object into a 3D one. 

Transfer that flips the geometry object along a specified axis (2D version). 

Transfer that flips the geometry object along a specified axis (3D version). 

Base class for all geometries 

Base class for all geometry objects. 

Base class for 2D geometry objects. 

Base class for 3D geometry objects. 

Base class for all 2D leaves 

Base class for all 3D leaves 

Base class for all transformations which change 2D space to 3D. 

Transform that clips the held geometry object to the specified envelope (2D version). 

Transform that clips the held geometry object to the specified envelope (3D version). 

Lattice container that arranges its children in twodimensional lattice. 

Transfer that mirrors the geometry object along the specified axis (2D version). 

Transfer that mirrors the geometry object along the specified axis (3D version). 

Shelf container that repeats its contents. 

Stack container that repeats it contents (2D version). 

Stack container that repeats it contents (3D version). 

Sequence of objects in the geometry tree, used for resolving ambiguities. 

PathHint stores weak references to container and its child with translation. 

Hint used for resolving ambiguities in a geometry tree. 

Prism (3D geometry object). 

Rectangular block (2D geometry object). 

Revolution around the vertical axis of the 2D object into a 3D one. 

2D container that organizes its items one next to another. 

Container that organizes its items in a vertical stack (2D version). 

Container that organizes its items in a vertical stack (3D version). 

Sphere (3D geometry object). 

A selected part of a geometry tree. 

Base class for all 2D geometry transforms. 

Base class for all 3D geometry transforms. 

Transform that holds a translated geometry object together with its translation vector (2D version). 

Transform that holds a translated geometry object together with its translation vector (3D version). 

Triangle (2D geometry object). 
Functions¶

Create a 2D shelf container that organizes its items one next to another (like books on a bookshelf). 

Create a 2D container that organizes its items in a vertical stack. 

Create a 3D container that organizes its items in a vertical stack. 
Descriptions¶
Function Details¶
 plask.geometry.Shelf(repeat=None, shift=0.0)¶
Create a 2D shelf container that organizes its items one next to another (like books on a bookshelf).
The left side of the first object is located at the shift position in container local coordinates. Each consecutive object is placed to the right of the previous one. All the items are vertically aligned according to its bottom edge.
 Parameters:
repeat (int) – Number of the shelf contents repetitions. If None, this function creates Shelf2D and MultiShelf2D otherwise.
shift (float) – Position in the local coordinates of the left side of the shelf.Classes
 plask.geometry.Stack2D(repeat=None, shift=0.0, **kwargs)¶
Create a 2D container that organizes its items in a vertical stack.
The bottom side of the first object is located at the shift position in container local coordinates. Each consecutive object is placed on the top of the previous one.
 Parameters:
repeat (int) – Number of the stack contents repetitions. If None, this function creates SingleStack2D and MultiStack2D otherwise.
shift (float) – Position in the local coordinates of the bottom of the stack.
alignment (dict) – Horizontal alignment specifications. This dictionary can contain only one item. Its key can be
left
,right
,#center
, and#
where # is the horizontal axis name. The corresponding value is the position of the given edge/center/origin of the item. This alignment can be overridden while adding the objects to the stack. By default the alignment is{'left': 0}
.
 plask.geometry.Stack3D(repeat=None, shift=0.0, **kwargs)¶
Create a 3D container that organizes its items in a vertical stack.
The bottom side of the first object is located at the shift position in container local coordinates. Each consecutive object is placed on the top of the previous one. Then the whole stack is repeated repeat times.
 Parameters:
repeat (int) – Number of the stack contents repetitions. If None, this function creates SingleStack3D and MultiStack3D otherwise.
shift (float) – Position in the local coordinates of the bottom of the stack.
alignments (dict) – Horizontal alignments specifications. Keys in this dict can be
left
,right
,back
,front
,#center
, and#
where # are the horizontal axis names. The corresponding value is the position of the given edge/center/origin of the item. This alignment can be overridden while adding the objects to the stack. By default the alignment is{'left': 0, 'back': 0}
.