Merge pull request #7071 from Roy-043/Draft-Fix-Placement-in-make_sketch

Draft: Fix Sketch Placement in make_sketch (issue #7058)
This commit is contained in:
Yorik van Havre
2022-06-24 13:53:33 +02:00
committed by GitHub

View File

@@ -185,10 +185,16 @@ def make_sketch(objects_list, autoconstraints=False, addTo=None,
return(edge)
axis = App.Vector(0,0,1).cross(normal)
angle = DraftVecUtils.angle(normal, App.Vector(0,0,1))*App.Units.Radian
axis = App.Vector(0, 0, 1).cross(normal)
angle = DraftVecUtils.angle(normal, App.Vector(0, 0, 1)) * App.Units.Radian
rotation = App.Rotation(axis, angle)
point = shapes_list[0].Vertexes[0].Point
base = App.Vector(normal)
base.Length = point.dot(base.normalize()) # See https://forum.freecadweb.org/viewtopic.php?f=22&t=69304#p601149
nobj.Placement = App.Placement(base, rotation)
for obj in objects_list:
ok = False
tp = utils.get_type(obj)
@@ -374,7 +380,6 @@ def make_sketch(objects_list, autoconstraints=False, addTo=None,
"Failed to delete object {}: {}".format(obj.Label,ex))+"\n")
nobj.Placement.Rotation = rotation
nobj.addConstraint(constraints)
return nobj