0

I wrote code which creates closed polyline - rectangle, and now I want to make that rectangle a region, with a EZDXF add-on.

I managed to make a region, but it doesn't recognize the polygon I drew, so it makes that region at basepoint (0,0,0) and it is without an area (so blank region - entity).

Here's the code:

import ezdxf



y1=25

y2=-50

x1=30

a1=(x1,y1)

a2=(-x1,y1)

a3=(x1,y2)

a4=(-x1,y2)


doc = ezdxf.new('R2010') 
msp = doc.modelspace() 


SoilModel=msp.add_polyline2d([(a1), (a2), (a4), (a3)], {'layer': 'SoilModel'}) 

SoilModel.close(True, True)   


msp.add_region(ezdxf.entities.Polyline(SoilModel))

doc.saveas('SoilModel.dxf')
Stewbob
  • 16,759
  • 9
  • 63
  • 107
  • REGION is an embedded ACIS entity and creating ACIS entities is not supported by ezdxf. For more information about DXF & ACIS entities see also: https://stackoverflow.com/questions/66272618/how-i-can-parse-nurbs-surface-from-dxf-file-or-do-you-know-libraryfor-js-if-e – mozman Apr 12 '21 at 02:40
  • Thank you, I can see that I'll need a workaround in order to create a region. – Stefan Kordic Apr 20 '21 at 08:19

0 Answers0