Performing subtract operation between square hatches

150 views Asked by At

I am able to write dxf file using Python ezdxf function which can generate a square. But I want to draw another smaller square and want to to subtract it from bigger square to get an annular ring. How can I do that using ezdxf function?

Here is my code which can generate square hatch using ezdxf and write it into a DXF file.

import ezdxf

doc = ezdxf.new("R2010")  # create a new DXF drawing (AutoCAD 2010)
msp = doc.modelspace()  # we are working in model space

msp.add_line((10, 10), (0, 10))
msp.add_line((0, 10), (0, 0))
msp.add_line((0, 0), (10, 0))
msp.add_line((10, 0), (10, 10))

doc.saveas("hatch_with_spline_edge.dxf")  # save DXF drawing 
0

There are 0 answers