Skip to main content

Module svg

Module svg 

Source
Expand description

The sheet’s SVG output contract.

One file per sheet. The paper is the viewBox — 0 0 <width> <height> in millimetres, with width / height carrying the mm unit, so the file prints at its real size. The paper’s furniture comes first as one <g class="sheet-frame"> (the border, the title block’s rules and its text), then each placed view is one <g> carrying its placed-view id, its saved view’s id, its scale and which pass drew its model lines (data-hidden-line: analytic, or mesh for the approximation drawn before the B-rep arrived). Inside a view group the model is <path> elements (the visible edge runs, one path per run) and each annotation is its own <g> of paths plus <text> elements holding the kernel’s own display string, so the value in the file is the value in the viewport and a reader can select it.

Lines and text only. There are no fills anywhere: an arrowhead is its closed outline, a datum triangle and an FCF frame are their borders, and the border and title block are polylines. The same drawing goes out as PDF through super::pdf, which shares the stroke widths and the cap-height ratio below so the two files cannot drift.

Functions§

hidden_lines
XML text escaping — the five predefined entities. A note’s text is the user’s own, so this is the boundary that keeps it from being markup. Every text string an SVG this module wrote shows, in document order: each <text> element’s content read back from the file, entities undone. What the export door reports ABOUT the file, so a script can assert the drawing’s text without an XML reader. Every placed view’s data-hidden-line read back from the SVG, in view order: analytic or mesh per view.
text_strings
to_svg
Serialise a projected sheet.