def all_beams(self): """for each beam in the object. returns the start and end nodes. """ num_splines = mxs.numsplines(self.max_object) all_beams = [] for spline_no in range(1, num_splines + 1): num_knots = mxs.numknots(self.max_object, spline_no) knot_pair = [] for knot_no in range(1, num_knots + 1): pos_string = str(mxs.getKnotPoint(self.max_object, spline_no, knot_no)) pos = Node.Node(pos_string[1:-1].split(",")) knot_pair.append(pos) all_beams.append(sorted(knot_pair)) return sorted(all_beams)
def _read_nodes(self, beam_objs): """get a list of nodes that form part of each beam object. Nodes which terminate at the same place have not yet been deleted... This is literally a list of all the knots which are at a certain point""" knots = [] for beam_obj in beam_objs: beam_obj = beam_obj.max_object for spline_no in range(mxs.numsplines(beam_obj)): spline_no += 1 for knot_no in range(mxs.numknots(beam_obj, spline_no)): knot_no += 1 knots.append(str(mxs.getKnotPoint(beam_obj, spline_no, knot_no))) node_list = [] for knot in knots: node_list.append(Node.Node(knot)) return sorted(node_list)
def all_beams(self): """Gets a list of pairs of node objects, representing the positions of the nodes of each beam in the beam object """ self._check_is_spline_shape() self._split_lines() num_splines = mxs.numsplines(self.max_object) all_beams = [] for spline_no in range(1, num_splines + 1): num_knots = mxs.numknots(self.max_object, spline_no) knot_pair = [] for knot_no in range(1, num_knots + 1): pos_string = str(mxs.getKnotPoint(self.max_object, spline_no, knot_no)) pos = Node.Node(pos_string) knot_pair.append(pos) all_beams.append(sorted(knot_pair)) return sorted(all_beams)