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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user