Previous topic

decorators

Next topic

homcoord

This Page

dxf2img

Rasters (simple) .dxf files to bitmap images :requires: dxfgrabber and pil

dxf2img.rint(x)[source]
class dxf2img.BBox(pt1=None, pt2=None)[source]

bounding box

__init__(pt1=None, pt2=None)[source]
__iadd__(pt)[source]
__repr__()[source]
__call__()[source]
Returns:list of flatten corners
size()[source]
Returns:Pt with xy sizes
center()[source]
Returns:Pt center
trans(trans)[source]
Parameters:trans – Xform
Returns:BBox = self transformed by trans
dxf2img.cbox(c, r)[source]

bounding box of a circle :param c: Pt center :param r: float radius :return: BBox

dxf2img.Trans(scale=1, offset=[0, 0], rotation=0)[source]
class dxf2img.DXF(file, layers=None, ignore=[])[source]

reads a .dxf file :param file: string path to .dxf file to read :param layers: list or dictionary of layers to handle. Empty = all layers :param ignore: list of strings of entity types to ignore

__init__(file, layers=None, ignore=[])[source]

reads a .dxf file :param file: string path to .dxf file to read :param layers: list or dictionary of layers to handle. Empty = all layers :param ignore: list of strings of entity types to ignore

entities(ent=None)[source]

iterator over dxf or block entities

bbox()[source]
Returns::class:BBox dwg enclosing bounding box
img(size=[256, 256], back='white', pen='black', border=5, antialias=1)[source]
Result :PIL:Image rasterized image
dxf2img.img2base64(img, fmt='PNG')[source]
Parameters:imgPIL:Image
Result :string base64 encoded image content in specified format
See :http://stackoverflow.com/questions/14348442/django-how-do-i-display-a-pil-image-object-in-a-template