From b82eef770f4bd6f690b65129afb14d0bf3684900 Mon Sep 17 00:00:00 2001 From: furti Date: Tue, 14 May 2019 17:32:24 +0200 Subject: [PATCH] Optimize buildFence method The method is renamed to "makeFence" to better fit to the overall Arch naming style. Additionally it returns the generated object now so one can use it directly from python. --- src/Mod/Arch/ArchFence.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchFence.py b/src/Mod/Arch/ArchFence.py index 4ed6e27696..023bb3f741 100644 --- a/src/Mod/Arch/ArchFence.py +++ b/src/Mod/Arch/ArchFence.py @@ -180,7 +180,7 @@ class _Fence(ArchComponent.Component): def clipSection(self, shape, length, clipLength): import Part - + boundBox = shape.BoundBox lengthToCut = length - clipLength halfLengthToCut = lengthToCut / 2 @@ -259,10 +259,10 @@ class _CommandFence: post = sel[1] path = sel[2] - buildFence(section, post, path) + makeFence(section, post, path) -def buildFence(section, post, path): +def makeFence(section, post, path): obj = FreeCAD.ActiveDocument.addObject( 'Part::FeaturePython', 'Fence') @@ -280,6 +280,8 @@ def buildFence(section, post, path): FreeCAD.ActiveDocument.recompute() + return obj + def hide(obj): if hasattr(obj, 'ViewObject') and obj.ViewObject: @@ -336,4 +338,4 @@ if __name__ == '__main__': path = buildPath() post = buildPost() - buildFence(section, post, path) + print(makeFence(section, post, path))