DrawingAlgos.py
Go to the documentation of this file.00001 import FreeCAD, Part, Drawing
00002
00003 startSVG = """<?xml version="1.0" encoding="UTF-8"?>
00004 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
00005
00006 <svg xmlns="http://www.w3.org/2000/svg"
00007 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events"
00008 version="1.1" baseProfile="full"
00009 width="297mm" height="420mm">
00010 """
00011
00012
00013 def createSVG(Part):
00014
00015
00016 [Visibly,Hidden] = Drawing.project(Part)
00017 buffer = startSVG
00018
00019 for i in Hidden.Edges:
00020 buffer += '<line x1="' +`i.Vertexes[0].X` +'" y1="' +`i.Vertexes[0].Y` +'" x2="'+ `i.Vertexes[1].X`+ '" y2="'+ `i.Vertexes[1].Y`+ '" stroke="#fff000" stroke-width="1px" />\n'
00021 for i in Visibly.Edges:
00022 buffer += '<line x1="' +`i.Vertexes[0].X` +'" y1="' +`i.Vertexes[0].Y` +'" x2="'+ `i.Vertexes[1].X`+ '" y2="'+ `i.Vertexes[1].Y`+ '" stroke="#000000" stroke-width="1px" />\n'
00023
00024 buffer += '</svg>'
00025
00026 return buffer
00027