pyleecan.Classes.SurfLine module

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

class SurfLine(line_list=- 1, point_ref=0, label='', init_dict=None, init_str=None)[source]

Bases: Surface

SurfLine defined by list of lines that delimit it, label and point reference.

VERSION = 1
check()

assert the Surface is correct

Parameters:

self (SurfLine) – A SurfLine object

Return type:

None

comp_length()

Compute the length of the SurfLine object

Parameters:

self (SurfLine) – A SurfLine object

Returns:

length – Length of the surface [m]

Return type:

float

comp_point_ref(is_set=False)

Compute the point ref of the Surface

Parameters:
  • self (SurfLine) – A SurfLine object

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

Returns:

point_ref – the reference point of the surface

Return type:

complex

comp_surface(Ndisc=200)

Compute the SurfLine surface

Parameters:
  • self (SurfLine) – A SurfLine object

  • Ndisc (int) – Number of point to discretize the lines

Returns:

surf – The SurfLine surface [m**2]

Return type:

float

discretize(Npoint=- 1)

Returns the discretize version of the SurfLine

Parameters:
  • self (SurfLine) – A SurfLine object

  • Npoint (int) – Number of point on each line (Default value = -1 => use the line default discretization)

Returns:

point_list – List of complex coordinates

Return type:

list

get_lines()

The list returned contains all the Line of the SurfLine

Parameters:

self (SurfLine) – A SurfLine object

Returns:

line_list – list of lines delimiting the surface

Return type:

list

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

Returns the PolarArc Patch to be display in matplotlib

Parameters:
  • self (SurfLine) – a SurfLine object

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

  • edgecolor – the edge color 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), …}

  • hatch (str) – Set the hatching pattern: {‘/’, ‘’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’}

Returns:

patch_list – List of patches corresponding to the surface

Return type:

list of matplotlib.patches.Polygon

plot_lines(fig=None, ax=None, is_show_fig=True)

Plot the SurfLine-Contour in a matplotlib fig (For plotting unclosed contour, for Polygon use plot method from Surface object)

Parameters:
  • self (SurfLine) – A SurfLine object

  • fig (Matplotlib.figure.Figure) – existing figure to use if None create a new one

  • ax (Matplotlib.axes.Axes object) – Axis on which to plot the data

  • is_show_fig (bool) – To call show at the end of the method

Returns:

  • fig (Matplotlib.figure.Figure) – Figure containing the plot

  • ax (Matplotlib.axes.Axes object) – Axis containing the plot

rotate(angle)

Rotate the surface

Parameters:
  • self (SurfLine) – A SurfLine object

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

Return type:

None

scale(scale_factor)

Scale the coordinates of the lines

Parameters:
  • self (SurfLine) – A SurfLine Object

  • scale_factor (float) – the Scale factor [-]

Return type:

None

translate(Zt)

Translate the surface

Parameters:
  • self (SurfLine) – A SurfLine object

  • Zt (complex) – Complex value for translation

Return type:

None

save(save_path='', is_folder=False, type_handle_old=2, type_compression=0)

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 (json only)

  • type_handle_old (int) – How to handle old file in folder mode (0:Nothing, 1:Delete, 2:Move to “Backup” folder)

  • type_compression (int) – Available only for json, 0: no compression, 1: gzip

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', ignore_list=None, is_add_value=False)[source]

Compare two objects and return list of differences

as_dict(type_handle_ndarray=0, keep_function=False, **kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). type_handle_ndarray: int

How to handle ndarray (0: tolist, 1: copy, 2: nothing)

keep_functionbool

True to keep the function object, else return str

Optional keyword input parameter is for internal use only and may prevent json serializability.

copy()[source]

Creates a deepcopy of the object

property line_list

List of Lines

Type:

[Line]