Shapes Management


from dxfwrite import DXFEngine
dwg = DXFEngine.drawing('newdrawing.dxf')

How to create new Shapes?

Shapes like LINE or CIRCLE will be created by the DXFEngine object. A new created shape is not automatically added to the drawing, this is done by the Drawing.add() method of the Drawing object.

line = DXFEngine.line( (0, 0), (1, 1) )

See also

DXFEngine for available entities

How to set/get DXF attributes?

This is common to all basic DXF entities (not valid for composite entities):

# as keyword arguments
line = DXFEngine.line((0,0), (1,1), layer='TESTLAYER', linetype='DASHED', color=1)

# or:
line['layer'] = 'TESTLAYER'
line['linetype'] = 'DASHED'
line['color'] = 1

Where should the shapes be placed?

  1. You can add the shapes to the drawing, which means adding the shape to the model space:

    line = DXFEngine.line((0, 0), (1, 1))
  2. You can add the shape explicit to the model space of the drawing:

  3. You can add the shape to the paper space (layout) of the drawing:



The DXF R12 Standard supports only one paper space (layout).

  1. You can add the shape to a BLOCK definition entity:

    blockdef = DXFEngine.block('testblk')