1- # Copyright (c) 2020-2022 , Manfred Moitzi
1+ # Copyright (c) 2020-2025 , Manfred Moitzi
22# License: MIT License
33from __future__ import annotations
44from typing import TYPE_CHECKING , Iterable , Union
@@ -84,8 +84,7 @@ def virtual_polyline2d_entities(
8484 return
8585
8686 points = [
87- (v .dxf .location .x , v .dxf .location .y , v .dxf .bulge )
88- for v in polyline .vertices
87+ (v .dxf .location .x , v .dxf .location .y , v .dxf .bulge ) for v in polyline .vertices
8988 ]
9089 if polyline .is_closed :
9190 points .append (points [0 ])
@@ -103,8 +102,8 @@ def _virtual_polyline_entities(
103102 points , elevation : float , extrusion : Vec3 , dxfattribs : dict , doc
104103) -> Iterable [Union [Line , Arc ]]:
105104 ocs = OCS (extrusion ) if extrusion else OCS ()
106- prev_point = None
107- prev_bulge = None
105+ prev_point : Vec3 | None = None
106+ prev_bulge : float = 0.0
108107
109108 for x , y , bulge in points :
110109 point = Vec3 (x , y , elevation )
@@ -114,9 +113,9 @@ def _virtual_polyline_entities(
114113 continue
115114
116115 attribs = dict (dxfattribs )
117- if prev_bulge != 0 :
116+ if prev_bulge != 0.0 :
118117 center , start_angle , end_angle , radius = bulge_to_arc (
119- prev_point , point , prev_bulge # type: ignore
118+ prev_point , point , prev_bulge
120119 )
121120 if radius > 0 :
122121 attribs ["center" ] = Vec3 (center .x , center .y , elevation )
@@ -225,9 +224,7 @@ def virtual_polyface_entities(polyline: Polyline) -> Iterable[Face3d]:
225224 invisible = 0
226225 pos = 1
227226 indices = (
228- (face .dxf .get (name ), name )
229- for name in VERTEXNAMES
230- if face .dxf .hasattr (name )
227+ (face .dxf .get (name ), name ) for name in VERTEXNAMES if face .dxf .hasattr (name )
231228 )
232229 for index , name in indices :
233230 # vertex indices are 1-based, negative indices indicate invisible edges
0 commit comments