From bc04b67789873e94fa0697a53cbc4eb60884de36 Mon Sep 17 00:00:00 2001 From: carlopav Date: Sun, 30 Jun 2019 23:19:57 +0200 Subject: [PATCH] [Arch] Pipe : correctly orient profile on bezier curves Added a small fix to correctly take into account the profile orientation when base object is a bezier curve. Should be useful for electrical wires and flexible pipe design. --- src/Mod/Arch/ArchPipe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/Arch/ArchPipe.py b/src/Mod/Arch/ArchPipe.py index 5263d6625c..ed9a804d8e 100644 --- a/src/Mod/Arch/ArchPipe.py +++ b/src/Mod/Arch/ArchPipe.py @@ -234,7 +234,11 @@ class _ArchPipe(ArchComponent.Component): # move and rotate the profile to the first point delta = w.Vertexes[0].Point-p.CenterOfMass p.translate(delta) - v1 = w.Vertexes[1].Point-w.Vertexes[0].Point + import Draft + if Draft.getType(obj.Base) == "BezCurve": + v1 = obj.Base.Placement.multVec(obj.Base.Points[1])-w.Vertexes[0].Point + else: + v1 = w.Vertexes[1].Point-w.Vertexes[0].Point v2 = DraftGeomUtils.getNormal(p) rot = FreeCAD.Rotation(v2,v1) p.rotate(p.CenterOfMass,rot.Axis,math.degrees(rot.Angle))