skip ARC, CIRCLES and bulge of polylines with radius <= 0, fixes
@@ -151,7 +151,10 @@ def virtual_block_reference_entities(block_ref: 'Insert',
except NonUniformScalingError:
dxftype = entity.dxftype()
if dxftype in {'ARC', 'CIRCLE'}:
+ if entity.dxf.radius > 0:
yield Ellipse.from_arc(entity).transform(m)
+ else:
+ skipped_entity_callback(entity, f'Invalid radius in entity {str(entity)}.')
elif dxftype in {'LWPOLYLINE', 'POLYLINE'}: # has arcs
yield from transform(entity.virtual_entities())
else:
@@ -314,6 +317,7 @@ def _virtual_polyline_entities(points, elevation: float, extrusion: Vector, dxfa
attribs = dict(dxfattribs)
if prev_bulge != 0:
center, start_angle, end_angle, radius = bulge_to_arc(prev_point, point, prev_bulge)
+ if radius > 0:
attribs['center'] = Vector(center.x, center.y, elevation)
attribs['radius'] = radius
attribs['start_angle'] = math.degrees(start_angle)
