Exemplo n.º 1
0
        def CreatePyramidPoints(treeIn, ratioIn, treeOut):
            for i in range(treeIn.BranchCount):
                treeBranch = treeIn.Branch(i)
                ratioBranch = ratioIn.Branch(i)
                treePath = treeIn.Path(i)

                P1 = treeBranch[0]
                P2 = treeBranch[1]
                P3 = treeBranch[2]
                P4 = treeBranch[3]
                ratioX = ratioBranch[0]
                ratioY = ratioBranch[1]

                line1 = rs.AddLine(P1, P2)
                line1 = rs.coercecurve(line1)

                pointXmin = rh.Geometry.Curve.PointAtNormalizedLength(
                    line1, ratioY)

                line2 = rs.AddLine(P3, P4)
                line2 = rs.coercecurve(line2)

                pointXmax = rh.Geometry.Curve.PointAtNormalizedLength(
                    line2, ratioY)

                line3 = rs.AddLine(pointXmin, pointXmax)
                line3 = rs.coercecurve(line3)

                point = rh.Geometry.Curve.PointAtNormalizedLength(
                    line3, ratioX)

                path = ghpath(treePath.CullElement())

                treeOut.Add(point, path)
Exemplo n.º 2
0
        def CupolaCollar(treeIn, profilePointsIn, profileVectorsIn, treeOut,
                         ratioOut, profilePointsOut, profileVectorsOut):

            Pmax = GridCornerBig(treeIn)
            Xmax = Pmax.X
            Ymax = Pmax.Y
            Zmax = Pmax.Z

            Pmin = GridCornerSmall(treeIn)
            Xmin = Pmin.X
            Ymin = Pmin.Y
            Zmin = Pmin.Z

            print profilePointsIn

            for i in range(treeIn.BranchCount):
                treeBranch = treeIn.Branch(i)
                treePath = treeIn.Path(i)

                profPointsBranch = profilePointsIn.Branch(i)
                profVectorsBranch = profileVectorsIn.Branch(i)

                for j in range(treeBranch.Count):
                    elem = treeBranch[j]
                    profPoint = profPointsBranch[j]
                    profVector = profVectorsBranch[j]

                    x = elem.X
                    y = elem.Y
                    z = elem.Z

                    Xr = x / Xmax
                    Yr = y / Ymax

                    if Zmax == 0:
                        Zr = 0
                    else:
                        Zr = z / Zmax

                    P1 = rs.AddPoint(Xmin, y, z)
                    P1 = rs.coerce3dpoint(P1)
                    P2 = rs.AddPoint(Xmax, y, z)
                    P2 = rs.coerce3dpoint(P2)
                    path = ghpath(treePath.AppendElement(j))

                    treeOut.Add(P1, path)
                    treeOut.Add(P2, path)
                    ratioOut.Add(Xr, path)
                    profilePointsOut.Add(profPoint, path)
                    profilePointsOut.Add(profPoint, path)
                    profileVectorsOut.Add(profVector, path)
                    profileVectorsOut.Add(profVector, path)
Exemplo n.º 3
0
        def CreateDomeGrid(treeIn, treeOut):

            for i in range(treeIn.BranchCount):
                treeBranch = treeIn.Branch(i)
                treePath = treeIn.Path(i)

                path = ghpath(treePath.CullElement())
                if treeBranch[0] != treeBranch[1]:

                    curves = rs.AddCurve(treeBranch)
                    curves = rs.coercecurve(curves)

                    treeOut.Add(curves, path)
Exemplo n.º 4
0
    def RunScript(self, t, g, l, O, a):

        settings = datatree[sys.Object]()
        path0 = ghpath(0)
        settings.Add(t, path0)

        path1 = ghpath(1)
        settings.Add(g, path1)

        path2 = ghpath(2)
        settings.Add(l, path2)

        path3 = ghpath(3)
        settings.Add(O, path3)

        path4 = ghpath(4)
        settings.Add(a, path4)

        S = settings

        # return outputs if you have them; here I try it for you:
        return S
Exemplo n.º 5
0
        def PyramidCollar(treeIn, treeOut, ratioOut):

            Pmax = GridCornerBig(treeIn)
            Xmax = Pmax.X
            Ymax = Pmax.Y
            Zmax = Pmax.Z

            Pmin = GridCornerSmall(treeIn)
            Xmin = Pmin.X
            Ymin = Pmin.Y
            Zmin = Pmin.Z

            for i in range(treeIn.BranchCount):
                treeBranch = treeIn.Branch(i)
                treePath = treeIn.Path(i)

                for j in range(treeBranch.Count):
                    elem = treeBranch[j]

                    x = elem.X
                    y = elem.Y
                    z = elem.Z

                    Xr = x / Xmax
                    Yr = y / Ymax

                    if Zmax == 0:
                        Zr = 0
                    else:
                        Zr = z / Zmax

                    P1 = rs.AddPoint(Xmin, Ymin, z)
                    P1 = rs.coerce3dpoint(P1)
                    P2 = rs.AddPoint(Xmin, Ymax, z)
                    P2 = rs.coerce3dpoint(P2)
                    P3 = rs.AddPoint(Xmax, Ymin, z)
                    P3 = rs.coerce3dpoint(P3)
                    P4 = rs.AddPoint(Xmax, Ymax, z)
                    P4 = rs.coerce3dpoint(P4)
                    path = ghpath(treePath.AppendElement(j))

                    treeOut.Add(P1, path)
                    treeOut.Add(P2, path)
                    treeOut.Add(P3, path)
                    treeOut.Add(P4, path)
                    ratioOut.Add(Xr, path)
                    ratioOut.Add(Yr, path)
Exemplo n.º 6
0
        def CreateModPoints(treeIn, ratioIn, treeOut):
            for i in range(treeIn.BranchCount):
                treeBranch = treeIn.Branch(i)
                ratioBranch = ratioIn.Branch(i)
                treePath = treeIn.Path(i)

                P1 = treeBranch[0]
                P2 = treeBranch[1]
                ratio = ratioBranch[0]

                line = rs.AddLine(P1, P2)
                line = rs.coercecurve(line)

                point = rh.Geometry.Curve.PointAtNormalizedLength(line, ratio)

                path = ghpath(treePath.CullElement())

                treeOut.Add(point, path)
Exemplo n.º 7
0
        def DivideCurves(curves, NumberOfPoints, treeOut):
            # gorbe felosztasa, pontok listaba es faba rendezese

            pathNum = 0

            for i in range(curves.BranchCount):
                treeBranch = curves.Branch(i)
                treePath = curves.Path(i)

                for j in range(len(treeBranch)):
                    PointsPerCurve = rs.DivideCurve(treeBranch[j],
                                                    NumberOfPoints, True, True)
                    NumOfPtCrv = len(PointsPerCurve)
                    path = ghpath(treePath.AppendElement(j))
                    loopNum = 0

                    while (loopNum < NumOfPtCrv):
                        treeOut.Add(PointsPerCurve[loopNum], path)
                        loopNum = loopNum + 1