
    h}v                       % S SK Jr  S SKJrJrJrJrJrJrJ	r	J
r
  S SKJr  S SKJrJr  S SKrS SKJrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SK J!r!  S SK"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:  S S	K;J<r<  S
SK=J>r>  S
SK?J@r@  S
SKAJBrB  S
SKCJDrD  / SQrESrFSrGSrH\
" S\%\25      rI\\3\>\J/S4   rK\R                  " S5      rM\S:S;S jj5       rN\NR                  \#5      S<S j5       rP\NR                  \$5      S=S j5       rQ\NR                  \05      \NR                  \'5      S>S j5       5       rR\NR                  \(5      S?S j5       rS\NR                  \&5      S@S j5       rT\NR                  \)5      SAS j5       rU\NR                  \*5      SBS j5       rV\NR                  \-5      \NR                  \,5      \NR                  \+5      SCS j5       5       5       rW\NR                  \.5      SDS j5       rX\NR                  \15      \NR                  \/5      SES j5       5       rY\NR                  \25      \NR                  \%5      SFS  j5       5       rZ\4SGS! jjr[\4SGS" jjr\SS \4         SHS# jjr] SI       SJS$ jjr^  SI       SKS% jjr_SLSMS& jjr`\F\G\SS'.         SNS( jjraSOS) jrb\F\G\SS'.         SPS* jjrcS+\F\G\H\SS,.             SQS- jjrd\F\G\SS'.         SRS. jjre            SSS/ jrf          STS0 jrg\S4         SUS1 jjrh\F\GSS2.       SVS3 jjri\F\GSS2.       SWS4 jjrj\\\\   4   rkS5\lS6'   \H4SXS7 jjrm\HSS8.     SYS9 jjrng)Z    )annotations)ListIterableIteratorUnionOptionalCallableTypeTypeVar)	TypeAlias)singledispatchpartialN)ABS_TOLVec2Vec3NULLVECZ_AXISOCSBezier3PBezier4PConstructionEllipseBSpline have_bezier_curves_g1_continuityfit_points_to_cad_cvUVecMatrix44)const)
LWPolylinePolylineHatchLineSplineEllipseArcCircleSolidTraceFace3dViewportImageHelixWipeoutMPolygonBoundaryPathsAbstractBoundaryPathPolylinePathEdgePathLineEdgeArcEdgeEllipseEdge
SplineEdge)
DXFPolygon   )Path)Command)tools)group_paths)	make_pathto_linesto_polylines3dto_lwpolylinesto_polylines2d
to_hatchesto_mpolygonsto_bsplines_and_verticesto_splines_and_polylines
from_hatchfrom_hatch_ocsfrom_hatch_boundary_pathfrom_hatch_edge_pathfrom_hatch_polyline_pathfrom_verticesg{Gz?   g-C6?TPolygonezdxfc                :    [        SU R                  5        35      e)u  Factory function to create a single :class:`Path` object from a DXF
entity.

Args:
    entity: DXF entity
    segments: minimal count of cubic Bézier-curves for elliptical arcs
    level: subdivide level for SPLINE approximation

Raises:
    TypeError: for unsupported DXF types

zunsupported DXF type: )	TypeErrordxftype)entitysegmentslevels      F/var/www/html/env/lib/python3.13/site-packages/ezdxf/path/converter.pyr<   r<   ]   s    $ ,V^^-=,>?
@@    c                    [        5       n[        R                  " UU R                  S5      U R                  U R                  5       U R                  R                  UR                  SS5      S9  U$ )NxybrR   r7   closeocs	elevationrR   )	r8   r:   add_2d_polyline
get_pointsclosedrZ   dxfr[   get)
lwpolylinekwargspaths      rT   _from_lwpolylinerd   r   s]    6D	e$NN..**J* KrU   c                   U R                   (       d  U R                  (       a  [        S5      e[        5       n[	        U R
                  5      S:X  a  U$ U R                  (       a$  [        U R                  5       U R                  5      $ U R
                   Vs/ s H  o3R                  S5      PM     nnU R                  5       nU R                  R                  S5      (       a*  [        U R                  R                  5      R                   nO6[        U R
                  S   R                  R"                  5      R                   n[$        R&                  " UUU R                  UUUR)                  SS5      S9  U$ s  snf )Nz-Unsupported DXF type PolyMesh or PolyFaceMeshr   rW   r[   rR   r7   rX   )is_polygon_meshis_poly_face_meshrO   r8   lenverticesis_3d_polylinerJ   points	is_closedformatrZ   r_   hasattrr   r[   zlocationr:   r\   r`   )polylinerb   rc   vertexrk   rZ   r[   s          rT   _from_polyliners      s%   8#=#=GHH6D
8"X__.0B0BCC191B1BC1BvmmE"1BFC
,,.C||K((//022	 **1-11::;==		  J* K! Ds   E7c                    UR                  SS5      n[        5       n[        R                  " X0R	                  5       USS9  U$ )NrS   rK   T)rS   reset)r`   r8   r:   
add_splineconstruction_tool)splinerb   rS   rc   s       rT   _from_splinery      s;     JJw"E6D	T335U$OKrU   c                    UR                  SS5      n[        5       n[        R                  " X0R	                  5       USS9  U$ )NrR   r7   TrR   ru   )r`   r8   r:   add_ellipserw   )ellipserb   rR   rc   s       rT   _from_ellipser~      s:    zz*a(H6D	d557(RVWKrU   c                    [        U R                  R                  5      nUR                  U R                  R                  5        U$ N)r8   r_   startline_toend)linerb   rc   s      rT   
_from_liner      s-    DLLKrU   c                   UR                  SS5      n[        5       n[        U R                  R                  5      nUS:  a~  [
        R                  " U R                  R                  UU R                  R                  U R                  R                  U R                  R                  S9n[        R                  " X5USS9  U$ )NrR   r7   -q=centerradius	extrusionstart_angle	end_angleTr{   )r`   r8   absr_   r   r   from_arcr   r   r   r   r:   r|   )arcrb   rR   rc   r   r}   s         rT   	_from_arcr      s    zz*a(H6D F~%..77>>gg''++gg''
 	$($GKrU   c                0   UR                  SS5      n[        5       n[        U R                  R                  5      nUS:  aT  [
        R                  " U R                  R                  UU R                  R                  S9n[        R                  " X5USS9  U$ )NrR   r7   r   )r   r   r   Tr{   )r`   r8   r   r_   r   r   r   r   r   r:   r|   )circlerb   rR   rc   r   r}   s         rT   _from_circler      sz    zz*a(H6D""#F~%..::$$jj**

 	$($GKrU   c                6    U R                  5       n[        USS9$ NTrY   )wcs_verticesrJ   )solidrb   ri   s      rT   _from_quadrilateralr      s     !!#H..rU   c                X   U R                   (       a  U R                  R                  nUS:w  af  U R                  (       aU  U R                  R                  nU(       a8  U R                  R                  R                  U5      nU(       a  [        U40 UD6$ [        U R                  5       SS9$ )N0Tr   )	has_extended_clipping_pathr_   clipping_boundary_handledocentitydbr`   r<   rJ   clipping_rect_corners)vprb   handledbclipping_entitys        rT   _from_viewportr      sx    	$$00S=RVVB"$&&//"5"5f"="$_???1134@@rU   c                2    [        U R                  5       SS9$ r   )rJ   boundary_path_wcs)imagerb   s     rT   _from_imager      s     002$??rU   c           
        U R                  5       nU R                  R                  R                  n[        n[        U [        5      (       a   U R                  R                  S[        5      n U R                   Vs/ s H  n[        XRX4S9PM     nn[         R"                  " U5      $ s  snf ! [        R                   a.    [        R                  S[        U 5       35        [        5       s $ f = f)Noffset_vector)offsetzinvalid data in )rZ   r_   r[   ro   r   
isinstancer-   r`   pathsrG   r   DXFStructureErrorloggerwarningstrr8   r:   to_multi_path)hatchrb   rZ   r[   r   boundaryr   s          rT   _from_hatchr      s     ))+C		##%%IF%""8 "KK
' %XIM' 	 
 u%%
 "" )#e*67vs$   -B, ;B'B, 'B, ,?C.-C.c              #    #    U R                  5       nU R                  R                  R                  nU R                   H<  n[        XBX1S9nUR                  (       a  UR                  5        Sh  vN   M8  Uv   M>     g N7f)z_Yield all HATCH/MPOLYGON boundary paths as separated :class:`Path` objects in WCS
coordinates.
r[   r   N)rZ   r_   r[   ro   r   rG   has_sub_paths	sub_paths)r   r   rZ   r[   r   ps         rT   rE   rE   	  sa      ))+C		##%%IKK$XiW??{{}$$G   %s   A.B0B 1Bc              #     #    U R                   R                  R                  nU R                   H<  n[	        X2US9nUR
                  (       a  UR                  5        Sh  vN   M8  Uv   M>     g N7f)zYield all HATCH/MPOLYGON boundary paths as separated :class:`Path` objects in OCS
coordinates. Elevation and offset is applied to all vertices.

.. versionadded:: 1.1

r   N)r_   r[   ro   r   rG   r   r   )r   r   r[   r   r   s        rT   rF   rF     sV      		##%%IKK$X6R??{{}$$G   %s   AA2 A0!A2c                   [        U [        5      (       a  [        XU5      nO6[        U [        5      (       a  [	        XU5      nO[        [        U 5      5      eU(       af  Ubc  UR                  UR                  US95      nUR                  [        R                  " UR                  UR                  UR                  5      5      n[        R                   R#                  U R$                  5      Ul        U$ )z]Returns a :class:`Path` object from a :class:`~ezdxf.entities.Hatch`
polyline- or edge path.
ro   )r   r1   rH   r0   rI   rO   typeto_wcsreplace	transformr   	translatexyro   r   BoundaryPathState
from_flagspath_type_flags	user_data)r   rZ   r[   r   r   s        rT   rG   rG   '  s     (H%% 	:	Hl	+	+$XI>X''#/FNNYN78KK**688VXXvxxHI ))44X5M5MNAKHrU   c                    [        5       n[        R                  " UU R                  U R                  U=(       d
    [        5       US9  U$ )zTReturns a :class:`Path` object from a :class:`~ezdxf.entities.Hatch`
polyline path.
)rY   rZ   r[   )r8   r:   r\   ri   rl   r   )rq   rZ   r[   rc   s       rT   rI   rI   A  sA     6D	  L35 KrU   c                  ^^^^^^^^ SU4S jjnSUU4S jjnSUUUU4S jjnSUUU4S jjnSU4S jjmSS jmSUU4S jjmSU4S jjmSU4S	 jjmT(       a  TR                   O[        m[        5       nS
nU  GH/  n	S
n
[        U	[        5      (       a	  U" U	5      n
O[        U	[
        5      (       a&  [        U	R                  5      [        :  a  U" U	5      n
Ot[        U	[        5      (       a-  [        U	R                  5      R                  (       d  U" U	5      n
O2[        U	[        5      (       a	  U" U	5      n
O[        [        U	5      5      eU
c  M  Uc  U
nM  UR                   R#                  U
R$                  5      (       a  UR'                  U
5        GM  UR                   R#                  U
R                   5      (       a"  UR'                  U
R)                  5       5        GMi  UR$                  R#                  U
R                   5      (       a  U
R'                  U5        U
nGM  UR$                  R#                  U
R$                  5      (       a$  UR)                  5       nUR'                  U
5        GM  UR*                  (       a  UR-                  U5        U
nGM  UR'                  U
5        GM2     Ub!  UR/                  5         UR-                  U5        U$ )zQReturns a :class:`Path` object from a :class:`~ezdxf.entities.Hatch`
edge path.

c                   > T" U R                   5      nT" U R                  5      n[        U5      nUR                  U5        U$ r   )r   r   r8   r   )edger   r   segmentwcss       rT   r   "from_hatch_edge_path.<locals>.line\  s7    DJJ$((mu+rU   c                   > U R                   tpn[        R                  " XT4U R                  TU R                  U R
                  S9n[        5       n[        R                  " XTSS9  U$ )Nr   Tru   )	r   r   r   r   r   r   r8   r:   r|   )r   r   r   _r}   r   r[   r   s         rT   r   !from_hatch_edge_path.<locals>.arcc  sb    ;;q
 &..)$;;((nn
 &'$7rU   c           	     *  > U R                  5       n[        T" UR                  R                  [	        T5      S95      T" UR
                  5      UR                  TUR                  UR                  S9n[        5       n[        R                  " X2SS9  U$ )Nr   )r   
major_axisratior   start_param	end_paramTr   )rw   r   r   r   floatr   r   r   r   r8   r:   r|   )r   ocs_ellipser}   r   r[   r   r   wcs_tangents       rT   r}   %from_hatch_edge_path.<locals>.ellipset  s    ,,.
 &{))11E)4D1EF";#9#9:###//!++
 &'$7rU   c                D  > U R                    Vs/ s H  nT" U5      PM     nn[        U5      S:X  a<  U R                   Vs/ s H  nT" U5      PM     nn[        U5      (       a	  T" X5      nO	g T" X5      n[        5       n[        R
                  " XTSS9  U$ s  snf s  snf )Nr   Tr   )control_pointsrh   
fit_pointsr8   r:   rv   )	r   r   r   r   bspliner   from_control_pointsfrom_fit_pointsr   s	         rT   rx   $from_hatch_edge_path.<locals>.spline  s    *.*=*=>*=Q#a&*=>~!#*.//:/Q#a&/J::)$; )$?G&6 ?:s   BBc                   > S nU R                   (       a5  U R                  (       a$  T" U R                   5      T" U R                  5      4n[        UUS9$ )N)tangents)start_tangentend_tangentr   )r   r   r   r   s      rT   r   -from_hatch_edge_path.<locals>.from_fit_points  sQ    $"2"2D../D,,-H $
 	
rU   c                    [        UU R                  S-   U R                  U R                  (       a  U R                  S9$ S S9$ )Nr7   )r   orderknotsweights)r   degreeknot_valuesr   )r   r   s     rT   r   1from_hatch_edge_path.<locals>.from_control_points  sB    )++/""$(LLDLL	
 	
 7;	
 	
rU   c                6   > T" [        U S   U S   T5      5      $ Nr   r7   r   )rr   _wcsr[   s    rT   r   !from_hatch_edge_path.<locals>.wcs  s    DF1Iy9::rU   c                6   > T" [        U S   U S   S5      5      $ r   r   )rr   r   s    rT   r   )from_hatch_edge_path.<locals>.wcs_tangent  s    DF1Iq122rU   c                Z   > T(       a"  TR                   (       a  TR                  U 5      $ U $ r   )r   r   )vec3rZ   s    rT   r   "from_hatch_edge_path.<locals>._wcs  s     3==::d##KrU   N)r   r2   )r   r3   )r   r4   )r   r5   )rr   r   returnr   )r   r   r   r   )uzr   r8   r   r2   r3   r   r   r   r4   r   r   is_nullr5   rO   r   r   iscloser   append_pathreversedrl   extend_multi_pathrY   )edgesrZ   r[   r   r   r}   rx   rc   loopr   next_segmentr   r   r   r   r   r   s    ``        @@@@@@rT   rH   rH   R  s    " $  


; ;3 6I6DD'+dH%%:Lg&&4;;')"4yk**(00&t}j))!$<LDJ''<D88L..//\*XXl..//\2245ZZ 0 011$$T*DZZ 2 233==?D\*~~&&t,#   .U X 

t$KrU   c                (   [         R                  " U 5      n[        U5      S:  a
  [        5       $ [        US   S9nUSS  H6  nUR                  R                  U5      (       a  M%  UR                  U5        M8     U(       a  UR                  5         U$ )z9Returns a :class:`Path` object from the given `vertices`.   r   )r   r7   N)r   listrh   r8   r   r   r   rY   )ri   rY   	_verticesrc   rr   s        rT   rJ   rJ     su    		(#I
9~vil#DAB-xx''LL    

KrU   )distancerR   r   
dxfattribsc             #  x  #    [        U [        5      (       a  U /n O[        U 5      n [        U 5      S:X  a  g[	        U5      n[	        U S   R
                  5      n[        U=(       d    0 5      n[        R                  " U5      (       d,  [        X55      u  pg[        R                  " X5      n XtS'   X4S'   OUR                  S:w  a  UR                  US'   [        R                  " U 5       HK  n[        U5      S:  d  M  [        R                  " US9n	U	R!                  UR#                  X5      SS9  U	v   MM     g7f)u  Convert the given `paths` into :class:`~ezdxf.entities.LWPolyline`
entities.
The `extrusion` vector is applied to all paths, all vertices are projected
onto the plane normal to this extrusion vector. The default extrusion vector
is the WCS z-axis. The plane elevation is the distance from the WCS origin
to the start point of the first path.

Args:
    paths: iterable of :class:`Path` objects
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve
    extrusion: extrusion vector for all paths
    dxfattribs: additional DXF attribs

Returns:
    iterable of :class:`~ezdxf.entities.LWPolyline` objects

r   Nr[   r   r  xy)rm   )r   r8   r  rh   r   r   dictr   r   _get_ocsr:   transform_paths_to_ocsro   single_pathsr   newappend_points
flattening
r   r
  rR   r   r  reference_pointrZ   r[   rc   r   s
             rT   r?   r?     s    4 %U
5zQYI58>>*Oj&B'J>>)$$!)=,,U8"+;"+;			a	"1"3"3
;""5)t9q=*5AOODOOH?OMG	 *s   C8D:><D:c                T    [        U 5      nUR                  U5      R                  nX#4$ r   )r   from_wcsro   )r   r  rZ   r[   s       rT   r  r  +  s'    
i.C_-//I>rU   c             #    #    [        U [        5      (       a  U /n O[        U 5      n [        U 5      S:X  a  g[	        U5      n[	        U S   R
                  5      n[        U=(       d    0 5      n[        R                  " U5      (       d8  [        X55      u  pg[        R                  " X5      n [	        SSU5      US'   X4S'   O*UR                  S:w  a  [	        SSUR                  5      US'   [        R                  " U 5       H\  n[        U5      S:  d  M  [        R                  " US9n	U	R!                  UR#                  X5      5        U	R%                  5         U	v   M^     g7f)u  Convert the given `paths` into 2D :class:`~ezdxf.entities.Polyline`
entities.
The `extrusion` vector is applied to all paths, all vertices are projected
onto the plane normal to this extrusion vector. The default extrusion vector
is the WCS z-axis. The plane elevation is the distance from the WCS origin
to the start point of the first path.

Args:
    paths: iterable of :class:`Path` objects
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve
    extrusion: extrusion vector for all paths
    dxfattribs: additional DXF attribs

Returns:
    iterable of 2D :class:`~ezdxf.entities.Polyline` objects

r   Nr[   r   r  )r   r8   r  rh   r   r   r  r   r   r  r:   r  ro   r  r   r  append_verticesr  
new_seqendr  s
             rT   r@   r@   1  s    4 %U
5zQYI58>>*Oj&B'J>>)$$!)=,,U8"&q!Y"7
;"+;			a	"&q!_->->"?
;""5)t9q=
3AdoohABLLNG *s   DE"AE"T)	edge_pathr
  rR   g1_tolr   r  c             #     #    U(       a  [        [        X#US9nO[        [        X#S9n[        [        XXV5       Sh  vN   g N7f)u  Convert the given `paths` into :class:`~ezdxf.entities.Hatch` entities.
Uses LWPOLYLINE paths for boundaries without curves and edge paths, build
of LINE and SPLINE edges, as boundary paths for boundaries including curves.
The `extrusion` vector is applied to all paths, all vertices are projected
onto the plane normal to this extrusion vector. The default extrusion vector
is the WCS z-axis. The plane elevation is the distance from the WCS origin
to the start point of the first path.

Args:
    paths: iterable of :class:`Path` objects
    edge_path: ``True`` for edge paths build of LINE and SPLINE edges,
        ``False`` for only LWPOLYLINE paths as boundary paths
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve to flatten LWPOLYLINE paths
    g1_tol: tolerance for G1 continuity check to separate SPLINE edges
    extrusion: extrusion vector to all paths
    dxfattribs: additional DXF attribs

Returns:
    iterable of :class:`~ezdxf.entities.Hatch` objects

)r
  rR   r  r
  rR   N)r   build_edge_pathbuild_poly_path_polygon_converterr    )r   r  r
  rR   r  r   r  boundary_factorys           rT   rA   rA   d  sC     B "h&

 #h
 "%)XXXs   :AAAc             #     #    [        [        XS9n[        U=(       d    0 5      nUR                  S[        R
                  5        [        [        XX45       Sh  vN   g N7f)u  Convert the given `paths` into :class:`~ezdxf.entities.MPolygon` entities.
In contrast to HATCH, MPOLYGON supports only polyline boundary paths.
All curves will be approximated.

The `extrusion` vector is applied to all paths, all vertices are projected
onto the plane normal to this extrusion vector. The default extrusion vector
is the WCS z-axis. The plane elevation is the distance from the WCS origin
to the start point of the first path.

Args:
    paths: iterable of :class:`Path` objects
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve to flatten LWPOLYLINE paths
    extrusion: extrusion vector to all paths
    dxfattribs: additional DXF attribs

Returns:
    iterable of :class:`~ezdxf.entities.MPolygon` objects

r   
fill_colorN)r   r"  r  
setdefaultr   BYLAYERr#  r-   )r   r
  rR   r   r  r$  s         rT   rB   rB     sU     : )0() j&B'J,6!%9  s   AA!AA!c                   UR                   (       a  U R                  U5      n[        XS9 Hq  n[        U[        5      (       a5  UR                  UR                  UR                  UR                  5       S9  MM  US   nUSS   H  n	UR                  X5        U	nM     Ms     g U R                  [        R                  " UR                  X45      5      US9  g )N)r  )r   r   r   r   r7   flags)
has_curvesadd_edge_pathrC   r   r   rv   r   r   r   add_lineadd_polyline_pathr   generater  )

boundariesrc   r+  r
  rR   r  r  r   prevr   s
             rT   r!  r!    s     ,,U3	,TAD$(($$#'#6#6;; $

 %  AwabA&&t/D " B 	$$MM$//(=>e 	% 	
rU   c                j    U R                  [        R                  " UR                  X45      5      US9  g )Nr*  )r/  r   r0  r  )r1  rc   r+  r
  rR   s        rT   r"  r"    s/       dooh9: ! rU   c              #    #    [        U[        5      (       a  U/nO[        U5      n[        U5      S:X  a  g [	        U5      nUS   R
                  n[        U=(       d    0 5      n[        R                  " U5      (       d8  [        X55      u  px[        R                  " X5      n[	        SSU5      US'   X6S'   O*UR                  S:w  a  [	        SSUR                  5      US'   UR                  SS5        UR                  SS5        UR                  S[        R                  5        [!        [        R"                  " U5      5       Hv  n	[        U	5      S:X  a  M  U R%                  US	9n
U
R&                  nU	S   nUR)                  5         U" XS5        U	SS   H  nUR)                  5         U" XS5        M     U
v   Mx     g 7f)
Nr   r[   r   
solid_fillr7   pattern_nameSOLIDcolorr  )r   r8   r  rh   r   r   r  r   r   r  r:   r  ro   r'  r   r(  r;   r  r  r   rY   )clsr   add_boundaryr   r  r  _dxfattribsrZ   r[   grouppolygonr1  externalholes                 rT   r#  r#    s     %U
5zQYIAhnnOZ-2.K>>)$$!)=,,U8#'1i#8K #,K 			a	#'1o.?.?#@K <+>737EMM2U//67u:?''['1]]
8Z1-!"IDJJL1-   8s   F>G )r
  rR   r  c             #  v  #    [        U [        5      (       a  U /n [        U=(       d    0 5      n[        R                  US'   [
        R                  " U 5       H\  n[        U5      S:  d  M  [        R                  " US9nUR                  UR                  X5      5        UR                  5         Uv   M^     g7f)ud  Convert the given `paths` into 3D :class:`~ezdxf.entities.Polyline`
entities.

Args:
    paths: iterable of :class:`Path` objects
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve
    dxfattribs: additional DXF attribs

Returns:
    iterable of 3D :class:`~ezdxf.entities.Polyline` objects

r+  r   r  N)r   r8   r  r   POLYLINE_3D_POLYLINEr:   r  rh   r   r  r  r  r  )r   r
  rR   r  rc   r   s         rT   r>   r>     s     ( %j&B'J44Jw""5)t9q=
3AdoohABLLNG *s   A&B9,AB9c             #  F  #    [        U [        5      (       a  U /n [        U=(       d    0 5      nSn[        R                  " U 5       HU  n[        U5      S:X  a  M  UR                  X5       H*  nUc  UnM
  XCS'   XcS'   [        R                  " US9v   UnM,     SnMW     g7f)uV  Convert the given `paths` into :class:`~ezdxf.entities.Line` entities.

Args:
    paths: iterable of :class:`Path` objects
    distance:  maximum distance, see :meth:`Path.flattening`
    segments: minimum segment count per Bézier curve
    dxfattribs: additional DXF attribs

Returns:
    iterable of :class:`~ezdxf.entities.Line` objects

Nr   r   r   r  )	r   r8   r  r:   r  rh   r  r!   r  )r   r
  rR   r  prev_vertexrc   rr   s          rT   r=   r=   0  s     & %j&B'JK""5)t9>ooh9F"$"-w &u((j11 K :  *s   BB!r   	PathPartsc              #    ^^^	^
#    SSK Jm	  U
4S jnUU	U4S jn/ n[        R                  " U /5       H  n U R                  nU  H  nUR
                  [        R                  :X  a"  [        XVR                  UR                  /5      nO}UR
                  [        R                  :X  a-  [        XVR                  UR                  UR                  /5      nO2UR
                  [        R                  :X  a  XVR                  4nO[         eUR#                  U5        UR                  nM     M     / m/ m
U H  n[%        U[&        5      (       a9  T(       a  U" 5        Sh  vN   TR)                  5         T
R#                  U5        MQ  T
(       a  U" 5       v   T
R)                  5         TR#                  U5        M     T(       a  U" 5        Sh  vN   T
(       a
  U" 5       v   gg N N7f)uQ  Convert a :class:`Path` object into multiple cubic B-splines and
polylines as lists of vertices. Breaks adjacent Bèzier without G1
continuity into separated B-splines.

Args:
    path: :class:`Path` objects
    g1_tol: tolerance for G1 continuity check

Returns:
    :class:`~ezdxf.math.BSpline` and lists of :class:`~ezdxf.math.Vec3`

r   )bezier_to_bsplinec                 T   > TS   S   /n T H  nU R                  US   5        M     U $ r   )append)rk   r   rq   s     rT   to_vertices-to_bsplines_and_vertices.<locals>.to_verticesg  s2    1+a.!DMM$q'" rU   c               3     >#    TS   n U /nTSS   H5  n[        XT5      (       a  UR                  U5        OT" U5      v   U/nUn M7     U(       a  T" U5      v   g g 7fr   )r   rH  )b1_g1_continuity_curvesb2bezierrF  r  s      rT   
to_bspline,to_bsplines_and_vertices.<locals>.to_bsplinem  sq     AY!#*B/??%,,R0'(=>>)+%B  !#$9:: !s   AAN)
ezdxf.mathrF  r:   r  r   r   r9   	CURVE3_TOr   ctrlr   	CURVE4_TOr   ctrl1ctrl2LINE_TO
ValueErrorrH  r   tupleclear)rc   r  rI  rP  curvesr2  cmdcurverO  rF  rq   s    `      @@@rT   rC   rC   X  se     -; F""D6*zzCxx7,,, $#''!:;W... $		399cgg!FGW__,ww  MM% 77D  + FHeU##%<''OOE"!m# MM%   <m  ( 	 s%   EG"GA-G"G G" G")r  r  c             #    #    [        U [        5      (       a  U /n [        U=(       d    0 5      n[        R                  " U 5       H  n[        X15       H  n[        U[        5      (       a+  [        R                  " US9nUR                  U5        Uv   MC  [        U5      n[        R                  US'   [        R                  " US9nUR                  U5        UR                  5         Uv   M     M     g7f)a<  Convert the given `paths` into :class:`~ezdxf.entities.Spline` and 3D
:class:`~ezdxf.entities.Polyline` entities.

Args:
    paths: iterable of :class:`Path` objects
    g1_tol: tolerance for G1 continuity check
    dxfattribs: additional DXF attribs

Returns:
    iterable of :class:`~ezdxf.entities.Line` objects

r  r+  N)r   r8   r  r:   r  rC   r   r"   r  apply_construction_toolr   rA  r   r  r  )r   r  r  rc   datarx   attribsrq   s           rT   rD   rD     s     $ %j&B'J""5),T:D$((z:..t4z*#(#=#= #<<:>((.##% ; *s   C4C6)r7   rK   )rR   intrS   rc  r   r8   )ra   r   r   r8   )rq   r   r   r8   )rx   r"   r   r8   )r}   r#   r   r8   )r   r!   r   r8   )r   r$   r   r8   )r   r%   r   r8   )r   z'Solid'r   r8   )r   z
'Viewport'r   r8   )r   z'Image'r   r8   )r   r    r   r8   )r   r6   r   r   r   zIterator[Path])
r   r/   rZ   Optional[OCS]r[   r   r   r   r   r8   )Nr   )rq   r0   rZ   rd  r[   r   r   r8   )r  r1   rZ   rd  r[   r   r   r8   )F)ri   zIterable[UVec]r   r8   )
r   Iterable[Path]r
  r   rR   rc  r   r   r   zIterator[LWPolyline])r   r   r  r   r   ztuple[OCS, float])
r   re  r
  r   rR   rc  r   r   r   Iterator[Polyline])r   re  r  boolr
  r   rR   rc  r  r   r   r   r   zIterator[Hatch])
r   re  r
  r   rR   rc  r   r   r   zIterator[MPolygon])r1  r.   rc   r8   r+  rc  r
  r   rR   rc  r  r   )
r1  r.   rc   r8   r+  rc  r
  r   rR   rc  )
r9  zType[TPolygon]r   re  r:  BoundaryFactoryr   r   r   zIterator[TPolygon])r   re  r
  r   rR   rc  r   rf  )r   re  r
  r   rR   rc  r   zIterator[Line])rc   r8   r  r   r   zIterator[PathParts])r   re  r  r   r   z!Iterator[Union[Spline, Polyline]])o
__future__r   typingr   r   r   r   r   r	   r
   r   typing_extensionsr   	functoolsr   r   loggingrR  r   r   r   r   r   r   r   r   r   r   r   r   r   r   ezdxf.lldxfr   ezdxf.entitiesr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   ezdxf.entities.polygonr6   rc   r8   commandsr9    r:   nestingr;   __all__MAX_DISTANCEMIN_SEGMENTSG1_TOLrL   rc  rh  	getLoggerr   r<   registerrd   rs   ry   r~   r   r   r   r   r   r   r   rE   rF   rG   rI   rH   rJ   r?   r  r@   rA   rB   r!  r"  r#  r>   r=   rD  __annotations__rC   rD    rU   rT   <module>r|     s   #	 	 	 ( -            4 .     $ 	:uh/M45t;<			7	# A A( J
  
 H < E
F   G  D  C   F  F
E
E/   /
 HA A G
E@  @ H
E&  && 29  6= $ 	"	  	
 
6 KL!.BG	& VV	V V 
	Vr" # // / 	/
 / /d # 00 0 	0
 0 0l " ,Y,Y ,Y 	,Y
 ,Y ,Y ,Y ,Yd # %% % 	%
 % %P



 
 	

 
 
8
  	
 $ '	'' "' 	' 'Z #   	 H # "" " 	" "J Wd4j01	9 1 :@ CR 	"" "
 '"rU   