pyleecan.Classes.Surface module

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

class Surface(point_ref=0, label='', init_dict=None, init_str=None)[source]

Bases: FrozenClass

SurfLine define by list of lines that delimit it

VERSION = 1
comp_mesh_dict(element_size, prefix='')

Returns the number of mesh elements on each line of the surface to match the element_size.

Parameters:
  • self (Surface) – a Surface object

  • element_size (float) – The size of each element on the mesh [m]

  • prefix (str) – Label prefix for line

Returns:

mesh_dict – Dictionary containing the number of element of each line of the surface

Return type:

dict

draw_FEMM(femm, nodeprop=None, maxseg=None, FEMM_dict=None, hide=False, BC_dict=None, is_draw=True, type_set_BC=0)

draw the Surface in FEMM

Parameters:
  • femm (FEMMHandler) – client to send command to a FEMM instance

  • nodeprop – Nodal property (Default value = None)

  • maxseg – Meshed with elements that span at most maxsegdeg degrees per element (Default value = None)

  • FEMM_dict (dict) – dictionary containing the main parameters of FEMM

  • hide – 0 = not hidden in post-processor, 1 == hidden in post processor (Default value = False)

  • BC_dict (dict) – Boundary condition dict ([line label] = BC name)

  • is_draw (bool) – 1 to draw the list of surfaces given

  • type_set_BC (bool) – 1 to set BC of the yoke only, 0 to set all

Return type:

None

plot(fig=None, ax=None, color='w', edgecolor='k', is_edge_only=False, linestyle=None, is_disp_point_ref=False, is_disp_line_index=False, is_show_fig=True)

Plot the Surface patch in a matplotlib fig

Parameters:
  • self (Surface) – A Surface object

  • fig – if None, open a new fig and plot, else add to the current one (Default value = None)

  • 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), …}

  • is_disp_point_ref (bool) – True to add the point_ref

  • is_disp_line_index (bool) – True to add the index of the lines

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

Returns:

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

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

split_line(Z1, Z2, is_join=False, prop_dict_join=None)

Cut the Surface in two part according to a line defined by two complex “Above” is in the coordinate system with Z1 in 0 and Z2 on the X>0 axis

Parameters:
  • self (Surface) – An Surface object

  • Z1 (complex) – First point of the cutting Line

  • Z2 (complex) – Second point of the cutting Line

  • is_join (bool) – True to join the split_list with Segment on the cutting line

  • prop_dict_join (dict) – Property dict to set on the join line

Returns:

top_surf, bot_surf – The two part of the Surface (one can be None if the line doesn’t cut the surface)

Return type:

SurfLine

is_inside(Z, if_online=False)
Determine if a given point is inside the surface.

If the point is on the line defining the surface, by default it will be considered as outside

Parameters:
  • self (Surface) – A Surface object

  • Z (complex) – Point that we want to check if it is in the surface

  • if_online (bool) – True to consider the point on the line as in the surface False to consider the point on the line as out of the surface

Returns:

is_inside – True : the point is inside the surface False : the point is outside the surface

Return type:

bool

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 point_ref

Center of symmetry

Type:

complex

property label

Label of the surface

Type:

str