Example #1
0
def readLines(f, name):
    global setsNr, groupNr, grps

    pObs = []
    lst = f["sets"]
    for n, v in [(lst[i], lst[i + 1]) for i in range(0, len(lst), 2)]:
        if ("start" in v) and ("end" in v):
            sets.append("%s_%s" % (name, n))
            pObs.append(Line("Line_%s_in_%s" % (n, name), v["start"],
                             v["end"]))
        setsNr += 1
    grp = Group("Sets_%s" % name)
    groupNr += 1
    for o in pObs:
        grp.add(o)
        o.repr.Visibility = False
    grp.repr.DiffuseColor = (1, 0, 0)
    grps.append(grp)
Example #2
0
from PyFoam.Basics.DataStructures import Vector

ro = readerObject()

bnds = ro.getBounds()

pl = Plane("Plane", ro.getCenter(), ro.getMax(),
           ro.getCenter() + Vector(1, 1, 1) ^ ro.getExtent())

ln = Line("Line", ro.getMin(), ro.getMax())

pt1 = Point("Point1", ro.getMin())
pt2 = Point("Point2", ro.getMax())

grp = Group("thePoints")
grp.add(pt1)
grp.add(pt2)

sp = Sphere("Sphere", ro.getCenter())

cp = Cube("Cube",
          ro.getMin() - 0.2 * ro.getExtent(),
          ro.getMax() + 0.2 * ro.getExtent())

txt = Text("Text", "Don't Panic")

arrow = Arrow("Arrow", ro.getMax(), ro.getMax() + ro.getExtent())

gly = Glyph("Glyph", ro.getMin(), ro.getMin() - ro.getExtent())
Example #3
0

if "functions" in ctrl:
    lst = ctrl["functions"]
    if type(lst) in [dict, DictProxy]:
        pass
    for name, f in lst.iteritems():
        print "Group:", name,
        if f["type"].find("probes") >= 0:
            print "= probes"
            pObs = []
            for p in f["probeLocations"]:
                probes.append(p)
                pObs.append(Point("Probe_%d_in_%s" % (probeNr, name), p))
                probeNr += 1
            grp = Group("Probes_%s" % name)
            groupNr += 1
            for o in pObs:
                grp.add(o)
                o.repr.Visibility = False
            grp.repr.DiffuseColor = (1, 0, 0)
            grps.append(grp)
        elif f["type"].find("sets") >= 0:
            print "= sets"
            readLines(f, name)
        else:
            print

if path.exists(path.join(sol.systemDir(), "sampleDict")):
    print "Reading sampleDict"
    readLines(ParsedParameterFile(path.join(sol.systemDir(), "sampleDict")),