예제 #1
0
파일: UI.py 프로젝트: CaioSR/GUI
def drawCurve():
    points = [p[-4], p[-3], p[-2], p[-1]]

    generatedPoints = p[-4].connectCurve([p[-3], p[-2], p[-1]], matriz, grid)

    curve = []
    for point in generatedPoints:
        curve.append(classes.Point(matriz[point[1]][point[0]], point))

    for point in points:
        point.widget.configure(bg='white')

    for point in curve:
        point.widget.configure(bg='blue')

    cur.append(classes.Curve(points, curve))

    del p[:]
예제 #2
0
파일: UI.py 프로젝트: CaioSR/GUI
def drawCircle():

    r, generatedPoints = p[-2].connectCircle(newPoint=p[-1])

    circle = []
    for point in generatedPoints:
        if point[0] >= 0 and point[1] >= 0 and point[
                0] <= grid.xsize - 1 and point[1] <= grid.ysize - 1:
            circle.append(classes.Point(matriz[point[1]][point[0]], point))

    p[-2].widget.configure(bg='white')
    p[-1].widget.configure(bg='white')

    for point in circle:
        point.widget.configure(bg='blue')

    c.append(classes.Circle(p[-2], r, circle))

    del p[:]
예제 #3
0
파일: UI.py 프로젝트: CaioSR/GUI
def drawLine():
    generatedPoints = p[-2].connectPoints(p[-1])

    line = []
    for point in generatedPoints:
        line.append(classes.Point(matriz[point[1]][point[0]], point))

    for point in line:
        point.widget.configure(bg='blue')

    l.append(classes.Line(line))

    newLine = l[-1]

    if l == []:
        newPoly = classes.Polyline()
        newPoly.addLine(newLine)
        po.append(newPoly)

    else:
        added = False
        polylineFound = None

        for poly in po:
            if poly.ifVertex(newLine):
                polylineFound = poly
                poly.addLine(newLine)
                added = True

        if polylineFound:
            for poly in po:
                if poly.ifVertex(newLine) and poly != polylineFound:
                    polylineFound.mergePolyline(poly)
                    po.remove(poly)

        if not added:
            newPoly = classes.Polyline()
            newPoly.addLine(newLine)
            po.append(newPoly)

    l.append(newLine)

    del p[:]
예제 #4
0
파일: UI.py 프로젝트: CaioSR/GUI
def releventPoint(widget):
    widget.configure(bg="black")
    point = option.getCoordinates(grid, widget)
    p.append(classes.Point(widget, point))
예제 #5
0
파일: main.py 프로젝트: bugaboo0612/FEMlib
    # Вывод заголовка и шапки таблицы
    print('{:^30}'.format('Таблица перемещений узлов:'))
    print('{:<5}|{:>10}|{:>10}|{:>10}'.format('№ уз.', 'X (мм)', 'Z (мм)',
                                              'Uy (рад*1000)'))
    print('{:_^30}'.format(''))
    # вывод результатов вычислений
    for pnt in list_of_points:
        print('{:<5}|{:>10.4f}|{:>10.4f}|{:>10.4f}'.format(
            pnt.number, pnt.displace_x * 1000, pnt.displace_z * 1000,
            pnt.rotate_y * 1000))


if __name__ == '__main__':
    # зададим список узлов в формате classes.Point(number, x, y, boundary_cond)
    lp = list([
        classes.Point(1, 0, 0, (1, 3)),
        classes.Point(2, 1, 0, (1, 3)),
        classes.Point(3, 0, 1, None),
        classes.Point(4, 1, 1, None),
    ])
    # зададим список узлов в формате:
    # classes.LineTriFE(number, E, v, h, *pnt) для плоских КЭ
    # classes.LineFE(number, E, b, h, *pnt) для стержневых КЭ
    le = list([
        classes.LineTriFE(1, 2.9e6, 0.2, 0.1, lp[0], lp[1], lp[3]),
        classes.LineTriFE(2, 2.9e6, 0.2, 0.1, lp[0], lp[3], lp[2]),
        classes.LineFE(3, 2.9e6, 0.2, 0.2, lp[2], lp[3])
    ])
    # вектор внешних сил
    P = np.array([0, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0])
    # вычисляем глобальную матрицу жесткости
예제 #6
0
import classes

p = classes.Point(2, 5)

print(p.x)
print(p.y)