Beispiel #1
0
 def get(self, data, start, stop, level, f):
     if level > 1:  # find level to work on
         return [self.get(obj, start, stop, level - 1, f) for obj in data]
     elif level == 1:  # execute the chosen function
         start_iter = repeat_last(start)
         stop_iter = repeat_last(stop)
         return [f(obj, next(start_iter), next(stop_iter)) for obj in data]
     else:  # Fail
         return None
Beispiel #2
0
 def get(self, data, start, stop, level, f):
     if level > 1:  # find level to work on
         return [self.get(obj, start, stop, level - 1, f) for obj in data]
     elif level == 1:  # execute the chosen function
         start_iter = repeat_last(start)
         stop_iter = repeat_last(stop)
         return [f(obj, next(start_iter), next(stop_iter)) for obj in data]
     else:  # Fail
         return None
Beispiel #3
0
    def update(self):
        if 'Vertices' not in self.outputs:
            return
        if not any((s.links for s in self.outputs)):
            return

        if self.inputs['Vertices'].links:
            verts = SvGetSocketAnyType(self, self.inputs['Vertices'])
            verts = dataCorrect(verts)
            t_ins = self.inputs['Interval'].sv_get()
            verts_out = []
            for v, t_in in zip(verts, repeat_last(t_ins)):
                pts = np.array(v).T
                tmp = np.apply_along_axis(np.linalg.norm, 0,
                                          pts[:, :-1] - pts[:, 1:])
                t = np.insert(tmp, 0, 0).cumsum()
                t = t / t[-1]
                t_corr = [min(1, max(t_c, 0)) for t_c in t_in]
                # this should also be numpy
                if self.mode == 'LIN':
                    out = [np.interp(t_corr, t, pts[i]) for i in range(3)]
                    verts_out.append(list(zip(*out)))
                else:  # SPL
                    spl = cubic_spline(v, t)
                    out = eval_spline(spl, t, t_corr)
                    verts_out.append(out)

            if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
                SvSetSocketAnyType(self, 'Vertices', verts_out)
Beispiel #4
0
    def update(self):
        if 'Vertices' not in self.outputs:
            return
        if not any((s.links for s in self.outputs)):
            return

        if self.inputs['Vertices'].links:
            verts = SvGetSocketAnyType(self, self.inputs['Vertices'])
            verts = dataCorrect(verts)
            t_ins = self.inputs['Interval'].sv_get()
            verts_out = []
            for v, t_in in zip(verts, repeat_last(t_ins)):
                pts = np.array(v).T
                tmp = np.apply_along_axis(np.linalg.norm, 0, pts[:, :-1]-pts[:, 1:])
                t = np.insert(tmp, 0, 0).cumsum()
                t = t/t[-1]
                t_corr = [min(1, max(t_c, 0)) for t_c in t_in]
                # this should also be numpy
                if self.mode == 'LIN':
                    out = [np.interp(t_corr, t, pts[i]) for i in range(3)]
                    verts_out.append(list(zip(*out)))
                else:  # SPL
                    spl = cubic_spline(v, t)
                    out = eval_spline(spl, t, t_corr)
                    verts_out.append(out)

            if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
                SvSetSocketAnyType(self, 'Vertices', verts_out)
Beispiel #5
0
    def update(self):
        if 'polygons' not in self.outputs:
            return

        if 'vertices' in self.inputs and self.inputs['vertices'].links and \
           'edges' in self.inputs and self.inputs['edges'].links:

            verts = dataCorrect(SvGetSocketAnyType(self, self.inputs['vertices']))
            edges = dataCorrect(SvGetSocketAnyType(self, self.inputs['edges']))
            sides = repeat_last(self.inputs['Sides'].sv_get()[0])
            verts_out = []
            edges_out = []
            polys_out = []

            for v, e, s in zip(verts, edges, sides):
                res = fill_holes(v, e, int(s))
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])

            if 'vertices' in self.outputs and self.outputs['vertices'].links:
                SvSetSocketAnyType(self, 'vertices', verts_out)

            if 'edges' in self.outputs and self.outputs['edges'].links:
                SvSetSocketAnyType(self, 'edges', edges_out)

            if 'polygons' in self.outputs and self.outputs['polygons'].links:
                SvSetSocketAnyType(self, 'polygons', polys_out)
Beispiel #6
0
    def update(self):
        if 'polygons' not in self.outputs:
            return

        if 'vertices' in self.inputs and self.inputs['vertices'].links and \
           'edges' in self.inputs and self.inputs['edges'].links:

            verts = dataCorrect(
                SvGetSocketAnyType(self, self.inputs['vertices']))
            edges = dataCorrect(SvGetSocketAnyType(self, self.inputs['edges']))
            sides = repeat_last(self.inputs['Sides'].sv_get()[0])
            verts_out = []
            edges_out = []
            polys_out = []

            for v, e, s in zip(verts, edges, sides):
                res = fill_holes(v, e, int(s))
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])

            if 'vertices' in self.outputs and self.outputs['vertices'].links:
                SvSetSocketAnyType(self, 'vertices', verts_out)

            if 'edges' in self.outputs and self.outputs['edges'].links:
                SvSetSocketAnyType(self, 'edges', edges_out)

            if 'polygons' in self.outputs and self.outputs['polygons'].links:
                SvSetSocketAnyType(self, 'polygons', polys_out)
Beispiel #7
0
 def get(self, data, level, items, f):
     if level == 1:
         item_iter = repeat_last(items)
         return [self.get(obj, level-1, next(item_iter), f) for obj in data]
     elif level:
         return [self.get(obj, level-1, items, f) for obj in data]
     else:
         return f(data, items)
Beispiel #8
0
 def get(self, data, level, items, f):
     if level == 1:
         item_iter = repeat_last(items)
         return [
             self.get(obj, level - 1, next(item_iter), f) for obj in data
         ]
     elif level:
         return [self.get(obj, level - 1, items, f) for obj in data]
     else:
         return f(data, items)
Beispiel #9
0
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        # outputs, end early.
        if 'Value' not in outputs or not outputs['Value'].links:
            return
        value_in = iter(inputs[0].sv_get())
        param = [repeat_last(inputs[i].sv_get()[0]) for i in range(1, 5)]
        out = [self.map_range(*args) for args in zip(value_in, *param)]
        self.outputs['Value'].sv_set(out)
Beispiel #10
0
    def update(self):
        inputs = self.inputs
        outputs = self.outputs

        # outputs, end early.
        if 'Value' not in outputs or not outputs['Value'].links:
            return
        value_in = iter(inputs[0].sv_get())
        param = [repeat_last(inputs[i].sv_get()[0]) for i in range(1, 5)]
        out = [self.map_range(*args) for args in zip(value_in, *param)]
        self.outputs['Value'].sv_set(out)
Beispiel #11
0
 def get(self, data, level, size):
     if not isinstance(data, (list, tuple)):
         return data
     if not isinstance(data[0], (list, tuple)):
         return data
     if level > 1:  # find level to work on
         return [self.get(d, level-1, size) for d in data]
     elif level == 1:  # execute the chosen function
         sizes = repeat_last(size)
         if self.unwrap:
             return list(chain.from_iterable((split(d, next(sizes)) for d in data)))
         else:
             return [split(d, next(sizes)) for d in data]
     else:  # Fail
         return None
Beispiel #12
0
 def get(self, data, level, size):
     if not isinstance(data, (list, tuple)):
         return data
     if not isinstance(data[0], (list, tuple)):
         return data
     if level > 1:  # find level to work on
         return [self.get(d, level - 1, size) for d in data]
     elif level == 1:  # execute the chosen function
         sizes = repeat_last(size)
         if self.unwrap:
             return list(
                 chain.from_iterable((split(d, next(sizes)) for d in data)))
         else:
             return [split(d, next(sizes)) for d in data]
     else:  # Fail
         return None
Beispiel #13
0
    def update(self):
        if not 'polygons' in self.outputs:
            return
        if not any((s.links for s in self.outputs)):
            return

        if 'vertices' in self.inputs and self.inputs['vertices'].links and \
           'polygons' in self.inputs and self.inputs['polygons'].links:

            verts = Vector_generate(SvGetSocketAnyType(self, self.inputs['vertices']))
            polys = SvGetSocketAnyType(self, self.inputs['polygons'])
            if 'thickness' in self.inputs:
                thickness = self.inputs['thickness'].sv_get()[0]
            else:
                thickness = [self.thickness]

            #print (verts,polys)

            verts_out = []
            edges_out = []
            polys_out = []
            newpo_out = []
            
            for v, p, t in zip(verts, polys, repeat_last(thickness)):
                verlen = set(range(len(v)))
                res = soldify(v, p, t, verlen)
            
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])
                newpo_out.append(res[3])
            
            if 'vertices' in self.outputs and self.outputs['vertices'].links:
                SvSetSocketAnyType(self, 'vertices', verts_out)
            
            if 'edges' in self.outputs and self.outputs['edges'].links:
                SvSetSocketAnyType(self, 'edges', edges_out)
            
            if 'polygons' in self.outputs and self.outputs['polygons'].links:
                SvSetSocketAnyType(self, 'polygons', polys_out)
                
            if 'newpols' in self.outputs and self.outputs['newpols'].links:
                SvSetSocketAnyType(self, 'newpols', newpo_out)
Beispiel #14
0
    def update(self):
        if not any([s.links for s in self.outputs]):
            return

        if (
            "Vertices" in self.inputs
            and self.inputs["Vertices"].links
            and "PolyEdge" in self.inputs
            and self.inputs["PolyEdge"].links
        ):

            verts = Vector_generate(SvGetSocketAnyType(self, self.inputs["Vertices"]))
            polys = SvGetSocketAnyType(self, self.inputs["PolyEdge"])
            if "Distance" in self.inputs:
                distance = self.inputs["Distance"].sv_get()[0]
            else:
                distance = [self.distance]
            if "Doubles" in self.outputs:
                has_double_out = bool("Doubles" in self.outputs)

            verts_out = []
            edges_out = []
            polys_out = []
            d_out = []

            for v, p, d in zip(verts, polys, repeat_last(distance)):
                res = remove_doubles(v, p, d, has_double_out)
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])
                d_out.append(res[3])

            if "Vertices" in self.outputs and self.outputs["Vertices"].links:
                SvSetSocketAnyType(self, "Vertices", verts_out)

            if "Edges" in self.outputs and self.outputs["Edges"].links:
                SvSetSocketAnyType(self, "Edges", edges_out)

            if "Polygons" in self.outputs and self.outputs["Polygons"].links:
                SvSetSocketAnyType(self, "Polygons", polys_out)

            if "Doubles" in self.outputs and self.outputs["Doubles"].links:
                SvSetSocketAnyType(self, "Doubles", d_out)
Beispiel #15
0
    def update(self):
        if 'Poly Egde' not in self.outputs:
            return
        if not any((s.links for s in self.outputs)):
            return
        if self.inputs['Vertices'].links and self.inputs['Poly Egde'].links:
            verts = SvGetSocketAnyType(self, self.inputs['Vertices'])
            poly = SvGetSocketAnyType(self, self.inputs['Poly Egde'])
            verts = dataCorrect(verts)
            poly = dataCorrect(poly)
            if self.inputs['Mask'].links:
                mask = SvGetSocketAnyType(self, self.inputs['Mask'])
            else:
                mask = [[1, 0]]
            has_true_out = True
            has_false_out = False
            verts_out = []
            poly_edge_out = []
            for ve, pe, ma in zip(verts, poly, repeat_last(mask)):
                current_mask = islice(cycle(ma), len(ve))
                vert_index = [i for i, m in enumerate(current_mask) if m]
                if len(vert_index) < len(ve):
                    index_set = set(vert_index)
                    if has_true_out:
                        vert_dict = {j: i for i, j in enumerate(vert_index)}
                        new_vert = [ve[i] for i in vert_index]
                        is_ss = index_set.issuperset
                        new_pe = [[vert_dict[n] for n in fe] for fe in pe
                                  if is_ss(fe)]
                        verts_out.append(new_vert)
                        poly_edge_out.append(new_pe)

                else:  # no reprocessing needed
                    verts_out.append(ve)
                    poly_edge_out.append(pe)

            if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
                SvSetSocketAnyType(self, 'Vertices', verts_out)

            if 'Poly Egde' in self.outputs and self.outputs['Poly Egde'].links:
                if poly_edge_out:
                    SvSetSocketAnyType(self, 'Poly Egde', poly_edge_out)
Beispiel #16
0
    def update(self):
        if not any([s.links for s in self.outputs]):
            return

        if 'Vertices' in self.inputs and self.inputs['Vertices'].links and \
           'PolyEdge' in self.inputs and self.inputs['PolyEdge'].links:

            verts = Vector_generate(SvGetSocketAnyType(self, self.inputs['Vertices']))
            polys = SvGetSocketAnyType(self, self.inputs['PolyEdge'])
            if 'Distance' in self.inputs:
                distance = self.inputs['Distance'].sv_get()[0]
            else:
                distance = [self.distance]
            if 'Doubles' in self.outputs:
                has_double_out = bool('Doubles' in self.outputs)

            verts_out = []
            edges_out = []
            polys_out = []
            d_out = []

            for v, p, d in zip(verts, polys, repeat_last(distance)):
                res = remove_doubles(v, p, d, has_double_out)
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])
                d_out.append(res[3])

            if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
                SvSetSocketAnyType(self, 'Vertices', verts_out)

            if 'Edges' in self.outputs and self.outputs['Edges'].links:
                SvSetSocketAnyType(self, 'Edges', edges_out)

            if 'Polygons' in self.outputs and self.outputs['Polygons'].links:
                SvSetSocketAnyType(self, 'Polygons', polys_out)

            if 'Doubles' in self.outputs and self.outputs['Doubles'].links:
                SvSetSocketAnyType(self, 'Doubles', d_out)
Beispiel #17
0
    def update(self):
        if not any([s.links for s in self.outputs]):
            return

        if 'Vertices' in self.inputs and self.inputs['Vertices'].links and \
           'PolyEdge' in self.inputs and self.inputs['PolyEdge'].links:

            verts = Vector_generate(SvGetSocketAnyType(self, self.inputs['Vertices']))
            polys = SvGetSocketAnyType(self, self.inputs['PolyEdge'])
            if 'Distance' in self.inputs:
                distance = self.inputs['Distance'].sv_get()[0]
            else:
                distance = [self.distance]
            if 'Doubles' in self.outputs:
                has_double_out = bool('Doubles' in self.outputs)

            verts_out = []
            edges_out = []
            polys_out = []
            d_out = []

            for v, p, d in zip(verts, polys, repeat_last(distance)):
                res = remove_doubles(v, p, d, has_double_out)
                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])
                d_out.append(res[3])

            if 'Vertices' in self.outputs and self.outputs['Vertices'].links:
                SvSetSocketAnyType(self, 'Vertices', verts_out)

            if 'Edges' in self.outputs and self.outputs['Edges'].links:
                SvSetSocketAnyType(self, 'Edges', edges_out)

            if 'Polygons' in self.outputs and self.outputs['Polygons'].links:
                SvSetSocketAnyType(self, 'Polygons', polys_out)

            if 'Doubles' in self.outputs and self.outputs['Doubles'].links:
                SvSetSocketAnyType(self, 'Doubles', d_out)
Beispiel #18
0
    def update(self):
        if not ('vertices' in self.outputs and self.outputs['vertices'].links
                or 'edges' in self.outputs and self.outputs['edges'].links or
                'polygons' in self.outputs and self.outputs['polygons'].links):
            return

        if 'vertices' in self.inputs and self.inputs['vertices'].links and \
           'polygons' in self.inputs and self.inputs['polygons'].links:

            verts = Vector_generate(
                SvGetSocketAnyType(self, self.inputs['vertices']))
            polys = SvGetSocketAnyType(self, self.inputs['polygons'])
            if 'thickness' in self.inputs:
                thickness = self.inputs['thickness'].sv_get()[0]
            else:
                thickness = [self.thickness]
            verts_out = []
            edges_out = []
            polys_out = []
            for v, p, t in zip(verts, polys, repeat_last(thickness)):
                res = wireframe(v, p, t, self.offset, self.replace,
                                self.boundary, self.even_offset,
                                self.relative_offset)

                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])

            if 'vertices' in self.outputs and self.outputs['vertices'].links:
                SvSetSocketAnyType(self, 'vertices', verts_out)

            if 'edges' in self.outputs and self.outputs['edges'].links:
                SvSetSocketAnyType(self, 'edges', edges_out)

            if 'polygons' in self.outputs and self.outputs['polygons'].links:
                SvSetSocketAnyType(self, 'polygons', polys_out)
Beispiel #19
0
    def update(self):
        if not ('vertices' in self.outputs and self.outputs['vertices'].links or
                'edges' in self.outputs and self.outputs['edges'].links or
                'polygons' in self.outputs and self.outputs['polygons'].links):
            return

        if 'vertices' in self.inputs and self.inputs['vertices'].links and \
           'polygons' in self.inputs and self.inputs['polygons'].links:

            verts = Vector_generate(SvGetSocketAnyType(self, self.inputs['vertices']))
            polys = SvGetSocketAnyType(self, self.inputs['polygons'])
            if 'thickness' in self.inputs:
                thickness = self.inputs['thickness'].sv_get()[0]
            else:
                thickness = [self.thickness]
            verts_out = []
            edges_out = []
            polys_out = []
            for v, p, t in zip(verts, polys, repeat_last(thickness)):
                res = wireframe(v, p, t, self.offset,
                                self.replace, self.boundary, self.even_offset, self.relative_offset)

                if not res:
                    return
                verts_out.append(res[0])
                edges_out.append(res[1])
                polys_out.append(res[2])

            if 'vertices' in self.outputs and self.outputs['vertices'].links:
                SvSetSocketAnyType(self, 'vertices', verts_out)

            if 'edges' in self.outputs and self.outputs['edges'].links:
                SvSetSocketAnyType(self, 'edges', edges_out)

            if 'polygons' in self.outputs and self.outputs['polygons'].links:
                SvSetSocketAnyType(self, 'polygons', polys_out)
Beispiel #20
0
    def update(self):

        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            verts = SvGetSocketAnyType(self, self.inputs['Vertices'])

            if 'PolyEdge' in self.inputs and self.inputs['PolyEdge'].links:
                poly_edge = SvGetSocketAnyType(self, self.inputs['PolyEdge'])
                polyIn = True
            else:
                polyIn = False
                poly_edge = repeat_last([[]])

            verts_out = []
            poly_edge_out = []
            item_order = []

            polyOutput = bool(polyIn and 'PolyEdge' in self.outputs and self.outputs['PolyEdge'].links)
            orderOutput = bool('Item order' in self.outputs and self.outputs['Item order'].links)
            vertOutput = bool('Vertices' in self.outputs and self.outputs['Vertices'].links)

            if not any((vertOutput, orderOutput, polyOutput)):
                return

            if self.mode == 'XYZ':
                # should be user settable
                op_order = [(0, False),
                            (1, False),
                            (2, False)]

                for v, p in zip(verts, poly_edge):
                    s_v = ((e[0], e[1], e[2], i) for i, e in enumerate(v))

                    for item_index, rev in op_order:
                        s_v = sorted(s_v, key=itemgetter(item_index), reverse=rev)

                    verts_out.append([v[:3] for v in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append([list(map(lambda n:v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'DIST':
                if 'Base Point' in self.inputs and self.inputs['Base Point'].links:
                    base_points = SvGetSocketAnyType(self, self.inputs['Base Point'])
                    bp_iter = repeat_last(base_points[0])
                else:
                    bp = [(0, 0, 0)]
                    bp_iter = repeat_last(bp)

                for v, p, v_base in zip(verts, poly_edge, bp_iter):
                    s_v = sorted(((v_c, i) for i, v_c in enumerate(v)), key=lambda v: distK(v[0], v_base))
                    verts_out.append([vert[0] for vert in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append([list(map(lambda n:v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'AXIS':
                if 'Mat' in self.inputs and self.inputs['Mat'].links:
                    mat = Matrix_generate(SvGetSocketAnyType(self, self.inputs['Mat']))
                else:
                    mat = [Matrix. Identity(4)]
                mat_iter = repeat_last(mat)

                def f(axis, q):
                    if axis.dot(q.axis) > 0:
                        return q.angle
                    else:
                        return -q.angle

                for v, p, m in zip(Vector_generate(verts), poly_edge, mat_iter):
                    axis = m * Vector((0, 0, 1))
                    axis_norm = m * Vector((1, 0, 0))
                    base_point = m * Vector((0, 0, 0))
                    intersect_d = [intersect_point_line(v_c, base_point, axis) for v_c in v]
                    rotate_d = [f(axis, (axis_norm+v_l[0]).rotation_difference(v_c)) for v_c, v_l in zip(v, intersect_d)]
                    s_v = ((data[0][1], data[1], i) for i, data in enumerate(zip(intersect_d, rotate_d)))
                    s_v = sorted(s_v, key=itemgetter(0, 1))

                    verts_out.append([v[i[-1]].to_tuple() for i in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append([list(map(lambda n:v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'USER':
                if 'Index Data' in self.inputs and self.inputs['Index Data'].links:
                    index = SvGetSocketAnyType(self, self.inputs['Index Data'])
                else:
                    return

                for v, p, i in zip(verts, poly_edge, index):

                    s_v = sorted([(data[0], data[1], i) for i, data in enumerate(zip(i, v))], key=itemgetter(0))

                    verts_out.append([obj[1] for obj in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append([[v_index[k] for k in pe] for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if vertOutput:
                SvSetSocketAnyType(self, 'Vertices', verts_out)
            if polyOutput:
                SvSetSocketAnyType(self, 'PolyEdge', poly_edge_out)
            if orderOutput:
                SvSetSocketAnyType(self, 'Item order', item_order)
Beispiel #21
0
    def update(self):

        if 'Vertices' in self.inputs and self.inputs['Vertices'].links:
            verts = SvGetSocketAnyType(self, self.inputs['Vertices'])

            if 'PolyEdge' in self.inputs and self.inputs['PolyEdge'].links:
                poly_edge = SvGetSocketAnyType(self, self.inputs['PolyEdge'])
                polyIn = True
            else:
                polyIn = False
                poly_edge = repeat_last([[]])

            verts_out = []
            poly_edge_out = []
            item_order = []

            polyOutput = bool(polyIn and 'PolyEdge' in self.outputs
                              and self.outputs['PolyEdge'].links)
            orderOutput = bool('Item order' in self.outputs
                               and self.outputs['Item order'].links)
            vertOutput = bool('Vertices' in self.outputs
                              and self.outputs['Vertices'].links)

            if not any((vertOutput, orderOutput, polyOutput)):
                return

            if self.mode == 'XYZ':
                # should be user settable
                op_order = [(0, False), (1, False), (2, False)]

                for v, p in zip(verts, poly_edge):
                    s_v = ((e[0], e[1], e[2], i) for i, e in enumerate(v))

                    for item_index, rev in op_order:
                        s_v = sorted(s_v,
                                     key=itemgetter(item_index),
                                     reverse=rev)

                    verts_out.append([v[:3] for v in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append(
                            [list(map(lambda n: v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'DIST':
                if 'Base Point' in self.inputs and self.inputs[
                        'Base Point'].links:
                    base_points = SvGetSocketAnyType(self,
                                                     self.inputs['Base Point'])
                    bp_iter = repeat_last(base_points[0])
                else:
                    bp = [(0, 0, 0)]
                    bp_iter = repeat_last(bp)

                for v, p, v_base in zip(verts, poly_edge, bp_iter):
                    s_v = sorted(((v_c, i) for i, v_c in enumerate(v)),
                                 key=lambda v: distK(v[0], v_base))
                    verts_out.append([vert[0] for vert in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append(
                            [list(map(lambda n: v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'AXIS':
                if 'Mat' in self.inputs and self.inputs['Mat'].links:
                    mat = Matrix_generate(
                        SvGetSocketAnyType(self, self.inputs['Mat']))
                else:
                    mat = [Matrix.Identity(4)]
                mat_iter = repeat_last(mat)

                def f(axis, q):
                    if axis.dot(q.axis) > 0:
                        return q.angle
                    else:
                        return -q.angle

                for v, p, m in zip(Vector_generate(verts), poly_edge,
                                   mat_iter):
                    axis = m * Vector((0, 0, 1))
                    axis_norm = m * Vector((1, 0, 0))
                    base_point = m * Vector((0, 0, 0))
                    intersect_d = [
                        intersect_point_line(v_c, base_point, axis)
                        for v_c in v
                    ]
                    rotate_d = [
                        f(axis, (axis_norm + v_l[0]).rotation_difference(v_c))
                        for v_c, v_l in zip(v, intersect_d)
                    ]
                    s_v = (
                        (data[0][1], data[1], i)
                        for i, data in enumerate(zip(intersect_d, rotate_d)))
                    s_v = sorted(s_v, key=itemgetter(0, 1))

                    verts_out.append([v[i[-1]].to_tuple() for i in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append(
                            [list(map(lambda n: v_index[n], pe)) for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if self.mode == 'USER':
                if 'Index Data' in self.inputs and self.inputs[
                        'Index Data'].links:
                    index = SvGetSocketAnyType(self, self.inputs['Index Data'])
                else:
                    return

                for v, p, i in zip(verts, poly_edge, index):

                    s_v = sorted([(data[0], data[1], i)
                                  for i, data in enumerate(zip(i, v))],
                                 key=itemgetter(0))

                    verts_out.append([obj[1] for obj in s_v])

                    if polyOutput:
                        v_index = {item[-1]: j for j, item in enumerate(s_v)}
                        poly_edge_out.append([[v_index[k] for k in pe]
                                              for pe in p])
                    if orderOutput:
                        item_order.append([i[-1] for i in s_v])

            if vertOutput:
                SvSetSocketAnyType(self, 'Vertices', verts_out)
            if polyOutput:
                SvSetSocketAnyType(self, 'PolyEdge', poly_edge_out)
            if orderOutput:
                SvSetSocketAnyType(self, 'Item order', item_order)