Add about 50 hatches in SVG pattern format taken from LibreCAD

This commit is contained in:
Dion Moult
2020-01-03 12:46:29 +11:00
parent 7c6e7742a8
commit d6b9810b94
3 changed files with 7126 additions and 59 deletions
+10 -3
View File
@@ -686,7 +686,8 @@ class SvgWriter():
) )
self.add_stylesheet() self.add_stylesheet()
self.add_defs() self.add_markers()
self.add_patterns()
self.draw_background_image() self.draw_background_image()
self.draw_background_elements() self.draw_background_elements()
self.draw_cut_polygons() self.draw_cut_polygons()
@@ -706,8 +707,14 @@ class SvgWriter():
with open('{}styles/default.css'.format(self.ifc_cutter.data_dir), 'r') as stylesheet: with open('{}styles/default.css'.format(self.ifc_cutter.data_dir), 'r') as stylesheet:
self.svg.defs.add(self.svg.style(stylesheet.read())) self.svg.defs.add(self.svg.style(stylesheet.read()))
def add_defs(self): def add_markers(self):
tree = ET.parse('{}templates/defs.svg'.format(self.ifc_cutter.data_dir)) tree = ET.parse('{}templates/markers.svg'.format(self.ifc_cutter.data_dir))
root = tree.getroot()
for child in root.getchildren():
self.svg.defs.add(External(child))
def add_patterns(self):
tree = ET.parse('{}templates/patterns.svg'.format(self.ifc_cutter.data_dir))
root = tree.getroot() root = tree.getroot()
for child in root.getchildren(): for child in root.getchildren():
self.svg.defs.add(External(child)) self.svg.defs.add(External(child))
@@ -1,56 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<svg baseProfile="full" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"> <svg baseProfile="full" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink">
<marker id="eng-dimension-marker-start" markerHeight="14" markerWidth="11" orient="auto" refX="1" refY="7"> <marker id="eng-dimension-marker-start" markerHeight="14" markerWidth="11" orient="auto" refX="1" refY="7">
<g> <g>
<path d="M 11 3.5 L 11 10.5 L 1 7" class="annotation" style="fill:black;" /> <path d="M 11 3.5 L 11 10.5 L 1 7" class="annotation" style="fill:black;" />
<path d="M 1 0 L 1 14" class="annotation" style="stroke-width:1;" /> <path d="M 1 0 L 1 14" class="annotation" style="stroke-width:1;" />
</g> </g>
</marker> </marker>
<marker id="eng-dimension-marker-end" markerHeight="14" markerWidth="11" orient="auto" refX="10" refY="7"> <marker id="eng-dimension-marker-end" markerHeight="14" markerWidth="11" orient="auto" refX="10" refY="7">
<g> <g>
<path d="M 0 3.5 L 0 10.5 L 10 7" class="annotation" style="fill:black;" /> <path d="M 0 3.5 L 0 10.5 L 10 7" class="annotation" style="fill:black;" />
<path d="M 10 0 L 10 14" class="annotation" style="stroke-width:1;" /> <path d="M 10 0 L 10 14" class="annotation" style="stroke-width:1;" />
</g> </g>
</marker> </marker>
<marker id="dimension-marker-start" markerHeight="30" markerWidth="20" refX="10" refY="15" orient="auto"> <marker id="dimension-marker-start" markerHeight="30" markerWidth="20" refX="10" refY="15" orient="auto">
<g> <g>
<path d="M 0 15 L 20 15" class="annotation" style="stroke-width:1;" /> <path d="M 0 15 L 20 15" class="annotation" style="stroke-width:1;" />
<path d="M 10 0 L 10 30" class="annotation" style="stroke-width:1;" /> <path d="M 10 0 L 10 30" class="annotation" style="stroke-width:1;" />
<path d="M 5 20 L 15 10" class="annotation" style="stroke-width:3;" /> <path d="M 5 20 L 15 10" class="annotation" style="stroke-width:3;" />
</g> </g>
</marker> </marker>
<marker id="dimension-marker-end" markerHeight="30" markerWidth="20" refX="10" refY="15" orient="auto"> <marker id="dimension-marker-end" markerHeight="30" markerWidth="20" refX="10" refY="15" orient="auto">
<g> <g>
<path d="M 0 15 L 20 15" class="annotation" style="stroke-width:1;" /> <path d="M 0 15 L 20 15" class="annotation" style="stroke-width:1;" />
<path d="M 10 0 L 10 30" class="annotation" style="stroke-width:1;" /> <path d="M 10 0 L 10 30" class="annotation" style="stroke-width:1;" />
<path d="M 5 20 L 15 10" class="annotation" style="stroke-width:3;" /> <path d="M 5 20 L 15 10" class="annotation" style="stroke-width:3;" />
</g> </g>
</marker> </marker>
<marker id="grid-marker" markerHeight="35" markerWidth="35" orient="auto" refX="17.5" refY="17.5"> <marker id="grid-marker" markerHeight="35" markerWidth="35" orient="auto" refX="17.5" refY="17.5">
<circle cx="17.5" cy="17.5" fill="white" stroke="black" r="15" style="stroke-width: 2"/> <circle cx="17.5" cy="17.5" fill="white" stroke="black" r="15" style="stroke-width: 2"/>
</marker> </marker>
<marker id="leader-marker" markerHeight="7" markerWidth="10" orient="auto" refX="10" refY="3.5"> <marker id="leader-marker" markerHeight="7" markerWidth="10" orient="auto" refX="10" refY="3.5">
<path d="M 0 0 L 0 7 L 10 3.5" class="annotation" style="fill:black;" /> <path d="M 0 0 L 0 7 L 10 3.5" class="annotation" style="fill:black;" />
</marker> </marker>
<marker id="stair-marker-start" markerHeight="10" markerWidth="10" orient="auto" refX="5" refY="5"> <marker id="stair-marker-start" markerHeight="10" markerWidth="10" orient="auto" refX="5" refY="5">
<circle cx="5" cy="5" fill="black" stroke="none" r="5"/> <circle cx="5" cy="5" fill="black" stroke="none" r="5"/>
</marker> </marker>
<marker id="stair-marker-end" markerHeight="42" markerWidth="21" orient="auto" refX="21" refY="21"> <marker id="stair-marker-end" markerHeight="42" markerWidth="21" orient="auto" refX="21" refY="21">
<path d="M 0 0 L 21 21 L 0 42" class="annotation stair" style="stroke-width:2" /> <path d="M 0 0 L 21 21 L 0 42" class="annotation stair" style="stroke-width:2" />
</marker> </marker>
<marker id="plan-level-marker" markerHeight="30" markerWidth="30" refX="15" refY="15"> <marker id="plan-level-marker" markerHeight="30" markerWidth="30" refX="15" refY="15">
<g> <g>
<path d="M 15 0 L 15 30" class="annotation" style="stroke-width:1;" /> <path d="M 15 0 L 15 30" class="annotation" style="stroke-width:1;" />
<path d="M 0 15 L 30 15" class="annotation" style="stroke-width:1;" /> <path d="M 0 15 L 30 15" class="annotation" style="stroke-width:1;" />
<circle cx="15" cy="15" fill="white" stroke="black" r="7.5" style="stroke-width: 2"/> <circle cx="15" cy="15" fill="white" stroke="black" r="7.5" style="stroke-width: 2"/>
<path d="M 15 15 L 7.5 15 A 7.5 7.5 0 0 1 15 7.5 Z" fill="black"/> <path d="M 15 15 L 7.5 15 A 7.5 7.5 0 0 1 15 7.5 Z" fill="black"/>
<path d="M 15 15 L 22.5 15 A 7.5 7.5 0 0 1 15 22.5 Z" fill="black"/> <path d="M 15 15 L 22.5 15 A 7.5 7.5 0 0 1 15 22.5 Z" fill="black"/>
</g> </g>
</marker> </marker>
<marker id="section-level-marker" markerHeight="11" markerWidth="90" refX="20" refY="10"> <marker id="section-level-marker" markerHeight="11" markerWidth="90" refX="20" refY="10">
<g> <g>
<path d="M 0 1 L 20 1 L 10 11 Z" fill="black" /> <path d="M 0 1 L 20 1 L 10 11 Z" fill="black" />
<path d="M 0 1 L 90 1" class="annotation" style="stroke-width:1;" /> <path d="M 0 1 L 90 1" class="annotation" style="stroke-width:1;" />
</g> </g>
</marker> </marker>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 821 KiB