Ejemplo n.º 1
0
def process():
    objs = rs.GetObjects('select objs', preselect=True)
    grade = rs.GetString("toggle grade")
    rs.EnableRedraw(False)
    isUG = trp.boolToggle(grade)
    groups = trp.groupByElevation(objs, isUG)
    trp.setLevel(groups, isUG, trp.setLevelforObj)
Ejemplo n.º 2
0
def process():
    objs = rs.GetObjects('select objs', \
        rs.filter.surface|\
            rs.filter.curve|\
                rs.filter.point|\
                    rs.filter.polysurface, preselect=True)
    grade = rs.GetString("toggle grade")
    rs.EnableRedraw(False)
    isUG = trp.boolToggle(grade)
    groups = trp.groupByElevation(objs, isUG)
    # print type(groups)
    trp.setLevel(groups, isUG, trp.setLevelforObj)
Ejemplo n.º 3
0
def process(objs, grade, func):

    isUG = trp.boolToggle(grade)
    groups = trp.groupByElevation(objs, isUG)

    trp.setLevel(groups, isUG, func)
    """setting lvldbdict as ordered for some reason
    """
    levels = [trp.createObjDict(x[0][0]) for x in groups]

    lvlk = [x['level'] for x in levels]
    lvldict = dict(zip(lvlk, levels))
    lvlpt = [rs.CreatePoint((0, 0, float(x['elevation']))) for x in levels]
    lvlptdict = dict(zip(lvlk, lvlpt))
    # pts = [" ".join(map(str,[0,0,float(x['elevation'])]))]
    # lvlptdict
    sc.sticky['lvlptdict'] = lvlptdict
    sc.sticky["lvldict"] = lvldict
    sc.sticky["levels"] = json.dumps(levels)
    rs.SetDocumentUserText("lvldict", json.dumps(lvldict))
    rs.SetDocumentUserText("levels", json.dumps(levels))
Ejemplo n.º 4
0
def process(objs, grade, func):
    isUG = trp.boolToggle(grade)
    groups = trp.groupByElevation(objs, isUG)
    trp.setLevel(groups, isUG, func)
Ejemplo n.º 5
0
import rhinoscriptsyntax as rs
import trkRhinoPy as trp
import scriptcontext as sc
import Rhino

objs = rs.GetObjects('select objects', preselect=True)

reverse = rs.GetString("reverse")

isreverse = trp.boolToggle(reverse)

lvlpts = sc.sticky["lvlptdict"]
planpts = sc.sticky['planptdict']

levelkeys = lvlpts.keys()

vecs = dict([(key, lvlpts[key] - planpts[key]) for key in levelkeys])


def lvlxform(obj):
    lvlkey = rs.GetUserText(obj, 'level')
    vec = vecs[lvlkey]
    if isreverse:
        vec = rs.VectorReverse(vec)
    rs.MoveObject(obj, vec)


if lvlpts and planpts and objs:
    map(lvlxform, objs)

# sc.doc = Rhino.RhinoDoc.ActiveDoc
Ejemplo n.º 6
0
# !-RunPythonScript "framesrf.py"
# Surface must be Reparametrized with Auto option
import rhinoscriptsyntax as rs
import trkRhinoPy as trp

objs = rs.GetObjects("Select a srf", rs.filter.surface, preselect=True)
eq = rs.GetString('eq?')
eq = not trp.boolToggle(eq)

option = rs.GetInteger('option', number=3)

if option == 2:
    intervalx = rs.GetReal("intervalx", 0.5)
else:
    intervalx = rs.GetReal("intervalx", 1)
    intervaly = rs.GetReal("intervaly", 2)
Secx = rs.GetReal("mullion width", 0.15)
Secy = rs.GetReal("mullion depth", 0.05)

vec1 = (-Secx / 2, -Secy, 0)
vec2 = (-Secx / 2, -Secy / 2, 0)


def rectFrame():
    return rs.AddRectangle(rs.WorldXYPlane(), Secx, Secy)


def profileXform(sec, plane, vec):
    xvec = rs.XformTranslation(vec)
    cob = rs.XformChangeBasis(plane, rs.WorldXYPlane())
    xform = rs.XformMultiply(cob, xvec)