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

Align2D()

Align3D

Align3D()

AlignContainer2D

Align2D()

AlignContainer3D

Align3D()

Arange2D

Arange2D(item, step, count) Container that repeats its item, shifting each repetition by the specified step.

Arange3D

Arange3D(item, step, count) 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

Box2D() Box2D(lower, upper) Box2D(left, bottom, right, top)

Box3D

Box3D() Box3D(lower, upper) Box3D(back, left, bottom, front, right, top)

Cartesian2D

Geometry in 2D Cartesian space.

Cartesian3D

Geometry in 3D space.

Circle

Circle(radius, material)

Clip2D

Clip2D(item, box) Clip2D(item, left, bottom, right, top)

Clip3D

Clip3D(item, box) Clip3D(item, back, left, bottom, front, right, top)

Container2D

Base class for all 2D containers.

Container3D

Base class for all 3D containers.

Cuboid

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

Cylinder

Cylinder(radius, height, material)

Cylindrical

Geometry in 2D cylindrical space.

Ellipse

Ellipse(radius0, radius1, material)

EllipticCylinder

EllipticCylinder(radius0, radius1, height, material, *, angle=0.) EllipticCylinder(radii, height, material, *, angle=0.)

Extrusion

Extrusion(item, length=infinity)

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

Intersection2D(item, shape)

Intersection3D

Intersection3D(item, shape)

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

MultiShelf2D(repeat=1, shift=0)

MultiStack2D

MultiStack2D(repeat=1, shift=0, **alignment)

MultiStack3D

MultiStack3D(repeat=1, shift=0, **alignments)

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(vertices, material)

Prism

Prism with base defined by polygon with specified vertices

Rectangle

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

Revolution

Revolution(item)

Shelf2D

Shelf2D(shift=0)

SingleStack2D

SingleStack2D(shift=0, **alignment)

SingleStack3D

SingleStack3D(shift=0, **alignments)

Sphere

Sphere(radius, material)

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(a0, a1, b0, b1, material) Triangle(a, b, material)

TriangularPrism

TriangularPrism(a0, a1, b0, b1, height, material) TriangularPrism(a, b, height, material) TriangularPrism (3D geometry object).

Tube

Tube(inner_radius, outer_radius, height, material)

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