def Activated(self): import pCmd, fCmd from Part import Plane refFace = [f for f in fCmd.faces() if type(f.Surface) == Plane][0] FreeCAD.activeDocument().openTransaction('Lay-down the pipe') for b in fCmd.beams(): if pCmd.isPipe(b): pCmd.laydownTheTube(b, refFace) FreeCAD.activeDocument().recompute() FreeCAD.activeDocument().commitTransaction()
def Activated(self): import pCmd, fCmd from Part import Plane selex = FreeCADGui.Selection.getSelectionEx() for sx in selex: sxFaces = [f for f in fCmd.faces([sx]) if type(f.Surface) == Plane] if len(sxFaces) > 0: refFace = sxFaces[0] support = sx.Object FreeCAD.activeDocument().openTransaction('Raise-up the support') for b in fCmd.beams(): if pCmd.isPipe(b): pCmd.laydownTheTube(b, refFace, support) break FreeCAD.activeDocument().recompute() FreeCAD.activeDocument().commitTransaction()