I am trying to write a script to optimize a pipe length, however my pipe length using the method in the code below returns 0 which is not correct. How do I get the actual pipe length?
Thanks in advance.
David
Code: Select all
import FreeCAD as App
import Draft, Arch
import math as math
doc = App.newDocument()
f1 = App.Vector(0, -200, 0)
f2 = App.Vector(0,-600,0)
f3 = App.Vector(- 500,-70, 300)
wire1 = Draft.make_wire([f1,f2,f3],closed=False)
wire1.FilletRadius = 38*1.8
pipe1 = Arch.makePipe(wire1, 38)
App.Console.PrintMessage("wire 1 : " + str([f1,f2,f3]) + "\n")
App.Console.PrintMessage("Wire 1 Length : " + str(wire1.Length) + "\n")
App.Console.PrintMessage("Pipe 1 Length : " + str(pipe1.Length) + "\n")
Gui.activeDocument().activeView().viewFront()
Gui.activeDocument().activeView().viewRotateLeft()
Gui.activeDocument().activeView().viewRotateLeft()
doc.recompute()
Gui.SendMsgToActiveView("ViewFit")
21:15:20 Wire 1 Length : 0.0 mm
21:15:20 Pipe 1 Length : 0.0 mm