Example #1
0
 def on_change_selection(self):
     new_id = self.edge_id
     input = self.input
     label = self.label
     
     if not all((input, label)): return
     
     input_shape = input.shape
     
     sel_label = self.label.FindChild(4)
     selector = TNaming.TNaming_Selector(sel_label)
     
     self.selector = selector
     
     topo = Topo(input_shape)
     self._n_edges = topo.number_of_edges()
     for i,edge in enumerate(topo.edges()):
         if i==new_id:
             selector.Select(edge, input_shape)
             print "got selection!"
             break
     else:
         print "no selection"
         
     self.modified = False
     self.modified = True
##
##Name all the subshape we *might* want to refer to later
##
for edge in topo.edges():
    sub_label = ts.NewChild(box_label)
    ns_builder = TNaming.TNaming_Builder(sub_label)
    ns_builder.Generated(edge)

#
#Find and Name an edge
#
an_edge = topo.edges().next()

s_label = ts.NewChild(root)
selector = TNaming.TNaming_Selector(s_label)
ret = selector.Select(an_edge, box)
print "selected", ret

#
#now modify the box
#

box2 = BRepPrimAPI.BRepPrimAPI_MakeBox(5.0, 10.0, 15.0).Shape()

#
#Update the naming with the new box shape
#

ns_builder = TNaming.TNaming_Builder(box_label)
ns_builder.Generated(box2)