Renderer

class qsketchmetric.renderer.Renderer(input_parametric_path, output_rendered_object, variables=None, offset=(0, 0), accuracy=3)

Bases: object

Parameters:
  • input_parametric_path (Path) – Path to the parametric file intended for rendering.

  • output_rendered_object (Drawing) – A pre-initialized ezdxf.document.Drawing drawing object. You can initialize such an object using methods like ezdxf.readfile() or ezdxf.new() By providing an already existing drawing, users can merge multiple visual elements into a singular representation.

  • variables (dict[str, float] | None) – (Optional) Supplementary constant variables that can enhance the mathematical representations used. Defaults to an empty dictionary.

  • offset (tuple[int, int]) – (Optional) Provides offsets for the parametric visualization. Defaults to (0, 0).

  • accuracy (int) – (Optional) The precision used for calculations, represented by the number of decimal places. Defaults to 3.

The Renderer class interprets parametric DXF files, transforming them into visual representations.

Warning

Remember to make sure that the output and input DXF files are configured in the same units

See also

ezdxf Documentation - A comprehensive library to manage DXF drawings, allowing users to read, write, and modify DXF content efficiently.

get_bb_dimensions(custom_msp=None)

Retrieve the bounding box dimensions of the output DXF.

This method calculates the width and height of the bounding box that encompasses all entities within the given Model Space (MSP) or defaults to the output MSP if none is provided.

Parameters:

custom_msp – The Model Space to calculate bounding box dimensions for. Defaults to output_msp.

Returns:

A tuple containing the width and height of the bounding box.

Return type:

tuple[float, float]

render()

The main method of the Renderer class. Transforms the input parametric DXF drawing and produces a rendered output on the output DXF.

Returns:

A dictionary containing rendered points marked in the parametric drawing.

Return type:

dict[str, tuple[float, float]]