plask.geometry

PLaSK geometry classes.

Classes and functions defined in this module can be used to create and modify geometry description in PLaSK. See sec-geometry-python 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 two-dimensional 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

Align2D

Container with its items located according to specified alignment.

Align3D

Container with its items located according to specified alignment.

AlignContainer2D

Align2D()

AlignContainer3D

Align3D()

Arange2D

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

Arange3D

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

Block2D

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

Block3D

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

Box2D

Rectangular two-dimensional box.

Box3D

Cuboidal three-dimensional box.

Cartesian2D

Geometry in 2D Cartesian space.

Cartesian3D

Geometry in 3D space.

Circle

Circle (2D geometry object).

Clip2D

Transform that clips the held geometry object to the specified clip-box (2D version).

Clip3D

Transform that clips the held geometry object to the specified clip-box (3D version).

Container2D

Base class for all 2D containers.

Container3D

Base class for all 3D containers.

Cuboid

Cuboidal block (3D geometry object).

Cylinder

Vertical cylinder (3D geometry object).

Cylindrical

Geometry in 2D cylindrical space.

Extrusion

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

Flip2D

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

Flip3D

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

Geometry

Base class for all geometries

GeometryObject

Base class for all geometry objects.

GeometryObject2D

Base class for 2D geometry objects.

GeometryObject3D

Base class for 3D geometry objects.

GeometryObjectLeaf2D

Base class for all 2D leaves

GeometryObjectLeaf3D

Base class for all 3D leaves

GeometryObjectTransform2Dto3D

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

Intersection2D

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

Intersection3D

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

Lattice

Lattice container that arranges its children in two-dimensional lattice.

Mirror2D

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

Mirror3D

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

MultiShelf2D

Shelf container that repeats its contents.

MultiStack2D

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

MultiStack3D

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

Path

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

PathHint

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

PathHints

Hint used for resolving ambiguities in a geometry tree.

Polygon

Polygon (2D geometry object).

Prism

Prism with base defined by polygon with specified vertices

Rectangle

Rectangular block (2D geometry object).

Revolution

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

Shelf2D

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

SingleStack2D

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

SingleStack3D

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

Sphere

Sphere (3D geometry object).

Subtree

A selected part of a geometry tree.

Transform2D

Base class for all 2D geometry transforms.

Transform3D

Base class for all 3D geometry transforms.

Translation2D

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

Translation3D

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

Triangle

Triangle (2D geometry object).

TriangularPrism

TriangularPrism (3D geometry object).

Tube

Vertically oriented tube i.e. hollow cylinder (3D geometry object).

Functions

Shelf([repeat, shift])

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

Stack2D([repeat, shift])

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

Stack3D([repeat, shift])

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}.