def get_all_child_by_attr(obj, attrname=None):
    pnt = k3.Var()
    lchild = []
    n_list = k3.getcntobjga(obj)
    a_list = k3.VarArray(int(n_list))
    k3.scang(obj, a_list)
    for e in a_list:
        lchild.append(e.value)
    for e in lchild:
        if k3.getobjhold(e, pnt) > 0:
            if k3.compareobj(panel, obj) > 0:
                pass
            elif e not in lchild:
                lchild.append(e)
    lresult = []
    if not attrname is None:
        for e in lchild:
            if k3.isassign(attrname, e) > 0:
                lresult.append(e)
    else:
        lresult = lchild
    return lresult
    # Rubb = {}
    ArrPans = Ut.getListArrayAllObjectsScene(
        AttrFilter='left(furntype,2)==\"01\"')
    ArrBoxs = Ut.getListArrayAllObjectsScene(
        AttrFilter='left(furntype,4)==\"3101\"')
    ArrDsys = Ut.getListArrayAllObjectsScene(AttrFilter='furntype==\"210000\"')
    ArrRubb = Ut.getListArrayAllObjectsScene(
        AttrFilter='left(furntype,5)==\"10001\"')

    psc = k3.Var('psc')

    # Панели
    for elem in [elem for Arr in ArrPans for elem in Arr]:
        obj = elem.value
        if isinstance(obj, k3.K3Obj):
            if k3.isassign("FurnType", obj):
                tt = k3.getattr(obj, "FurnType", "")
            else:
                tt = 'xxxxxx'
            # находим панели, но не полотна панелей
            if tt[:2] == '01' and tt[2:] in ['0000', '1000']:
                continue
            Number = k3.getattr(obj, "Number", "")
            # Pans[obj] = Number
            if Number in Pans:
                Pans[Number].append(obj)
            else:
                Pans[Number] = [obj]

    # Ящики
    Boxs = GetChildPans(ArrBoxs)
 
 NameAtrPos="CommonPos"
 
 Pans = {}
 Dsys = {}
 ArrPans = Ut.getListArrayAllObjectsScene(AttrFilter='left(furntype,2)==\"01\"')
 ArrBoxs = Ut.getListArrayAllObjectsScene(AttrFilter='left(furntype,4)==\"3101\"')
 ArrDsys = Ut.getListArrayAllObjectsScene(AttrFilter='furntype==\"210000\"')
 ArrRubb = Ut.getListArrayAllObjectsScene(AttrFilter='left(furntype,5)==\"10001\"')
 
 psc=k3.Var('psc')
 num = 0
 
 # Панели
 for obj in [elem.value for Arr in ArrPans for elem in Arr if isinstance(elem.value, k3.K3Obj)]:
     if k3.isassign("FurnType", obj):
         tt = k3.getattr(obj, "FurnType", "")
     else:
         tt = 'xxxxxx'
     # находим панели, но не полотна панелей
     if tt[:2] == '01' and tt[2:] in ['0000', '1000']:
         continue
     Number = k3.getattr(obj, "Number", "")
     if Number in Pans:
         Pans[Number].append(obj)
     else:
         Pans[Number] = [obj]
 
 # Ящики
 BxUn = {}
 # Находим одинаковые по составу панелей ящики
SumCostMat=k3.Var('SumCostMat')
Curline=k3.Var('Curline')
#NomID=k3.Var('NomID')
MatName=k3.Var('MatName')
TypeElem = '--'
ParG = {}
ParGF = {}
NameElem = {}
NameElemTmp = {}

psc=k3.Var('psc')

for Arr in listArrAllObjects:
    for elem in Arr:
        #elem = arr.array[ind]
        if k3.isassign("FurnType",elem.value):
            TopParentPos = k3.getattr(elem.value,'TopParentPos',-1)
            UPObj = k3.getattr(elem.value,'UnitPos',-1)
            # if TopParentPos==UnitPosObj or UnitPosObj==UPObj:
            # if TopParentPos in listUP: print(TopParentPos)
            # if UPObj in listUP: print(UPObj)
            if TopParentPos in listUP or UPObj in listUP:
                UnitPos = k3.getattr(elem.value,'UnitPos',0)
                ParentPos = k3.getattr(elem.value,'ParentPos',0)

                # tt=k3.getattr(elem.value,"FurnType","")
                if k3.isassign("SumCostInfo",elem.value):
                    ScrNum=k3.readscratch("SumCostInfo",elem.value)
                    if ScrNum>0:
                        i += 1
                        PriceID = k3.getattr(elem.value,'PriceID',0)