'How to fix block reference scaling EZDXF

The png does not look like the DXF. I want the png to look like the DXF. The scaling is off and I'm trying to determine what to do to fix it. Screen shot of rack on PNG and Screen shot of rack on DXF

    def create_rack(self, height):
        name = self.unique_block_name('RACK')
        self.model_space.select_rack = self.drawing.blocks.new(name)
        width = .5
        self.model_space.select_rack.add_lwpolyline([(-0.5, -0.5), (0.5, -0.5), (0.5, 0.5), (-0.5, 0.5), (-0.5, -0.5)])
        self.model_space.select_rack.add_lwpolyline([(-0.5, 0.5, width, width), (-0.5, -0.5)])
        self.model_space.select_rack.units = units.M
        return name

    def to_png(self, filename=None):
        if filename is None:
            filename = self.filename
        matplotlib.qsave(layout=self.model_space,
                         filename=filename,
                         dpi=1000,
                         bg='#FFFFFF')

    def draw_select_rack(self, shape):
        orient = shape.orient
        self.model_space.add_blockref(
            self.create_select_rack(shape.length),
            (center(shape)),
            dxfattribs={
                    'lineweight': 100,
                    'color': 52,
                    'xscale': shape.depth,
                    'yscale': shape.length,
                    'rotation': orient,
                    'layer': shape.layer}
        )


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source