bluemira.geometry.wire

Wrapper for FreeCAD Part.Wire objects

Classes

BluemiraWire

Bluemira Wire class.

Module Contents

class bluemira.geometry.wire.BluemiraWire(boundary: list[bluemira.codes._freecadapi.apiWire | BluemiraWire], label: str = '')

Bases: bluemira.geometry.base.BluemiraGeo

Inheritance diagram of bluemira.geometry.wire.BluemiraWire

Bluemira Wire class.

Parameters:
  • boundary (list[bluemira.codes._freecadapi.apiWire | BluemiraWire]) – List of wires from which to make the BluemiraWire. The wires should be passed in “end-to-start”, i.e. the end point of the current wire in the list should match the start point of the next wire in the list.

  • label (str) – Label to assign to the wire

Note

The construction of the BluemiraWire can usually handle one wire that is not in the correct order in the boundary argument, but it is best not to test your luck.

_check_orientations()
static _converter(func)

Function used in __getattr__ to modify the added functions.

Returns:

Function used in __getattr__ to modify the added functions.

_create_shape() bluemira.codes._freecadapi.apiWire
Returns:

shape of the object as a single wire

Return type:

apiWire

_create_wire(*, check_reverse: bool = True)
Parameters:

check_reverse (bool)

_get_wires() list[bluemira.codes._freecadapi.apiWire]
Returns:

List of wires of which the shape consists of.

Return type:

list[bluemira.codes._freecadapi.apiWire]

__add__(other: BluemiraWire) BluemiraWire

Add two wires

Returns:

Wire resulting from combining two wires.

Raises:

TypeError – Must be BluemiraWire

Parameters:

other (BluemiraWire)

Return type:

BluemiraWire

close(label: str = '') None

Close the shape with a line segment between shape’s end and start point. This function modifies the object boundary.

Raises:

NotClosedWireError – Wire has not been closed

Parameters:

label (str)

Return type:

None

discretise(ndiscr: int = 100, *, byedges: bool = False, dl: float | None = None) bluemira.geometry.coordinates.Coordinates

Discretise the wire in ndiscr equidistant points or with a reference dl segment step.

Parameters:
  • ndiscr (int) – Number of points to discretise to

  • byedges (bool) – Whether or not to discretise by edges. If True, each edge is discretised separately using an approximated distance (wire.Length/ndiscr) or the specified dl. If True, it is possible that ndiscr is larger than specified.

  • dl (float | None) – Discretise by length, overriding ndiscr

Return type:

Coordinates of the discretised points.

value_at(alpha: float | None = None, distance: float | None = None) numpy.ndarray

Get a point along the wire at a given parameterised length or length.

Parameters:
  • alpha (float | None) – Parameterised distance along the wire length, in the range [0 .. 1]

  • distance (float | None) – Physical distance along the wire length

Return type:

Point coordinates (w.r.t. BluemiraWire’s BluemiraPlacement)

Raises:

GeometryError – Alpha or distance must be specified

parameter_at(vertex: collections.abc.Iterable[float], tolerance: float = EPS_FREECAD) float

Get the parameter value at a vertex along a wire.

Parameters:
  • vertex (collections.abc.Iterable[float]) – Vertex for which to get the parameter

  • tolerance (float) – Tolerance within which to get the parameter

Return type:

Parameter value along the wire at the vertex

Raises:

GeometryError – If the vertex is further away to the wire than the specified tolerance

start_point() bluemira.geometry.coordinates.Coordinates
Returns:

Get the coordinates of the start of the wire.

Return type:

bluemira.geometry.coordinates.Coordinates

end_point() bluemira.geometry.coordinates.Coordinates
Returns:

Get the coordinates of the end of the wire.

Return type:

bluemira.geometry.coordinates.Coordinates

property vertexes: bluemira.geometry.coordinates.Coordinates

The ordered vertexes of the wire.

Return type:

bluemira.geometry.coordinates.Coordinates

property edges: tuple[BluemiraWire]

The ordered edges of the wire.

Return type:

tuple[BluemiraWire]

property wires: tuple[BluemiraWire]

The wires of the wire. By definition a tuple of itself.

Return type:

tuple[BluemiraWire]

property faces: tuple

The faces of the wire. By definition an empty tuple.

Return type:

tuple

property shells: tuple

The shells of the wire. By definition an empty tuple.

Return type:

tuple

property solids: tuple

The solids of the wire. By definition an empty tuple.

Return type:

tuple