def print_children(label):
    tool = TDF.TDF_Tool()
    itr = TDF.TDF_ChildIterator(label, True)
    while itr.More():
        val = itr.Value()
        output = TCollection.TCollection_AsciiString()
        tool.Entry(val, output)
        entry = output.ToCString()
        print "entry", entry
        itr.Next()
    print "end iteration"
Example #2
0
    def _TDF_Label_changed(self, new_label):
        tool = TDF.TDF_Tool()
        output = TCollection.TCollection_AsciiString()
        tool.entry(new_label, output)
        entry = output.ToCString()
        self.entry = entry

        itr = TDF.TDF_AttributeIterator(new_label, False)
        attrs = []
        while itr.More():
            val = itr.Value()
            #print val
            a = Attribute(TDF_Attribute=val)
            #print val, "->", a.Downcast()
            attrs.append(a)
            itr.Next()
        self.attributes = attrs
tr = gp.gp_Trsf()
tr.SetTranslation(gp.gp_Vec(150, 200, 100))
loc = TopLoc.TopLoc_Location(tr)
cyl_comp = shape_tool.AddComponent(top_label, cyl_label, loc)

print "Is Assembly", shape_tool.IsAssembly(top_label)  #it is now...

#
# Add some colors
#
red = Quantity.Quantity_Color(Quantity.Quantity_NOC_RED)
green = Quantity.Quantity_Color(Quantity.Quantity_NOC_GREEN)
colors.SetColor(cyl_comp, red, XCAFDoc.XCAFDoc_ColorGen)
colors.SetColor(box_comp2, green, XCAFDoc.XCAFDoc_ColorGen)

tag_tool = TDF.TDF_Tool()
tagList = TColStd.TColStd_ListOfInteger()
tag_tool.TagList(cyl_comp, tagList)
iterTagList = TColStd.TColStd_ListIteratorOfListOfInteger(tagList)
while iterTagList.More():
    v = iterTagList.Value()
    iterTagList.Next()

asc = TCollection.TCollection_AsciiString()
tag_tool.Entry(cyl_comp, asc)
print asc.ToCString()

#for a in dir(v): print a

#mode = STEPControl.STEPControl_AsIs
#writer = STEPCAFControl.STEPCAFControl_Writer()