-1

When I try to set up a text style inside a BLOCK, TrueView stops with an error. If I remove the style line the DXF is accepted

doc = ezdxf.new(dxfversion="AC1024")
#...
device = doc.blocks.new(name='device')
device.add_text("eBCON",
         dxfattribs={
            #'style': 'LiberationSerif', # 
             'height': 8}
         ).set_pos((marg+margxdev+2, marg+margydev+2), align='LEFT')

Its an Autocad limitation or a non implemented feature in ezDXF?

I have no full Autocad available for checking...

Antoni Gual Via
  • 714
  • 1
  • 6
  • 14

1 Answers1

1

Any text style you want to use must be defined in the DXF document's style table. The only text style defined by default is Standard. I suspect you copied your code from an example or the documentation without reading the rest.

The part you're missing is the setup=True argument in the ezdxf.new() function:


doc = ezdxf.new(dxfversion="AC1024", setup=True)

This creates some text styles, including LiberationSerif.

Tutorial for the TEXT entity: https://ezdxf.mozman.at/docs/tutorials/text.html

mozman
  • 2,001
  • 8
  • 23