Draft: various cleanup

Mainly added an empty line at the end of each file and changed docstrings.
This commit is contained in:
carlopav
2020-05-12 20:59:17 +02:00
committed by Yorik van Havre
parent 2c4de88132
commit 125d0ca84d
57 changed files with 170 additions and 113 deletions

View File

@@ -60,49 +60,53 @@ def array(objectslist, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None):
array(objectslist, center, totalangle, totalnum) for polar array
"""
def rectArray(objectslist,xvector,yvector,xnum,ynum):
utils.type_check([(xvector, App.Vector),
(yvector, App.Vector),
(xnum,int), (ynum,int)],
"rectArray")
if not isinstance(objectslist,list): objectslist = [objectslist]
for xcount in range(xnum):
currentxvector=App.Vector(xvector).multiply(xcount)
if not xcount==0:
move(objectslist,currentxvector,True)
for ycount in range(ynum):
currentxvector=App.Vector(currentxvector)
currentyvector=currentxvector.add(App.Vector(yvector).multiply(ycount))
if not ycount==0:
move(objectslist,currentyvector,True)
def rectArray2(objectslist,xvector,yvector,zvector,xnum,ynum,znum):
utils.type_check([(xvector,App.Vector), (yvector,App.Vector), (zvector,App.Vector),(xnum,int), (ynum,int),(znum,int)], "rectArray2")
if not isinstance(objectslist,list): objectslist = [objectslist]
for xcount in range(xnum):
currentxvector=App.Vector(xvector).multiply(xcount)
if not xcount==0:
move(objectslist,currentxvector,True)
for ycount in range(ynum):
currentxvector=App.Vector(currentxvector)
currentyvector=currentxvector.add(App.Vector(yvector).multiply(ycount))
if not ycount==0:
move(objectslist,currentyvector,True)
for zcount in range(znum):
currentzvector=currentyvector.add(App.Vector(zvector).multiply(zcount))
if not zcount==0:
move(objectslist,currentzvector,True)
def polarArray(objectslist,center,angle,num):
utils.type_check([(center,App.Vector), (num,int)], "polarArray")
if not isinstance(objectslist,list): objectslist = [objectslist]
fraction = float(angle)/num
for i in range(num):
currangle = fraction + (i*fraction)
rotate(objectslist,currangle,center,copy=True)
if arg6:
rectArray2(objectslist,arg1,arg2,arg3,arg4,arg5,arg6)
rectArray2(objectslist, arg1, arg2, arg3, arg4, arg5, arg6)
elif arg4:
rectArray(objectslist,arg1,arg2,arg3,arg4)
rectArray(objectslist, arg1,arg2, arg3, arg4)
else:
polarArray(objectslist,arg1,arg2,arg3)
polarArray(objectslist, arg1, arg2, arg3)
def rectArray(objectslist,xvector,yvector,xnum,ynum):
utils.type_check([(xvector, App.Vector),
(yvector, App.Vector),
(xnum,int), (ynum,int)],
"rectArray")
if not isinstance(objectslist,list): objectslist = [objectslist]
for xcount in range(xnum):
currentxvector=App.Vector(xvector).multiply(xcount)
if not xcount==0:
move(objectslist,currentxvector,True)
for ycount in range(ynum):
currentxvector=App.Vector(currentxvector)
currentyvector=currentxvector.add(App.Vector(yvector).multiply(ycount))
if not ycount==0:
move(objectslist,currentyvector,True)
def rectArray2(objectslist,xvector,yvector,zvector,xnum,ynum,znum):
utils.type_check([(xvector,App.Vector), (yvector,App.Vector), (zvector,App.Vector),(xnum,int), (ynum,int),(znum,int)], "rectArray2")
if not isinstance(objectslist,list): objectslist = [objectslist]
for xcount in range(xnum):
currentxvector=App.Vector(xvector).multiply(xcount)
if not xcount==0:
move(objectslist,currentxvector,True)
for ycount in range(ynum):
currentxvector=App.Vector(currentxvector)
currentyvector=currentxvector.add(App.Vector(yvector).multiply(ycount))
if not ycount==0:
move(objectslist,currentyvector,True)
for zcount in range(znum):
currentzvector=currentyvector.add(App.Vector(zvector).multiply(zcount))
if not zcount==0:
move(objectslist,currentzvector,True)
def polarArray(objectslist,center,angle,num):
utils.type_check([(center,App.Vector), (num,int)], "polarArray")
if not isinstance(objectslist,list): objectslist = [objectslist]
fraction = float(angle)/num
for i in range(num):
currangle = fraction + (i*fraction)
rotate(objectslist,currangle,center,copy=True)