Draft: Fixed wrong Placement of Draft Wire - fixes #3558

This commit is contained in:
Yorik van Havre
2018-11-01 14:42:52 -03:00
parent ae9fdfd724
commit 80c6100dd8
2 changed files with 11 additions and 5 deletions

View File

@@ -878,9 +878,12 @@ def makeWire(pointslist,closed=False,placement=None,face=None,support=None):
print("Invalid input points: ",pointslist)
#print(pointslist)
#print(closed)
if placement: typecheck([(placement,FreeCAD.Placement)], "makeWire")
if placement:
typecheck([(placement,FreeCAD.Placement)], "makeWire")
ipl = placement.inverse()
pointslist = [ipl.multVec(p) for p in pointslist]
if len(pointslist) == 2: fname = "Line"
else: fname = "DWire"
else: fname = "Wire"
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
_Wire(obj)
obj.Points = pointslist

View File

@@ -605,9 +605,12 @@ class Line(Creator):
# building command string
rot,sup,pts,fil = self.getStrings()
FreeCADGui.addModule("Draft")
self.commit(translate("draft","Create DWire"),
['points='+pts,
'line = Draft.makeWire(points,closed='+str(closed)+',face='+fil+',support='+sup+')',
self.commit(translate("draft","Create Wire"),
['pl = FreeCAD.Placement()',
'pl.Rotation.Q = '+rot,
'pl.Base = '+DraftVecUtils.toString(self.node[0]),
'points = '+pts,
'line = Draft.makeWire(points,placement=pl,closed='+str(closed)+',face='+fil+',support='+sup+')',
'Draft.autogroup(line)'])
Creator.finish(self)
if self.ui: