Skip to content

Canvas Template

The template_canvas is the region of the Template that is typically used to accommodate the drawing itself.


Canvas Partition

The Canvas Partition is essential for robustly rebranding drawings. It involves specifying the positioning of the canvas of the input drawing and the placement of additional cells.

  • Positioning of Canvas: Clearly define where the canvas of the input drawing should be positioned within the template.
  • Placement of Additional Cells: Determine the locations where additional cells can be placed. Ensure that these regions are adequately sized. If the regions are too small, the resulting file will be scaled up to accommodate the cells.

Multiple Regions for Additional Cells

You have the flexibility to specify multiple regions for the additional cells. This is achieved by creating a list of colors and incorporating them into the template.

Example:

W24SheetRebrandingCanvasPartition(
    canvas_color=Color((97, 12, 43)),
    additional_cells_colors=[Color((37, 26, 0)), Color((64, 45, 0))],
)

Additional Cells

Additional Cells in the rebranding process can be categorized into two types:

  1. pixel_copied
  2. text_copied

Pixel Copied Cells

Cells are pixel_copied in the following situations:

  • The OCR (Optical Character Recognition) process yields low confidence scores.
  • The OCR process identifies a script for which no corresponding font is available.

This approach ensures that cells containing symbols or complex graphics are copied without any loss of quality.

Text Copied Cells

In all other scenarios, cells are text_copied. This method is used when the cell content is clearly recognizable and can be converted to text.

Comparison Table

Input Output

Color Cells

Color Cells in the rebranding process are used to designate specific positions on the template where text needs to be injected. These cells offer flexibility in terms of the choice of color and text.

Note

Use different colors
Make sure that selected the color cells have different colors. Otherwise the selected cells can not be detected and rebranded.

Customization Options

  • Color and Text: You have the freedom to choose any color and text for the Color Cells.
  • Font Map and Alignment: Each cell's font map and alignment can be customized. If not specified, the default color_cell_fonts will be used.

Alignment and Reading Direction

Current implementation does not differentiate based on the reading direction of the script. This means:

  • Scripts like Latin (left-to-right)
  • Hebrew (right-to-left)
  • Hanzi (top-to-bottom)

will all follow the same alignment settings.

Example Usage

W24SheetRebrandingColorCell(
    color=Color((1, 30, 45)),
    text="<DRAWING_NUMBER>",
    vertical_alignment=W24AlignmentVertical.CENTER,
    horizontal_alignment=W24AlignmentHorizontal.CENTER,
    font_map=W24FontMap(
        font_map={
            W24Alphabet.LATIN: W24Font(font_family="CourierPrime", font_size=10),
            W24Alphabet.HEBREW: W24Font(font_family="NotoSansHebrew", font_size=10),
        }
    ),
)

Suppress Cell Types

The suppress_cell_types attribute in the configuration allows you to suppress specific cell types in the rebranding process. This means that these cell types, if recognized in the original drawing, will not be copied over to the additional fields.

  • Current Status: As of now, there is no public documentation detailing the cell types supported by Werk24.
  • Ongoing Development: Werk24 is actively working on revising the naming convention of cell types, with a focus on improving support for corporate drawings. Therefore, the field names might undergo changes in future updates.

Default Values

For the time being, the following default values are set for suppress_cell_types:

suppress_cell_types = {
    # General Blocks
    "approval_block/*",
    "bom_block/*",
    "reference_block/*",
    "revision_block/*",
    # Identifiers
    # This includes project name etc.
    "identifier/name/*",
    "identifier/number/*",
    # Telling attributes
    "address/*",
    "cage_codes",
    "copyright",
    "department",
    "filename_drawing",
    "filename_model",
    "owner",
    "logo",
    # Standard info that you would inject into the
    # color cells.
    "designation",
    "drawing_number",
    "part_number",
    "material",    
    # Misc.
    "software",
    "sheet_number",
    "scale",
    "version",
    "paper_size",
}