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')