options: add placement options for din-6771

This commit is contained in:
Laurier Loiselle 2023-03-29 16:29:40 -04:00
parent b5720b23fd
commit e4a4e7d188
No known key found for this signature in database
GPG Key ID: 345920CC72089A3F
6 changed files with 40 additions and 13 deletions

View File

@ -23,6 +23,7 @@ metadata:
notes: |
<ol>
<li> <b> NO BOM by config! WOW! </b> </li>
<li> Wire color is a recommendation</li>
<li> Label harnesses with text given in diagram</li>
<li> Label every connector to match the designation in the drawing</li>
@ -30,6 +31,10 @@ metadata:
<li> Cover all cables with 1/2" or 1/8" black sleeving as required. Make it very long for wrapping test</li>
</ol>
options:
show_bom: False
notes_on_right: False
templates: # defining templates to be used later on
- &molex_f

View File

@ -36,4 +36,4 @@ connections:
- X3: [1-4]
options:
notes_to_right: False
notes_on_right: False

View File

@ -53,18 +53,21 @@
height: 400mm;
}
/* custom count of rows depending on the sheetsize */
{% if not show_bom %}
{% set bottom_rows = titleblock_rows + 1 %}
{% elif sheetsize == 'A4' %}
{% set bottom_rows = bom_rows + titleblock_rows + 1 %}
{% else %}
{% set bottom_rows = [bom_rows, titleblock_rows]|max + 1 %}
{% endif %}
#diagram {
position: relative;
top: 0;
left: 0;
max-width: 100%;
{% if sheetsize == 'A4' %}
height: calc(100% - {{ [bom_rows, 13, ]|sum }} * 4.25mm);
{% else %}
height: calc(100% - {{ [bom_rows, 13]|max }} * 4.25mm);
{% endif %}
/* TODO: auto-adapt to height of title block + BOM table;
BOM table might be above (A4) or to the left (A3 and larger) of the title block */
height: calc(100% - {{ bottom_rows }} * 4.25mm);
text-align: center;
vertical-align: middle;
}
@ -105,9 +108,14 @@
{{ diagram }}
</div>
{% if show_notes %}
{{ notes }}
{% endif %}
{% if show_bom %}
{{ bom }}
{% endif %}
{{ titleblock }}
</div> <!-- /frame -->
</div> <!-- /page -->

View File

@ -1,17 +1,25 @@
<style>
.A4 #notes { /* NOTES on top of BOM */
position: absolute;
{% if show_bom %}
bottom: calc({{ titleblock_rows + bom_rows + 2 }} * 4.25mm);
{% else %}
bottom: calc({{ titleblock_rows + 1 }} * 4.25mm);
{% endif %}
right: 0;
}
.A3 #notes, .A2 #notes { /* NOTES on top of title block */
position: absolute;
{% if notes_to_right %}
{% if notes_on_right %}
bottom: calc({{ titleblock_rows + 1 }} * 4.25mm);
right: 0;
{% else %}
{% if show_bom %}
bottom: calc({{ bom_rows + 1 }} * 4.25mm);
{% else %}
bottom: 0;
{% endif %}
left: 0;
{% endif %}
}
@ -26,7 +34,7 @@
}
.A3 #notes, .A2 #notes {
width:80mm;
width: {{ notes_width }};
word-wrap: break-word;
white-space: normal;
}

View File

@ -422,7 +422,10 @@ class BomEntry:
@dataclass
class Options:
fontname: PlainText = "arial"
notes_to_right: bool = True
show_bom: bool = True
show_notes: bool = True
notes_on_right: bool = True
notes_width: str = "100mm"
bgcolor: SingleColor = "WH" # will be converted to SingleColor in __post_init__
bgcolor_node: SingleColor = "WH"
bgcolor_connector: SingleColor = None

View File

@ -107,7 +107,10 @@ def generate_html_output(
"generator": f"{wireviz.APP_NAME} {wireviz.__version__} - {wireviz.APP_URL}",
"fontname": options.fontname,
"bgcolor": options.bgcolor.html,
"notes_to_right": options.notes_to_right,
"show_bom": options.show_bom,
"show_notes": options.show_notes,
"notes_on_right": options.notes_on_right,
"notes_width": options.notes_width,
"diagram": svgdata,
"sheet_current": sheet_current,
"sheet_total": sheet_total,