7
7
from ezdxf .entities import factory
8
8
from OCP .GeomConvert import GeomConvert
9
9
from OCP .gp import gp_Dir
10
+ from typing_extensions import Self
10
11
11
12
from ...cq import Face , Plane , Workplane
12
13
from ...units import RAD2DEG
13
14
from ..shapes import Edge
14
15
from .utils import toCompound
15
16
16
17
ApproxOptions = Literal ["spline" , "arc" ]
17
- DxfEntityAttributes = Tuple [str , Dict [str , Any ]]
18
+ DxfEntityAttributes = Tuple [
19
+ Literal ["ARC" , "CIRCLE" , "ELLIPSE" , "SPLINE" ,], Dict [str , Any ]
20
+ ]
18
21
19
22
20
23
class DxfDocument :
@@ -64,7 +67,7 @@ def __init__(
64
67
metadata : Union [Dict [str , str ], None ] = None ,
65
68
approx : Optional [ApproxOptions ] = None ,
66
69
tolerance : float = 1e-3 ,
67
- ) -> None :
70
+ ):
68
71
"""Initialize DXF document.
69
72
70
73
:param dxfversion: :attr:`DXF version specifier <ezdxf-stable:ezdxf.document.Drawing.dxfversion>`
@@ -106,7 +109,7 @@ def __init__(
106
109
107
110
def add_layer (
108
111
self , name : str , * , color : int = 1 , linetype : str = "CONTINUOUS"
109
- ) -> "DxfDocument" :
112
+ ) -> Self :
110
113
"""Create a layer definition
111
114
112
115
Refer to :ref:`ezdxf layers <ezdxf-stable:layer_concept>` and
@@ -120,7 +123,7 @@ def add_layer(
120
123
121
124
return self
122
125
123
- def add_shape (self , workplane : Workplane , layer : str = "" ) -> "DxfDocument" :
126
+ def add_shape (self , workplane : Workplane , layer : str = "" ) -> Self :
124
127
"""Add CadQuery shape to a DXF layer.
125
128
126
129
:param workplane: CadQuery Workplane
0 commit comments