Py3: fixes for lack of xrange
This commit is contained in:
parent
cd551a5ba7
commit
714cdad3a2
|
@ -112,7 +112,7 @@ class _CompoundFilter:
|
||||||
raise ValueError('index range cannot be parsed:'+r)
|
raise ValueError('index range cannot be parsed:'+r)
|
||||||
if obj.Invert :
|
if obj.Invert :
|
||||||
rst = []
|
rst = []
|
||||||
for i in xrange(0,len(shps)):
|
for i in range(0,len(shps)):
|
||||||
if not flags[i]:
|
if not flags[i]:
|
||||||
rst.append(shps[i])
|
rst.append(shps[i])
|
||||||
elif obj.FilterType == 'collision-pass':
|
elif obj.FilterType == 'collision-pass':
|
||||||
|
@ -123,7 +123,7 @@ class _CompoundFilter:
|
||||||
rst.append(s)
|
rst.append(s)
|
||||||
elif obj.FilterType == 'window-volume' or obj.FilterType == 'window-area' or obj.FilterType == 'window-length' or obj.FilterType == 'window-distance':
|
elif obj.FilterType == 'window-volume' or obj.FilterType == 'window-area' or obj.FilterType == 'window-length' or obj.FilterType == 'window-distance':
|
||||||
vals = [0.0] * len(shps)
|
vals = [0.0] * len(shps)
|
||||||
for i in xrange(0,len(shps)):
|
for i in range(0,len(shps)):
|
||||||
if obj.FilterType == 'window-volume':
|
if obj.FilterType == 'window-volume':
|
||||||
vals[i] = shps[i].Volume
|
vals[i] = shps[i].Volume
|
||||||
elif obj.FilterType == 'window-area':
|
elif obj.FilterType == 'window-area':
|
||||||
|
@ -147,7 +147,7 @@ class _CompoundFilter:
|
||||||
valFrom = obj.WindowFrom / 100.0 * maxval
|
valFrom = obj.WindowFrom / 100.0 * maxval
|
||||||
valTo = obj.WindowTo / 100.0 * maxval
|
valTo = obj.WindowTo / 100.0 * maxval
|
||||||
|
|
||||||
for i in xrange(0,len(shps)):
|
for i in range(0,len(shps)):
|
||||||
if bool(vals[i] >= valFrom and vals[i] <= valTo) ^ obj.Invert:
|
if bool(vals[i] >= valFrom and vals[i] <= valTo) ^ obj.Invert:
|
||||||
rst.append(shps[i])
|
rst.append(shps[i])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -103,7 +103,7 @@ class LatticeArrayFilter(lattice2BaseFeature.LatticeFeature):
|
||||||
raise ValueError('index range cannot be parsed:'+r)
|
raise ValueError('index range cannot be parsed:'+r)
|
||||||
if obj.Invert :
|
if obj.Invert :
|
||||||
output = []
|
output = []
|
||||||
for i in xrange(0,len(input)):
|
for i in range(0,len(input)):
|
||||||
if not flags[i]:
|
if not flags[i]:
|
||||||
output.append(input[i])
|
output.append(input[i])
|
||||||
elif obj.FilterType == 'collision-pass':
|
elif obj.FilterType == 'collision-pass':
|
||||||
|
@ -115,7 +115,7 @@ class LatticeArrayFilter(lattice2BaseFeature.LatticeFeature):
|
||||||
output.append(plm)
|
output.append(plm)
|
||||||
elif obj.FilterType == 'window-distance':
|
elif obj.FilterType == 'window-distance':
|
||||||
vals = [0.0] * len(input)
|
vals = [0.0] * len(input)
|
||||||
for i in xrange(0,len(input)):
|
for i in range(0,len(input)):
|
||||||
if obj.FilterType == 'window-distance':
|
if obj.FilterType == 'window-distance':
|
||||||
pnt = Part.Vertex(input[i].Base)
|
pnt = Part.Vertex(input[i].Base)
|
||||||
vals[i] = pnt.distToShape(screen(obj.Stencil).Shape)[0]
|
vals[i] = pnt.distToShape(screen(obj.Stencil).Shape)[0]
|
||||||
|
@ -123,7 +123,7 @@ class LatticeArrayFilter(lattice2BaseFeature.LatticeFeature):
|
||||||
valFrom = obj.WindowFrom
|
valFrom = obj.WindowFrom
|
||||||
valTo = obj.WindowTo
|
valTo = obj.WindowTo
|
||||||
|
|
||||||
for i in xrange(0,len(input)):
|
for i in range(0,len(input)):
|
||||||
if bool(vals[i] >= valFrom and vals[i] <= valTo) ^ obj.Invert:
|
if bool(vals[i] >= valFrom and vals[i] <= valTo) ^ obj.Invert:
|
||||||
output.append(input[i])
|
output.append(input[i])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -94,9 +94,9 @@ def getIndexesIntoList(element, list_of_shapes):
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
for i_sh in xrange(len(list_of_shapes)):
|
for i_sh in range(len(list_of_shapes)):
|
||||||
elements = element_extractor(list_of_shapes[i_sh])
|
elements = element_extractor(list_of_shapes[i_sh])
|
||||||
for i_el in xrange(len(elements)):
|
for i_el in range(len(elements)):
|
||||||
if elements[i_el].isEqual(element):
|
if elements[i_el].isEqual(element):
|
||||||
# to make link more robust, use negative index if one is closer to the end
|
# to make link more robust, use negative index if one is closer to the end
|
||||||
if i_el * 2 > len(elements):
|
if i_el * 2 > len(elements):
|
||||||
|
@ -187,7 +187,7 @@ def Subsequence_basic(link, traversal, loop):
|
||||||
i_first_child = 0
|
i_first_child = 0
|
||||||
|
|
||||||
elements = element_extractors[element_type_string](compound)
|
elements = element_extractors[element_type_string](compound)
|
||||||
index_dict = dict([(HashableShape(elements[i]), i) for i in xrange(len(elements))])
|
index_dict = dict([(HashableShape(elements[i]), i) for i in range(len(elements))])
|
||||||
|
|
||||||
# find the element in each child, find out its global index, and output result in a form of a string for a link
|
# find the element in each child, find out its global index, and output result in a form of a string for a link
|
||||||
ret = [] #list of tuples (object, subelement_string)
|
ret = [] #list of tuples (object, subelement_string)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user