Ejemplo n.º 1
0
def sim_rule_L111(SS, PARA):
    print 'group pillars only'
    SS = ssgtools.find_terminal_nodes(SS)
    S_list = []
    E_list = []
    for h in range(len(SS)):  # each slices
        for k in range(len(SS[h])):  # each contour
            for m in range(len(SS[h][k])):  # each node
                if SS[h][k][m].start and not (
                        SS[h][k][m].end):  # get isolated "start" nodes
                    S_list.append(SS[h][k][m])
                if SS[h][k][m].end and not (SS[h][k][m].start):
                    E_list.append(SS[h][k][m])

    for e in E_list:
        mindist = 999999  # max
        minnode = None
        for s in S_list:
            if s.index_h > e.index_h:  # find it below slices
                dist = ssgtools.L2dist(e, s)
                if dist < mindist:
                    mindist = dist
                    minnode = s
        if minnode and mindist < PARA.group_pillar_dist:  # 15
            if e.PPP and len(minnode.PJP) == 0 and len(e.LJP) == 0:  # pillar
                e.LJP.append(minnode)
                minnode.PJP.append(e)
    return SS
Ejemplo n.º 2
0
def sim_rule_L34(SS, PARA):
    SS = ssgtools.clearTBDmarker(SS)
    SS = ssgtools.find_terminal_nodes(SS)

    # for short pillars
    if 1:
        for h in range(len(SS)):  # each slices
            for k in range(len(SS[h])):  # each contour
                for m in range(len(SS[h][k])):  # each node
                    if 0 and SS[h][k][m].LPP:
                        #SS[h][k][m].DEBUG = True
                        pass
                    if 0 and SS[h][k][m].start:
                        #SS[h][k][m].DEBUG = True
                        pass
                    if 1 and (SS[h][k][m].start and len(SS[h][k][m].LJP) == 0
                              and SS[h][k][m].LPP.end
                              and len(SS[h][k][m].LPP.PJP) == 0):
                        #SS[h][k][m].TBDELETED = True
                        #SS[h][k][m].LPP.TBDELETED = True  # DO NOT DELETE! it can be a corner

                        #SS[h][k][m].DEBUG = True
                        #SS[h][k][m].LPP.DEBUG = True

                        SS[h][k][m].start = None
                        SS[h][k][m].LPP.end = None
                        SS[h][k][m].LPP.PPP = None
                        SS[h][k][m].LPP = None
        #deletenode_marked(SS)

    # for short joists
    if 1:
        for h in range(len(SS)):  # each slices
            for k in range(len(SS[h])):  # each contour
                for m in range(len(SS[h][k])):  # each node
                    if (SS[h][k][m].start and len(SS[h][k][m].LJP) == 1
                            and SS[h][k][m].LJP[0].end
                            and len(SS[h][k][m].LJP[0].PJP) == 1):
                        #SS[h][k][m].TBDELETED = True
                        #SS[h][k][m].LPP.TBDELETED = True  # DO NOT DELETE! it can be a corner

                        #SS[h][k][m].DEBUG = True
                        #SS[h][k][m].LJP[0].DEBUG = True

                        SS[h][k][m].start = None
                        SS[h][k][m].LJP[0].end = None
                        SS[h][k][m].LJP[0].PJP = []
                        SS[h][k][m].LJP = []
    return SS
Ejemplo n.º 3
0
def sim_rule_L16(SS, PARA):
    print 'aligning connected pillars and joists'

    SS = ssgtools.find_terminal_nodes(SS)
    S_list = []
    for h in range(len(SS)):  # each slices
        for k in range(len(SS[h])):  # each contour
            for m in range(len(SS[h][k])):  # each node
                if SS[h][k][m].start and not (
                        SS[h][k][m].end):  # get isolated "start" nodes
                    S_list.append(SS[h][k][m])
                    #SS[h][k][m].DEBUG = True

    for e in S_list:
        LIST = []
        pts = e
        while (pts != None):
            LIST.append(pts)
            if pts.LPP:
                pts = pts.LPP
            elif len(pts.LJP) > 0:
                pts = pts.LJP[0]
            else:
                pts = None

        # skip nodes if there are more than 2 joist at the starting points
        if 0 and len(LIST) > 3:
            if len(LIST[0].LJP) > 0 and len(LIST[1].LJP) > 0:
                LIST.pop(0)
                LIST.pop(0)
                for t in range(len(LIST)):  # find the first index of LPP
                    if LIST[t].LPP:
                        break
                for i in range(t):
                    LIST.pop(0)

        # compute AVG x,y
        sum_x = 0.0
        sum_y = 0.0
        for i in LIST:
            sum_x = sum_x + i.x
            sum_y = sum_y + i.y
        avg_x = sum_x / float(len(LIST))
        avg_y = sum_y / float(len(LIST))
        # replace x,y
        for i in LIST:
            i.x = avg_x
            i.y = avg_y
    return SS
Ejemplo n.º 4
0
def sim_rule_L11(SS, PARA):
    print 'group joists/pillars'
    SS = ssgtools.find_terminal_nodes(SS)
    S_list = []
    E_list = []
    for h in range(len(SS)):  # each slices
        for k in range(len(SS[h])):  # each contour
            for m in range(len(SS[h][k])):  # each node
                if SS[h][k][m].start and not (
                        SS[h][k][m].end):  # get isolated "start" nodes
                    S_list.append(SS[h][k][m])
                    SS[h][k][m].index_h = h
                    SS[h][k][m].index_k = k
                    SS[h][k][m].index_m = m
                if SS[h][k][m].end and not (SS[h][k][m].start):
                    E_list.append(SS[h][k][m])
                    SS[h][k][m].index_h = h
                    SS[h][k][m].index_k = k
                    SS[h][k][m].index_m = m

    for e in E_list:
        mindist = 999999  # max
        minnode = None
        for s in S_list:
            if s.index_h > e.index_h:  # find it below slices
                dist = ssgtools.L2dist(e, s)
                if dist < mindist:
                    mindist = dist
                    minnode = s
        if minnode and mindist < PARA.joist_dist:  # 15
            if not (e.PPP):  # joist type
                e.LJP.append(minnode)
                minnode.PJP.append(e)
                #e.end = False
                #minnode.start = False
            else:  # pillar
                e.LPP = minnode
                minnode.PPP = e
                #e.end = False
                #minnode.start = False
    return SS
Ejemplo n.º 5
0
def sim_rule_L12(SS, PARA):
    print 'group two end of joists'
    SS = ssgtools.find_terminal_nodes(SS)
    S_list = []
    E_list = []
    for h in range(len(SS)):  # each slices
        for k in range(len(SS[h])):  # each contour
            for m in range(len(SS[h][k])):  # each node
                if SS[h][k][m].start and not (
                        SS[h][k][m].end):  # get isolated "start" nodes
                    S_list.append(SS[h][k][m])
                    SS[h][k][m].index_h = h
                    SS[h][k][m].index_k = k
                    SS[h][k][m].index_m = m
                if SS[h][k][m].end and not (SS[h][k][m].start):
                    E_list.append(SS[h][k][m])
                    SS[h][k][m].index_h = h
                    SS[h][k][m].index_k = k
                    SS[h][k][m].index_m = m

    for e1 in E_list:
        mindist = 999999  # max
        minnode = None
        for e2 in E_list:
            if e1.index_h == e2.index_h and e1 != e2:  # find it on the same slice
                dist = ssgtools.L2dist(e1, e2)
                if dist < mindist:
                    mindist = dist
                    minnode = e2
        if minnode and mindist < PARA.joist_dist:
            if not (e1.PPP) and not (minnode.PPP):  # joist type
                e1.x = (e1.x + minnode.x) / 2.0
                e1.y = (e1.y + minnode.y) / 2.0
                minnode.x = (e1.x + minnode.x) / 2.0
                minnode.y = (e1.y + minnode.y) / 2.0
                #e1.corner = 2
                #minnode.corner = 2
            else:  # pillar
                pass
    return SS