Skip to content

Commit

Permalink
Fix misleading error messages in ProjGroup test
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jun 8, 2019
1 parent aa9cd0d commit 6bb8f19
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/Mod/TechDraw/TDTest/DProjGroupTest.py
Expand Up @@ -23,24 +23,35 @@ def DProjGroupTest():
FreeCAD.newDocument("TDGroup")
FreeCAD.setActiveDocument("TDGroup")
FreeCAD.ActiveDocument=FreeCAD.getDocument("TDGroup")
doc = FreeCAD.ActiveDocument
print("document created")

#make Fusion feature
box = FreeCAD.ActiveDocument.addObject("Part::Box","Box")
box.recompute()
print("box created")
sphere = FreeCAD.ActiveDocument.addObject("Part::Sphere","Sphere")
sphere.recompute()
print("sphere created")
fusion = FreeCAD.ActiveDocument.addObject("Part::MultiFuse","Fusion")
FreeCAD.ActiveDocument.Fusion.Shapes = [box,sphere]
fusion.recompute()
print("Fusion created")

#make a page
print("making 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.ViewObject.show() #unit tests run in console mode
# page.ViewObject.show() #for debugging. unit tests run in console mode
print("Page created")

#make projection group
print("making a projection group")
group = FreeCAD.ActiveDocument.addObject('TechDraw::DrawProjGroup','ProjGroup')
doc.openTransaction("Create Proj Group")
groupName = 'ProjGroup'
group = FreeCAD.ActiveDocument.addObject('TechDraw::DrawProjGroup', groupName)
rc = page.addView(group)
print("Group created")
group.Source = [fusion]
Expand All @@ -50,9 +61,16 @@ def DProjGroupTest():
print("added Front")

#update group
group.Anchor.Direction = FreeCAD.Vector(0,0,1)
group.Anchor.RotationVector = FreeCAD.Vector(1,0,0)
anchorDir = FreeCAD.Vector(0.0, 0.0, 1.0);
anchorRot = FreeCAD.Vector(1.0, 0.0, 0.0);
group.Anchor.Direction = anchorDir
group.Anchor.RotationVector = anchorRot
print("Anchor values set")
group.Anchor.recompute()
doc.commitTransaction()
print("Front/Anchor recomputed")

print("adding left")
leftView = group.addProjection("Left")
print("added Left")
topView = group.addProjection("Top")
Expand Down

0 comments on commit 6bb8f19

Please sign in to comment.