Skip to content

Commit

Permalink
[Arch] Pipe : correctly orient profile on bezier curves
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
carlopav authored and yorikvanhavre committed Jul 2, 2019
1 parent 13563bd commit bc04b67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mod/Arch/ArchPipe.py
Expand Up @@ -234,7 +234,11 @@ def execute(self,obj):
# 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))
Expand Down

0 comments on commit bc04b67

Please sign in to comment.