Exemple #1
0
    def draw_elliptic_arc_entity(self, entity: DXFGraphic,
                                 properties: Properties) -> None:
        dxftype = entity.dxftype()
        if NULLVEC.isclose(entity.dxf.extrusion):
            self.skip_entity(
                f'Invalid extrusion (0, 0, 0) in entity: {str(entity)}')
            return

        if dxftype == 'CIRCLE':
            if entity.dxf.radius <= 0:
                self.skip_entity(f'Invalid radius in entity: {str(entity)}')
                return
            path = Path.from_circle(cast('Circle', entity))
        elif dxftype == 'ARC':
            if entity.dxf.radius <= 0:
                self.skip_entity(f'Invalid radius in entity: {str(entity)}')
                return
            path = Path.from_arc(cast('Arc', entity))
        elif dxftype == 'ELLIPSE':
            if NULLVEC.isclose(entity.dxf.major_axis):
                self.skip_entity(
                    f'Invalid major axis (0, 0, 0) in entity: {str(entity)}')
                return

            path = Path.from_ellipse(cast('Ellipse', entity))
        else:  # API usage error
            raise TypeError(dxftype)
        self.out.draw_path(path, properties)
Exemple #2
0
 def draw_elliptic_arc_entity(self, entity: DXFGraphic,
                              properties: Properties) -> None:
     dxftype = entity.dxftype()
     if dxftype == 'CIRCLE':
         path = Path.from_circle(cast('Circle', entity))
     elif dxftype == 'ARC':
         path = Path.from_arc(cast('Arc', entity))
     elif dxftype == 'ELLIPSE':
         path = Path.from_ellipse(cast('Ellipse', entity))
     else:  # API usage error
         raise TypeError(dxftype)
     self.out.draw_path(path, properties)