Ejemplo n.º 1
0
 def _get_name(self):
     try:
         a = self.Downcast()
         name = TCollection.TCollection_AsciiString(a.Get())
         return name.ToCString()
     except:
         return "no name"
Ejemplo n.º 2
0
 def _get_name_attr(self):
     label = self.TDF_Label
     h_a = TDataStd.Handle_TDataStd_Name()
     gid = TDataStd.TDataStd_Name().ID()
     if label.FindAttribute(gid, h_a):
         a = h_a.GetObject()
         name = TCollection.TCollection_AsciiString(a.Get())
         return name.ToCString()
     else:
         return "no name"
Ejemplo n.º 3
0
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"
Ejemplo n.º 4
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
Ejemplo n.º 5
0
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()
#writer.Transfer(h_doc, mode)
#writer.Write("XDE_test.step")