0

I'm using ezDXF to generate electrical schematics, using as a base a file of blocks made in AutoCAD, saved in DXF format. I import the blocks and styles to the schematics DXF using the importer, then create different pages where I insert the blocks. The only problem is the attributes in the blocks loose the styles iI have created them with. The plain texts in blocks retain the style but not the attributes. I have checked the generated DXF with the DXF browser that comes with ezDXF, and the styles are there in their table.

Here is the relevant part of the code.

What I have missed?

sdoc = ezdxf.readfile('bloquesteruel.dxf')
doc = ezdxf.new(dxfversion="AC1024",setup=True)
importer = Importer(sdoc, doc)
misbloques=['cajetin0']
importer.import_blocks(misbloques)
importer.import_tables('styles','*')
.....
#create a page
doc.layouts.rename('Layout1','Pagina1')
pag1=doc.layouts.get('Pagina1')
pag1.page_setup(size=(ANCHO, ALTO), margins=(0, 0, 0, 0), units='mm', offset=(0, 0), rotation=0,name='Pag1')
datosobra={
   'OBRA':'Mi obra',
  # lots of attributes here
'MODIFICACION':'a.g.v.'}
pag1.add_auto_blockref('cajetin0',(0,0),datosobra)
....
importer.finalize()
doc.saveas(out_file)
Antoni Gual Via
  • 714
  • 1
  • 6
  • 14

0 Answers0