Axonometry#

class Axonometry(*angles: float, ref_planes_distance: float = 100.0, trihedron_size: float = 100.0, trihedron_position: tuple[float, float] = (0, 0), page_size: Literal['A1'] | tuple[float, float] = 'A1', orientation: str = 'portrait')[source]#

Bases: Plane

Axonometry by intersection setup.

This class helps to set up the axonometry. From there one can start to use its method to add geometries (mostly Line).

To set up the necessary projection planes, the class first instatiates a Trihedron object which calculates the tilt to produce the three ReferencePlane objects. These, and the Axonometry can then be used to draw, i.e. draw_line().

As an attribute, this class instantiates a Drawing object which collects, or so to say records, all the drawing and projection operations (draw_line(), project()).

Note

When adding objects, and they have only two of the x y z, it means they are projecitons in a reference plane.

Parameters:
  • angles (float) – Architectural notation axonometry angle pair.

  • trihedron_position (tuple[float, float]) – Position of trihedron on the paper.

  • ref_planes_distance (float) – Reference plane transolation distance.

  • trihedron_size (float) – Coordinate axes size.

  • page_size (Literal['A1'] | tuple[float, float])

  • orientation (str)

Methods

draw_line

Add a Line to the current plane.

draw_point

Add a Point to the current plane.

import_mesh

Add a COMPAS Mesh object's lines to the axonometry.

random_angles

Generate valid axonometric angles and initialize the Axonometry object.

record_frames

Toggle recording of frames at each modification of geometry.

save_gif

save_png

Save drawing to PNG file.

save_svg

Save drawing to file SVG.

show_paths

Show the drawing paths with the vpype viewer.

visualize

Not Implemented.

Attributes

drawing

Class attribute set by Axonometry.

lines

All lines contained in the current plane.

objects

Collection of points and lines in current plane.

points

All points contained in the current plane.

x

X coordinate vector.

xy

Get the Axonometry's XY ReferencePlane object.

y

Y coordinate vector.

yz

Get the Axonometry's YZ ReferencePlane object.

z

Z coordinate vector.

zx

Get the Axonometry's ZX ReferencePlane object.

Methods#

Axonometry.draw_line(line: Line, layer_nr: int | None = None, ref_plane_keys: list[Literal['xy', 'yz', 'zx']] = ['xy', 'yz', 'zx']) Line[source]#

Add a Line to the current plane.

By inheritence, two main cases occur, each handled by a set of operations:

  • Adding a line into the axonometric picture plane.

  • Adding the line into one of the three reference planes.

Parameters:
  • line (Line) – The new line to be added.

  • ref_plane_keys (list[Literal['xy', 'yz', 'zx']]) – The reference planes on which to construct the auxiliary projections when adding a line on the axonometric picture plane, defaults to all three i.e. [“xy”, “yz”, “zx”].

  • layer_nr (int | None)

Returns:

The newly added line. If an identical line already exists in the planes’ objects, the existing line is returned instead of a new object.

Return type:

Line

Axonometry.draw_point(point: Point, ref_plane_keys: list[Literal['xy', 'yz', 'zx']] = ['xy', 'yz', 'zx']) Point[source]#

Add a Point to the current plane.

Note

The Line object operations are basically performed on its points, this method is extensively called in draw_line() and project(), with Line.start and Line.end as parameters.

Parameters:
Return type:

Point

Axonometry.import_mesh(mesh_object: Mesh, ref_plane_keys: list[Literal['xy', 'yz', 'zx']] = ['xy', 'yz', 'zx'], layer_nr: int | None = None) None[source]#

Add a COMPAS Mesh object’s lines to the axonometry.

The only data extracted from the OBJ file are lines. The resulting drawing will be a wireframe. Lines are drawn with the regular Plane.draw_line() method. When calling the method, auxilary projection planes are chosen based on threshold paramters which are evaluating the lines positions in space.

Parameters:
  • mesh_object (Mesh) – COMPAS Mesh object.

  • ref_plane_keys (list[Literal['xy', 'yz', 'zx']]) – The reference planes on which to construct the

  • layer_nr (int | None)

Return type:

None

auxiliary projections when adding a line on the axonometric picture plane, defaults to all three i.e. [“xy”, “yz”, “zx”]. :returns: None.

static Axonometry.random_angles(trihedron_position: tuple[float, float] = (0, 0), ref_planes_distance: float = 100.0, trihedron_size: float = 100.0, page_size: Literal['A1'] | tuple[float, float] = 'A1', orientation: str = 'portrait') Axonometry[source]#

Generate valid axonometric angles and initialize the Axonometry object.

Parameters:
Return type:

Axonometry

Axonometry.record_frames() None[source]#

Toggle recording of frames at each modification of geometry.

Return type:

None

Axonometry.save_gif(filename: str, directory: str = './output/')[source]#
Parameters:
  • filename (str)

  • directory (str)

Axonometry.save_png(filename: str, directory: str = './output/') str[source]#

Save drawing to PNG file.

This function first makes an SVG file (cropped) with save_svg(). Then converts it with cairosvg.svg2png().

Parameters:
  • filename (str) – Name of the PNG file.

  • directory (str) – Path to directory, defaults to ./output/.

Returns:

The relative filepath of the saved file.

Return type:

str

Axonometry.save_svg(filename: str, directory: str = './output/', *, crop: bool = False, center: bool = False) str[source]#

Save drawing to file SVG.

Parameters:
  • filename (str) – Name of the SVG file.

  • directory (str) – Path to directory, defaults to ./output/.

  • crop (bool) – Reduze page size to fit geometry, with small border.

  • center (bool) – Center geometry on page.

Returns:

The relative filepath of the saved file.

Return type:

str

Axonometry.show_paths() None[source]#

Show the drawing paths with the vpype viewer.

Return type:

None

Axonometry.visualize() None[source]#

Not Implemented.

Return type:

None

Attributes#

Axonometry.drawing = None#

Class attribute set by Axonometry.

Axonometry.lines#

All lines contained in the current plane.

Axonometry.objects#

Collection of points and lines in current plane.

Axonometry.points#

All points contained in the current plane.

Axonometry.x#

X coordinate vector.

Axonometry.xy#

Get the Axonometry’s XY ReferencePlane object.

Axonometry.y#

Y coordinate vector.

Axonometry.yz#

Get the Axonometry’s YZ ReferencePlane object.

Axonometry.z#

Z coordinate vector.

Axonometry.zx#

Get the Axonometry’s ZX ReferencePlane object.