File size: 512 Bytes
985c397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import FreeCAD
import os
def createPageWithSVGTemplate(doc=None):
"""Returns a page with an SVGTemplate added on the ActiveDocument"""
path = os.path.dirname(os.path.abspath(__file__))
templateFileSpec = path + "/TestTemplate.svg"
if not doc:
doc = FreeCAD.ActiveDocument
page = doc.addObject("TechDraw::DrawPage", "Page")
doc.addObject("TechDraw::DrawSVGTemplate", "Template")
doc.Template.Template = templateFileSpec
doc.Page.Template = doc.Template
return page
|