Segment (class)

Warning : this file has been generated, you shouldn’t edit it

class Segment(begin=0, end=0, label='', init_dict=None)[source]

Bases: pyleecan.Classes.Line.Line

A segment between two points

VERSION = 1
check()

assert that the line is correct (begin != end)

Parameters:self (Segment) – A Segment object
Returns:
Return type:None
Raises:PointSegmentError – The beginning point and the ending point of an Segment can’t be the same
comp_length()

Compute the length of the line

Parameters:self (Segment) – A Segment object
Returns:length – lenght of the line [m]
Return type:float
Raises:PointSegmentError – Call Segment.check()
discretize(nb_point=0)

Return the discretize version of the Segment. Begin and end are always returned

Parameters:
  • self (Segment) – A Segment object
  • nb_point (int) – Number of points to add to discretize the line (Default value = LINE_NPOINT_D)
Returns:

list_point – List of complex coordinate of the points

Return type:

list

Raises:

NbPointSegmentDError – nb_point must be an integer >=

get_begin()

Return the begin point of the segment

Parameters:self (Segment) – A Segment object
Returns:begin – Begin point of the Segment
Return type:complex
get_end()

Return the end point of the segment

Parameters:self (Segment) – A Segment object
Returns:end – End point of the Segment
Return type:complex
get_middle()

Return the point at the middle of the Segment

Parameters:self (Segment) – A Segment object
Returns:Zmid – Complex coordinates of the middle of the Segment
Return type:complex
rotate(angle)

Rotation of the Segment of angle

Parameters:
  • self (Segment) – An Segment Object
  • angle (float) – the angle of rotation [rad]
Returns:

Return type:

None

translate(Zt)

Translate the Segment object

Parameters:
  • self (Segment) – An Segment object
  • Zt (complex) – Complex value for translation
Returns:

Return type:

None

as_dict()[source]

Convert this objet in a json seriable dict (can be use in __init__)

begin

begin point of the line

end

end point of the line