ezdxf icon indicating copy to clipboard operation
ezdxf copied to clipboard

drawing: the configuration.pdmode / pdsize values are ignored

Open bdaniere opened this issue 2 years ago • 2 comments

Hello,

I have converted DWG files to SVG format using addons.drawing (I have also tested conversion to raster output formats such as .png)

On some files, including sample.zip , I have some problems with the rendering of HATCH entities: some HATCH entities (for example the entity with the handle "FBE37") are composed of several points but their geometrical representation makes the whole more difficult to read I tried to modify the configuration by changing the config.pdmode but this information is not taken into account

Is this approach correct to change the representation of the point entities on the final render? (the goal is to change the pdmode value when converting from 32 (the default value) to 0)

To Reproduce

    from ezdxf.addons import odafc
    from ezdxf.addons.drawing.matplotlib import qsave
    from ezdxf.addons.drawing.config import Configuration

    doc = odafc.readfile("sample.dxf")

    config = Configuration.defaults()
    config = config.with_changes(
        pdmode=0,

    )

    qsave(
        layout=doc.modelspace(),
        filename="1344465490_convert.svg",
        bg="#FFFFFF00",
        config = config
    )

I work with Ubuntu 22.04.01 LTS / I tested with the latest versions of ezdxf (0.18)

On the left the visual of the area on the DXF file, on the right the rendering on the svg conversion :

Capture d’écran du 2022-08-30 09-51-24

Expected behavior

I would like the gemetric representation of point entities to be center dot (.) , and not a center dot (.) + circle (nb : The value of configuration.pdsize is also ignored)

bdaniere avatar Aug 30 '22 08:08 bdaniere

This seems to be an issue of the Matplotlib backend. The points are drawn by the Frontend as dimensionless points and the Matplotlib-backend adds them by self.ax.scatter([pos.x], [pos.y], s=0.1, ...) to the Axes instance:

image

image

But the savefig() method exports circles as shown by your screenshots.

There must be a setting in matplotlib to prevent this, but I'm not aware of it.

mozman avatar Aug 31 '22 03:08 mozman

BTW: Using the POINT entity to create a "hatching" is really a hack and shouldn't be used, because they are dimensionless and the displayed result is not really defined, except by the assigned lineweight which is also ambiguous for a dimensionless point.

mozman avatar Aug 31 '22 03:08 mozman

There was really an error in the default configuration of the drawing add-on, this doesn't solve the rendering of circles by matplotlib but you can suppress POINT rendering at all. See issue #765 if this is a solution for you.

config=config.with_changes(pdmode=1)  # do not plot any point geometry

mozman avatar Nov 06 '22 16:11 mozman