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.
This commit is contained in:
furti
2019-05-14 17:32:24 +02:00
committed by Yorik van Havre
parent 84169efee9
commit b82eef770f

View File

@@ -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))