Black
This commit is contained in:
@@ -7,41 +7,41 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import FreeCAD
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def DHatchTest():
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
print ('TDHatch path: ' + path)
|
||||
templateFileSpec = path+'/TestTemplate.svg'
|
||||
hatchFileSpec = path + '/TestHatch.svg'
|
||||
print("TDHatch path: " + path)
|
||||
templateFileSpec = path + "/TestTemplate.svg"
|
||||
hatchFileSpec = path + "/TestHatch.svg"
|
||||
|
||||
FreeCAD.newDocument("TDHatch")
|
||||
FreeCAD.setActiveDocument("TDHatch")
|
||||
FreeCAD.ActiveDocument=FreeCAD.getDocument("TDHatch")
|
||||
FreeCAD.ActiveDocument = FreeCAD.getDocument("TDHatch")
|
||||
|
||||
#make source feature
|
||||
box = FreeCAD.ActiveDocument.addObject("Part::Box","Box")
|
||||
# make source feature
|
||||
box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box")
|
||||
|
||||
#make a page
|
||||
page = FreeCAD.ActiveDocument.addObject('TechDraw::DrawPage','Page')
|
||||
FreeCAD.ActiveDocument.addObject('TechDraw::DrawSVGTemplate','Template')
|
||||
# make a page
|
||||
page = FreeCAD.ActiveDocument.addObject("TechDraw::DrawPage", "Page")
|
||||
FreeCAD.ActiveDocument.addObject("TechDraw::DrawSVGTemplate", "Template")
|
||||
FreeCAD.ActiveDocument.Template.Template = templateFileSpec
|
||||
FreeCAD.ActiveDocument.Page.Template = FreeCAD.ActiveDocument.Template
|
||||
page.Scale = 5.0
|
||||
# page.ViewObject.show() #unit tests run in console mode
|
||||
# page.ViewObject.show() #unit tests run in console mode
|
||||
|
||||
#make Views
|
||||
view1 = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewPart','View')
|
||||
# make Views
|
||||
view1 = FreeCAD.ActiveDocument.addObject("TechDraw::DrawViewPart", "View")
|
||||
FreeCAD.ActiveDocument.View.Source = [box]
|
||||
page.addView(view1)
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
#make hatch
|
||||
# make hatch
|
||||
print("making hatch")
|
||||
hatch = FreeCAD.ActiveDocument.addObject('TechDraw::DrawHatch','Hatch')
|
||||
hatch.Source = (view1,["Face0"])
|
||||
hatch.HatchPattern = hatchFileSpec #comment out to use default from preferences
|
||||
hatch = FreeCAD.ActiveDocument.addObject("TechDraw::DrawHatch", "Hatch")
|
||||
hatch.Source = (view1, ["Face0"])
|
||||
hatch.HatchPattern = hatchFileSpec # comment out to use default from preferences
|
||||
print("adding hatch to page")
|
||||
page.addView(hatch)
|
||||
print("finished hatch")
|
||||
@@ -49,10 +49,12 @@ def DHatchTest():
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
rc = False
|
||||
if ("Up-to-date" in hatch.State):
|
||||
if "Up-to-date" in hatch.State:
|
||||
rc = True
|
||||
|
||||
FreeCAD.closeDocument("TDHatch")
|
||||
return rc
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
DHatchTest()
|
||||
|
||||
Reference in New Issue
Block a user