Esempio n. 1
0
    def update_naming(self, make_shape):
        label = self.label
        shape = make_shape.Shape()

        input_shape = make_shape.Shape1()
        tool_shape = make_shape.Shape2()

        builder = TNaming.TNaming_Builder(label)
        builder.Generated(input_shape, shape)
        builder.Generated(tool_shape, shape)

        gen_label = label.FindChild(1)
        mod_label = label.FindChild(2)
        del_label = label.FindChild(3)

        gen_builder = TNaming.TNaming_Builder(gen_label)
        mod_builder = TNaming.TNaming_Builder(mod_label)
        del_builder = TNaming.TNaming_Builder(del_label)

        if make_shape.HasGenerated():
            for in_shape in [input_shape, tool_shape]:
                for face in Topo(in_shape).faces():
                    gen_shapes = make_shape.Generated(face)
                    itr = TopTools.TopTools_ListIteratorOfListOfShape(
                        gen_shapes)
                    while itr.More():
                        this = itr.Value()
                        gen_builder.Generated(face, this)
                        print "generated", face, this
                        itr.Next()

        if make_shape.HasModified():
            for face in Topo(input_shape).faces():
                mod_shapes = make_shape.Modified(face)
                itr = TopTools.TopTools_ListIteratorOfListOfShape(mod_shapes)
                while itr.More():
                    this = itr.Value()
                    mod_builder.Modify(face, this)
                    print "modified", face, this
                    itr.Next()

            for face in Topo(tool_shape).faces():
                mod_shapes = make_shape.Modified2(face)
                itr = TopTools.TopTools_ListIteratorOfListOfShape(mod_shapes)
                while itr.More():
                    this = itr.Value()
                    mod_builder.Modify(face, this)
                    print "modified2", face, this
                    itr.Next()

        if make_shape.HasDeleted():
            for face in Topo(input_shape).faces():
                if make_shape.IsDeleted(face):
                    del_builder.Delete(face)
            for face in Topo(tool_shape).faces():
                if make_shape.IsDeleted(face):
                    del_builder.Delete(face)
Esempio n. 2
0
def listFromTopToolsListOfShape(listOfShape):
    newList = []
    iterator = TopTools.TopTools_ListIteratorOfListOfShape(listOfShape)
    while iterator.More():
        newList.append(cast(iterator.Value()))
        iterator.Next()

    return newList
Esempio n. 3
0
 def update_naming(self, make_shape):
     label = self.label
     shape = make_shape.Shape()
     
     input_shape = make_shape.Shape()
     
     builder = TNaming.TNaming_Builder(label)
     builder.Generated(input_shape, shape)
     
     #FindChild creates a new label, if one doesn't exist.
     #Label entry numbers are not necessarily incremental.
     #They are more like dictionary keys.
     gen_label = label.FindChild(1)
     mod_label = label.FindChild(2)
     del_label = label.FindChild(3)
     
     gen_builder = TNaming.TNaming_Builder(gen_label)
     mod_builder = TNaming.TNaming_Builder(mod_label)
     del_builder = TNaming.TNaming_Builder(del_label)
     
     topo = Topo(input_shape)
     
     for face in topo.faces():
         gen_shapes = make_shape.Generated(face)
         itr = TopTools.TopTools_ListIteratorOfListOfShape(gen_shapes)
         while itr.More():
             this = itr.Value()
             gen_builder.Generated(face, this)
             print "generated", face, this
             itr.Next()
                     
     for face in topo.faces():
         mod_shapes = make_shape.Modified(face)
         itr = TopTools.TopTools_ListIteratorOfListOfShape(mod_shapes)
         while itr.More():
             this = itr.Value()
             mod_builder.Modified(face, this)
             print "modified", face, this
             itr.Next()
                     
     for face in topo.faces():
         if make_shape.IsDeleted(face):
             del_builder.Delete(face)