Example #1
0
def Cremona2(no, nomes, Linhas, countPF, dicPF):
    ptos1 = []
    dicUp = {}
    for i in range(countPF):
        if i == 0:
            Spt = dicPF[nomes[i]].PointAt(0)
            Ept = dicPF[nomes[i]].PointAt(1)
        else:
            if i == 1:
                cond1 = rs.PointCompare(dicPF[nomes[i - 1]].PointAt(0),
                                        dicPF[nomes[i]].PointAt(1), Tol)
                cond2 = rs.PointCompare(dicPF[nomes[i - 1]].PointAt(0),
                                        dicPF[nomes[i]].PointAt(0), Tol)
                if cond1 or cond2:
                    pAux3 = Spt
                    Spt = Ept
                    Ept = pAux3
            if rs.PointCompare(Ept, dicPF[nomes[i]].PointAt(1), Tol):
                ptAux1 = dicPF[nomes[i]].PointAt(1)
                ptAux2 = dicPF[nomes[i]].PointAt(0)
            else:
                ptAux1 = dicPF[nomes[i]].PointAt(0)
                ptAux2 = dicPF[nomes[i]].PointAt(1)
            Ept += (ptAux2 - ptAux1)
    vAux1 = Line(rs.CurveStartPoint(Linhas[-2]), Ept)
    vAux2 = Line(rs.CurveStartPoint(Linhas[-1]), Spt)
    F1 = gh.Move(rs.coerceline(Linhas[-2]), vAux1)[0]
    F2 = gh.Move(rs.coerceline(Linhas[-1]), vAux2)[0]
    inter = gh.LineXLine(F1, F2)[2]
    F1 = rs.AddLine(Ept, inter)
    F2 = rs.AddLine(inter, Spt)
    dicUp[nomes[-2]] = rs.coerceline(F1)
    dicUp[nomes[-1]] = rs.coerceline(F2)
    #-cargas e nomenclatura
    #teste de tração e compressão
    sin1 = TraComp(no, F1, rs.coerceline(Linhas[-2]), nomes[-2])
    sin2 = TraComp(no, F2, rs.coerceline(Linhas[-1]), nomes[-1])
    #valores das cargas
    carga1 = rs.CurveLength(F1) * sin1 / Escala
    carga2 = rs.CurveLength(F2) * sin2 / Escala
    #teste de tensão admissivel
    cor1 = teste_elemento(nomes[-2], carga1, Linhas[-2])
    cor2 = teste_elemento(nomes[-1], carga2, Linhas[-1])
    #nomenclatura do FG
    txt1 = nomes[-2] + ' = ' + str('%.2f' % carga1)
    txt2 = nomes[-1] + ' = ' + str('%.2f' % carga2)
    pt1 = rs.coerceline(Linhas[-2]).PointAt(.5)
    pt2 = rs.coerceline(Linhas[-1]).PointAt(.5)
    ptos1 += [pt1, txt1, cor1]
    ptos1 += [pt2, txt2, cor2]
    #nimenclatura do PF
    pt1 = rs.coerceline(F1).PointAt(.5)
    pt2 = rs.coerceline(F2).PointAt(.5)
    txt1 = nomes[-2]
    txt2 = nomes[-1]
    ptos1 += [pt1, txt1, cor1]
    ptos1 += [pt2, txt2, cor2]

    return dicUp, ptos1
Example #2
0
def elemntos_node(no, eList, nome_lista, nome_viga):
    Nomes = []
    elementos = []
    for K in range(len(eList)):
        p1 = rs.CurveEndPoint(eList[K])
        p2 = rs.CurveStartPoint(eList[K])
        if rs.PointCompare(no, p1, Tol) or rs.PointCompare(no, p2, Tol):
            Nomes.append(nome_lista + str(K) + "_" + nome_viga)
            elementos.append(eList[K])
    return elementos, Nomes
Example #3
0
 def test_CurrentCPlaneWithFirstPointOffThePlane(self):
     plane = rs.WorldXYPlane()
     id = rs.AddLinearDimension(plane, (1, 1, 2), (11, 1, 0), (1, 3, 0))
     d = coerceannotation(id).Geometry
     ln1End = plane.PointAt(d.ExtensionLine1End.X, d.ExtensionLine1End.Y)
     ln2End = plane.PointAt(d.ExtensionLine2End.X, d.ExtensionLine2End.Y)
     self.assertTrue(
         rs.PointCompare(ln1End, (1, 1, 2), doc.ModelAbsoluteTolerance))
     self.assertTrue(
         rs.PointCompare(ln2End, (11, 1, 2), doc.ModelAbsoluteTolerance))
Example #4
0
 def test_get_arc_cap_works(self):
     offset = 2
     radius = 1
     pntA, pntB, pntC = edgeGeom.get_arc_cap((
         0.0,
         0.0,
         0.0,
     ), (5.0, 0.0, 0.0), offset, radius)
     self.assertTrue(rs.PointCompare(pntB, (offset, 0.0, 0.0)))
     self.assertTrue(rs.PointCompare(pntA, (offset + radius, -radius, 0.0)))
     self.assertTrue(rs.PointCompare(pntC, (offset + radius, radius, 0.0)))
     rs.AddArc3Pt(pntA, pntC, pntB)
Example #5
0
def Cremona1(no, nomes, Linhas, countPF, dicPF):
    ptos1 = []
    dicUp = {}
    for i in range(countPF):
        if i == 0:
            Spt = dicPF[nomes[i]].PointAt(0)
            Ept = dicPF[nomes[i]].PointAt(1)
        else:
            if i == 1:
                cond1 = rs.PointCompare(dicPF[nomes[i - 1]].PointAt(0),
                                        dicPF[nomes[i]].PointAt(1), Tol)
                cond2 = rs.PointCompare(dicPF[nomes[i - 1]].PointAt(0),
                                        dicPF[nomes[i]].PointAt(0), Tol)
                if cond1 or cond2:
                    pAux3 = Spt
                    Spt = Ept
                    Ept = pAux3

            if rs.PointCompare(Ept, dicPF[nomes[i]].PointAt(1), Tol):
                ptAux1 = dicPF[nomes[i]].PointAt(1)
                ptAux2 = dicPF[nomes[i]].PointAt(0)
            else:
                ptAux1 = dicPF[nomes[i]].PointAt(0)
                ptAux2 = dicPF[nomes[i]].PointAt(1)
            Ept += (ptAux2 - ptAux1)
    F1 = rs.AddLine(Ept, Spt)
    #verificar o paralelismo entre F1 no PF e FG
    vec1 = rs.VectorCreate(rs.CurveEndPoint(Linhas[-1]),
                           rs.CurveStartPoint(Linhas[-1]))
    vec2 = rs.VectorCreate(Spt, Ept)
    if rs.IsVectorParallelTo(vec2, vec1):
        print '______Paralelismo______'
    #colovcando F1 no dicionario do PF
    dicUp[nomes[-1]] = rs.coerceline(F1)
    #-cargas e nomenclatura
    #teste de tração e compressão
    sin1 = TraComp(no, F1, rs.coerceline(Linhas[-1]), nomes[-1])
    #valores das cargas
    carga1 = rs.CurveLength(F1) * sin1 / Escala
    #teste de tensão admissivel
    cor1 = teste_elemento(nomes[-1], carga1, Linhas[-1])
    #nomenclatura do FG
    txt1 = nomes[-1] + ' = ' + str('%.2f' % carga1)
    pt1 = rs.coerceline(Linhas[-1]).PointAt(.5)
    ptos1 += [pt1, txt1, cor1]
    #nomenclatura do PF
    pt1 = rs.coerceline(F1).PointAt(.5)
    txt1 = nomes[-1]
    ptos1 += [pt1, txt1, cor1]
    return dicUp, ptos1
Example #6
0
def get_boundary_indecies(bound_pts,all_pts): 
    keys = []
    for bound_pt in bound_pts:
        for i,pt in enumerate(all_pts):
            if rs.PointCompare(pt,bound_pt):
                keys.append(str(i))
    return keys   
p_plus_q = rs.PointAdd(p, q)
# coords_p_plus_q = rs.PointCoordinates(p_plus_q) ##  "must be a guid"

print("p: %s" % p)  ##  guid
print("type(p): %s" % type(p))  ##  guid
print("type(q): %s" % type(q))  ##  tuple
print("coords_p: %s" % coords_p)  ##  10,10,10
print("type(coords_p): %s" % type(coords_p))  ##  Point3d
# print("tuple(p): %s" % tuple(p))
print("type(p_plus_q): %s" % type(p_plus_q))  ##  Point3d
print("p_plus_q: %s" % p_plus_q)  ##  30,30,30
print("p_plus_q[0]: %s" % p_plus_q[0])  ##
print("p_plus_q[1]: %s" % p_plus_q[1])  ##
print("p_plus_q[2]: %s" % p_plus_q[2])  ##
# print("coords_p_plus_q: %s" % coords_p_plus_q)                ##
# print("p == q" % p == q)
print("rs.PointCompare(p, q): %s" % rs.PointCompare(p, q))
# print("coords_p == q" % coords_p == q)
# print("rs.PointCompare(coords_p, q)" % rs.PointCompare(coords_p, q))
# print("len(p) = %i"% len(p))
# print('tuple(coords_p) %s' % tuple(coords_p))
print('p[x]: %s' % coords_p[0])  ##  10.0

print('rs.IsPoint(p): %s' % rs.IsPoint(p))  ##	True
print('rs.IsPoint(coords_p): %s' % rs.IsPoint(coords_p))
##	False
print(coords_p)  ##	10,10,10
xyz = tuple(coords_p)
print(xyz)  ##	(10.0, 10.0, 10.0)
print('coords_p_x = %s' % coords_p[0])  ##	10.0
Example #8
0
                continue
            if ccx[0][0] == 2:
                continue
            para_a = [ccx[0][5], ccx[1][5]]
            para_b = [ccx[0][7], ccx[1][7]]

            if para_b[0] > para_b[1]:
                para_b = [para_b[1], para_b[0]]

            probable_dash = rs.SplitCurve(polylines[i], para_a)
            edge = rs.TrimCurve(MN, para_b, False)
            edgepts = rs.CurvePoints(edge)

            for crv in probable_dash:
                crvpts = rs.CurvePoints(crv)
                if rs.PointCompare(crvpts[0], edgepts[0]):
                    crvpts.reverse()
                newpl = rs.AddPolyline(edgepts + crvpts)
                if rs.PointInPlanarClosedCurve(pts[i], newpl):
                    polylines[i] = newpl
                    break

            ccx = rs.CurveCurveIntersection(polylines[j], MN)
            if ccx is None:
                continue
            para_a = [ccx[0][5], ccx[1][5]]
            para_b = [ccx[0][7], ccx[1][7]]

            if para_b[0] > para_b[1]:
                para_b = [para_b[1], para_b[0]]
    assert len(main_curve) == 1
    main_curve = main_curve[0]
    #main_curve_coerced = rs.coercecurve(main_curve)
    main_curve.Domain = rc.Geometry.Interval(0, 1)

    # need to make sure the main_curve is still oriented counter-clockwise around
    # the octagon. To do this we'll compare it's orientation to the orientation of
    # subcurve2.
    p = subcurve2.PointAt(0)
    #p = rs.EvaluateCurve(subcurve2,0)

    t = main_curve.ClosestPoint(p)[1]
    #t = rs.CurveClosestPoint(main_curve,p)

    _ = main_curve.ChangeClosedCurveSeam(t)
    main_curve.Domain = rc.Geometry.Interval(0, 1)
    #_ = rs.CurveSeam(Guid(main_curve),t)
    q = main_curve.LengthParameter(1)[1]

    q = rs.CurveArcLengthPoint(main_curve, 1)
    p = rs.CurveArcLengthPoint(subcurve2, 1)
    if not rs.PointCompare(p, q, tolerance=.01):
        _ = main_curve.Reverse()
        main_curve.Domain = rc.Geometry.Interval(0, 1)
    """Reevaluate main_curve here?"""
    #rs.JoinCurves

#rs.AddInterpCurve(points, degree=3, knotstyle=0, start_tangent=None, end_tangent=None)
#rs.BrepClosestPoint(object_id, point)