pyleecan.GUI.Dxf.DXF_Hole module

class DXF_Hole(dxf_path=None, Zh=None, Lmag=None, lam=None)[source]

Bases: Ui_DXF_Hole, QDialog

Dialog to create HoleUD objects from DXF files

convert_dxf_with_FEMM(file_path, tol)

Convert a DXF file with FEMM: - Merge point according to tolerance - Convert lines to Arc and Segments

Parameters:
  • self ((DXF_Hole, DXF_Slot, DXF_Surf)) – GUI DXF widget

  • file_path (str) – Path to the file to convert

  • tol (float) – Tolerance to merge point [local unit]

enable_tolerance()[source]

Enable/Disable tolerance widget

open_document()[source]

Open a new dxf in the viewer

Parameters:

self (DXF_Hole) – a DXF_Hole object

comp_connection()[source]
Calculate connection matrices:
  • line2point: start point id and end point id for each line (ndarray[Nline, 2])

  • point2lines: lines id connected to each point (list[Npoints, n])

  • point_coord: matrix of points coordinates (ndarray[Npoint, 2])

Parameters:

self (DXF_Hole) – a DXF_Hole object

get_closest_line_id(X, Y)[source]

Get closest line id to input X and Y coordinates

Parameters:
  • self (DXF_Hole) – a DXF_Hole object

  • X (float) – x coordinate

  • Y (float) – y coordinate

get_connected_lines(connected_lines, lin_curr, pt_curr)[source]

Get connected lines to the current line starting at the current point (need to call method on both end points of the lines) return if the connected lines results in a closed surface and extend connected_lines

Parameters:
  • self (DXF_Hole) – a DXF_Hole object

  • connected_lines (list) – List of line index connected to current line and point

  • lin_curr (int) – current line id

  • pt_curr (int) – current point id

  • Results

  • ----------

  • is_closed (bool) – True if the connected lines results in a closed surface

init_graph()[source]

Initialize the viewer

Parameters:

self (DXF_Hole) – a DXF_Hole object

set_center()[source]

Update the position of the center

update_graph()[source]

Clean and redraw all the lines in viewer

Parameters:

self (DXF_Hole) – a DXF_Hole object

check_selection()[source]

Check if every line in the selection form a surface

Parameters:

self (DXF_Hole) – a DXF_Hole object

Returns:

is_surf – True if it forms a surface

Return type:

bool

sort_lines()[source]

Sort selected lines so that current line’s starting point is the same as previous line’s ending point and that current line’s ending point is the same as next line’s start point

Parameters:

self (DXF_Hole) – a DXF_Hole object

Returns:

  • curve_list ([Line]) – List of sorted lines

  • str_list ([str]) – List of line indices as str (to be printed in combobox)

add_surface()[source]

Validate the selection and create a surface object

Parameters:

self (DXF_Hole) – a DXF_Hole object

enable_magnetization()[source]

Enable/Disable the combobox/float edit for magnetization according to type

remove_selection()[source]
get_hole()[source]

Generate the HoleUD object corresponding to the selected surfaces

Parameters:

self (DXF_Hole) – a DXF_Hole object

Returns:

hole – User defined hole according to selected surfaces

Return type:

HoleUD

plot()[source]

Plot the current state of the hole

Parameters:

self (DXF_Hole) – a DXF_Hole object

delete_surface()[source]

Delete a selected surface

Parameters:

self (DXF_Hole) – a DXF_Hole object

highlight_surface()[source]

Highlight a surface to find it on the viewer

Parameters:

self (DXF_Hole) – a DXF_Hole object

save()[source]

Save the HoleUD object in a json file

Parameters:

self (DXF_Hole) – a DXF_Hole object

open_tuto()[source]

Open the tutorial video in a web browser

staticMetaObject = <PySide2.QtCore.QMetaObject object>