Circle (class)

Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Geometry/Circle

class Circle(radius=1, center=0, line_label='', point_ref=0, label='', init_dict=None, init_str=None)[source]

Bases: pyleecan.Classes.Surface.Surface

Circle define by the center of circle(point_ref), the label and the radius

VERSION = 1
check()

assert the Circle is correct (the radius > 0)

Parameters

self (Circle) – A Circle object

Returns

Return type

None

Raises

RadiusCircleError – The radius of a circle must be >= 0

comp_length()

Compute the length of the circle

Parameters

self (Circle) – A Circle object

Returns

length – the length of the circle [m]

Return type

float

comp_surface()

Compute the circle surface

Parameters

self (Circle) – A Circle object

Returns

surf – The circle surface [m**2]

Return type

float

discretize()

Return the discretize version of the Circle.

Parameters
  • self (Circle) – A Circle Object

  • nb_point (int) – Number of point on the circle

Returns

point_list – List of complex coordinate of the points

Return type

list

get_lines()

Get the lines needed to draw the surface (2 Arc3)

Parameters

self (Circle) – A circle Object

Returns

line_list – Two arcs to draw the circle

Return type

list

get_patches(color='w', edgecolor='k', is_edge_only=False, linestyle=None)

Returns the Circle Patch to be display in matplotlib

Parameters
  • self (Circle) – a Circle object

  • color – the color of the Patch (Default value = PATCH_COLOR)

  • edgecolor – edgecolor of the Patch (Default value = PATCH_EDGE)

  • is_edge_only (bool) – To set the transparancy of the face color to 0 and 1 for the edge color

  • linestyle (str) – Line style of the edge {‘-‘, ‘–’, ‘-.’, ‘:’, ‘’, (offset, on-off-seq), …}

Returns

patch_list – List of patches corresponding to the surface

Return type

list of matplotlib.patches.Circle

rotate(angle)

Rotation of the Circle of angle

Parameters
  • self (Circle) – An Circle Object

  • angle (float) – the angle of rotation [rad]

Returns

Return type

None

Raises

AngleRotationCircleError – The angle must be a float or int

translate(Zt)

Translate the Circle object

Parameters
  • self (Circle) – An Circle object

  • Zt (complex) – Complex value for translation

Returns

Return type

None

Raises

PointTranslateCircleError – The point must be a complex number or int or float

comp_point_ref(is_set=False)

Compute the point ref of the Surface

Parameters
  • self (Circle) – A Circle object

  • is_set (bool) – True to update the point_ref property

Returns

point_ref – the reference point of the surface

Return type

complex

save(save_path='', is_folder=False)

Save the object to the save_path

Parameters
  • self – A pyleecan object

  • save_path (str) – path to the folder to save the object

  • is_folder (bool) – to split the object in different files: separate simulation machine and materials

copy(**kwargs)

Return a copy of the class

get_logger()

Get the object logger or its parent’s one

Parameters

obj – A pyleecan object

Returns

logger – Pyleecan object dedicated logger

Return type

logging.Logger

compare(other, name='self')[source]

Compare two objects and return list of differences

as_dict(**kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). Optional keyword input parameter is for internal use only and may prevent json serializability.

property radius

Radius of the circle

Type

float

Min

0

property center

center of the Circle

Type

complex

property line_label

Label to set to the lines

Type

str