From: Emanuele G. <ema...@gm...> - 2008-01-09 13:39:17
Attachments:
fdscad_0.025.py
|
Hi, first of all *thank you* very much for developing VPython and making it open source. My name is Emanuele Gissi and I am a recent subscriber to this list. I am not a professional developer (http://gissi.free.fr), I am an officer of the Italian National Fire Brigade ( http://www.vigilfuoco.it/). I am using Ubuntu Linux and rather new to Python, but really impressed by its power and simplicity. I encountered VPython while trying to develop a small and simple preprocessor for an open source CFD program named FDS ( http://www.fire.nist.gov/fds/) used to simulate fires in buildings. FDS does not have an own GUI to enter the geometry of the building. (Yes, there is Pyrosim ( http://thunderheadeng.com/pyrosim/), but it is a commercial application, not from NIST, closed source and Windows version only). And developers at NIST would be very interested in a open source, multi platform GUI for FDS. My small (for now ;-) preprocessor (FDScad) is a sort of CAD for the geometry of the building and its boundary conditions. I attach the current version to this email. I don't think it can be still a candidate for "contributed programs": it's in its infancy and it is a very rough prototype! Now, question time: 1) Is there a more vpython-ish way to do the following: (probably in 4beta version?) a - I reimplemented the box class, as I needed a box with differently colored faces. b - I implemented a function for absolute positions of objects. c - Another function calculates the absolute normals of faces of my reimplemented box. 2) Is there a binary package (deb, tar.gz, rpm) for the 4beta version? I admit that I am not able to compile it on my own... This would facilitate testing. Thank you, once more, in advance. Emanuele Gissi. |
From: Bruce S. <Bru...@nc...> - 2008-01-09 20:25:53
|
As you may have seen from a flurry of recent notes, various people have urged that there be built into VPython for functions to go between frame coordinates and "world" coordinates. Although several people have written their own routines, it's not unreasonable to ask that these be built-in, and I've added this to a mental list of things to do. There's no more "vpythonish" way to make a box with different colors on the sides than to resort as you did to the basic faces object. I've never known or understood how packages spring into being for various Linux distributions. I put tarballs on vpython.org (for the production version) and on sourceforge (for the beta version), and apparently various people somewhere pick some version and package it for their favorite flavor of Linux. That this process is imperfect can be seen in the most recent version 7 of Ubuntu, where the package for VPython is quite old (if I remember correctly, it is 3.2.1 rather than 3.2.9). As for not being able to compile the beta version on your own, can you describe the symptoms of what prevents you from getting through the instructions given in INSTALL.txt, part of the tarball? My goal is to provide enough information to people that one doesn't need much special knowledge in order to build the beta version from source. Bruce Sherwood Emanuele Gissi wrote: > Hi, > > first of all *thank you* very much for developing VPython and making it > open source. > > My name is Emanuele Gissi and I am a recent subscriber to this list. > I am not a professional developer (http://gissi.free.fr > <http://gissi.free.fr/>), I am an officer of the Italian National Fire > Brigade ( http://www.vigilfuoco.it/). > I am using Ubuntu Linux and rather new to Python, but really impressed > by its power and simplicity. > > I encountered VPython while trying to develop a small and simple > preprocessor for an open source CFD program named FDS ( > http://www.fire.nist.gov/fds/) used to simulate fires in buildings. > FDS does not have an own GUI to enter the geometry of the building. > (Yes, there is Pyrosim ( http://thunderheadeng.com/pyrosim/), but it is > a commercial application, not from NIST, closed source and Windows > version only). > > And developers at NIST would be very interested in a open source, multi > platform GUI for FDS. > > My small (for now ;-) preprocessor (FDScad) is a sort of CAD for the > geometry of the building and its boundary conditions. > I attach the current version to this email. > I don't think it can be still a candidate for "contributed programs": > it's in its infancy and it is a very rough prototype! > > Now, question time: > > 1) Is there a more vpython-ish way to do the following: (probably in > 4beta version?) > a - I reimplemented the box class, as I needed a box with differently > colored faces. > b - I implemented a function for absolute positions of objects. > c - Another function calculates the absolute normals of faces of my > reimplemented box. > > 2) Is there a binary package (deb, tar.gz, rpm) for the 4beta version? I > admit that I am not able to compile it on my own... > This would facilitate testing. > > Thank you, once more, in advance. > Emanuele Gissi. > > > ------------------------------------------------------------------------ > > # -*- encoding: utf-8 -*- > # > # Copyright (c) 2007 Ing. Emanuele Gissi. (http://gissi.free.fr) All Rights Reserved. > # > # This program is Free Software, GNU General Public License, version 3, > # as published by the Free Software Foundation. > # > > # Fare class obst, hole, surf, mesh, devc > # Cancellare gli oggetti? > # Che succede quando cancello una bondary condition? > # Un frame, un oggetto? > > # __self eccetera init, getter setter > # test 2D 2d e protect size > > > > from visual import * > > # constants > > vx = vector(1,0,0) > vy = vector(0,1,0) > vz = vector(0,0,1) > > # functions > > def calcparentpos(frame, pos): > """Expresses a pos relative to a frame (that can be taken from an object), > in coords relative to its parent ref (parent frame or universe). > For now, my program does not use it. > frame: obj, a ref frame or obj. > pos: vector, position of the point expressed in frame coordinates > """ > pos = vector(pos) > if frame: > # Calcs 3 versors of frame or obj axis in parent frame coordinates > x_axis = norm(frame.axis) > z_axis = norm(cross(frame.axis, frame.up)) > y_axis = norm(cross(z_axis, x_axis)) > # Returns the new coordinates relative to parent ref > return frame.pos + pos.x * x_axis + pos.y * y_axis + pos.z * z_axis > else: > return pos > > def calcabspos(frame, pos): > """Expresses a pos relative to a frame (that can be taken from an object), > in coords relative to the universe. It's a recursive function. > frame: obj, a ref frame or obj. > pos: vector, position of the point expressed in frame coordinates > """ > pos = vector(pos) > if frame: > # Calcs 3 versors of frame or obj axis in parent frame coordinates > x_axis = norm(frame.axis) > z_axis = norm(cross(frame.axis, frame.up)) > y_axis = norm(cross(z_axis, x_axis)) > # Returns the new coordinates relative to parent ref > return calcabspos(frame.frame, frame.pos + pos.x * x_axis + pos.y * y_axis + pos.z * z_axis) > else: > return pos > > def calcabsrotz(frame, pos=(1,0,0)): > """Calcs the number of pi/2 absolute rotations of the frame (or obj) around z axis, > relative to the universe. It's used by EBox to calc absolute faces used > by FDS for boundary conditions. The rotation should be around z axis only! > frame: obj, a ref frame or obj. > Don't use the parameter pos, it'used for recursion. Yes, I know, it's not elegant... > """ > pos = vector(pos) > if frame: > # Calcs 3 versors of frame or obj axis in parent frame coordinates > x_axis = norm(frame.axis) > z_axis = norm(cross(frame.axis, frame.up)) > y_axis = norm(cross(z_axis, x_axis)) > # Returns the new coordinates relative to parent ref > return calcabsrotz(frame.frame, pos.x * x_axis + pos.y * y_axis + pos.z * z_axis) > else: > # The current pos is the initial x axis referenced to universe frame. > # Calcs the angle formed with the absolute axis x and y > diffx = vx.diff_angle(pos) > diffy = vy.diff_angle(pos) > # Check the values to discover the value of rotation > if diffx < .1 : > # 0° around z > return 0 > elif diffy < .1 : > # 90° around z > return 1 > elif diffx > pi -.1: > # 180° around z > return 2 > elif diffy > pi -.1: > # 270° around z > return 3 > else: > raise Exception("Unknown rotation around z axis!") > return absffnames > > # classes > > class EFrame(frame): > """Enhanced frame. > id: string, id of the instance, why hardwired __name__ does not work? > visible: boolean, visibility of local objs > color: triplet, color of the handler > pos: vector, position relative to the parent frame > frame: obj, reference frame > abspos: vector, absolute position of origin > label: obj, label > handler: obj, sphere > rotate(): simplyfied rotation around z axis. > """ > def __init__(self, id, visible=True, color=color.yellow, pos=(0,0,0), frame=None): > super(EFrame, self).__init__(frame=frame, pos=pos) # create the frame, with few parameters > self.id = id # record the id of the object, instead of __name__ > self.__visible = visible # visibility of all local objects > # label and handler (FIX IT: si potrebbe aggiungere il posizionamento random delle etichette) > self.label = label(frame=self, pos=(0,0,0), text=id, xoffset=20, box=False) > self.handler = sphere(frame=self, pos=(0,0,0), radius=.1, color=color) > self.handler.container = self # FIX IT used to pick it up with mouse > self.arrows = [arrow(frame=self, pos=(0,0,0), axis=(1,0,0), color=(1,0,0), shaftwidth=.03), > arrow(frame=self, pos=(0,0,0), axis=(0,1,0), color=(0,1,0), shaftwidth=.03), > arrow(frame=self, pos=(0,0,0), axis=(0,0,1), color=(0,0,1), shaftwidth=.03)] > > def rotate(self, n=1): > """Simplified rotation""" > for i in range(n): > super(EFrame, self).rotate(angle=pi/2, axis=(0,0,1)) > > def getvisible(self): > """Get visibility""" > return self.__visible > > def setvisible(self, visible): > """Set visibility of all the local objects""" > self.__visible = visible > self.label.visible = visible > self.handler.visible = visible > for arrow in self.arrows: > arrow.visible = visible > > visible = property(getvisible, setvisible) > > def getabspos(self): > """Get absolute position of the origin""" > return calcabspos(self.frame, self.pos) > > abspos = property(getabspos) # readonly > > class EBox(EFrame): > """Enhanced box > size: vector, size in local x, y, z directions > origin: vector, relative position of origin in local x, y, z, directions > wireframe: boolean, show wireframe > solid: boolean, show solid > colors: list, colors of x0, x1, y0, y1, z0, z1 faces > colorw: triplet, color of wireframe > abscoordinates: list, absolute coordinates of the box in FDS notation > absff: list, list of absolute faces orientation in FDS notation > """ > def __init__(self, size=(2,2,2), origin=(0,0,0), wireframe=True, solid=True, > colors=[color.white] * 6, colorw=color.white, **args): > super(EBox, self).__init__(**args) > self.__size = size > self.__origin = origin > self.__wireframe = wireframe > self.__solid = solid > self.__colors = colors > self.__colorw = colorw > self.__ff = [] # list of flat faces > self.__fw = [] # list of wireframe faces > self.__p000 = [] # position of ebox 000 vertex > self.__p111 = [] # position of ebox 111 vertex > # calcs faces > ffpos, fwpos = self._calcfaces(size, origin) > ffnormals = [[-vx] * 6, [vx] * 6, [-vy] * 6, [vy] * 6, [vz,] * 6, [vz] * 6] > # creates faces and wireframes > for face in range(6): > self.__ff.append(faces(frame = self, pos = ffpos[face], > normal = ffnormals[face], > color = colors[face], visible = solid)) > self.__fw.append(curve(frame = self, pos = fwpos[face], > color = colorw, visible = wireframe)) > > def _calcfaces(self, size, origin): > """Calculate faces position""" > # get 3 sides and origin position relative to sizes > sx, sy, sz = size > ox, oy, oz = origin > # calc 6 vertexes, considering the right alignments > p000 = vector(-ox * sx, -oy * sy, -oz * sz) > p100 = p000 + vector( sx, 0, 0) > p010 = p000 + vector( 0, sy, 0) > p001 = p000 + vector( 0, 0, sz) > p110 = p000 + vector( sx, sy, 0) > p101 = p000 + vector( sx, 0, sz) > p011 = p000 + vector( 0, sy, sz) > p111 = p000 + vector( sx, sy, sz) > # calc pos for flat faces and wireframe faces > ffpos = [] > ffpos.append([p000,p011,p010,p000,p001,p011]) > ffpos.append([p100,p110,p111,p100,p111,p101]) > ffpos.append([p000,p100,p101,p000,p101,p001]) > ffpos.append([p010,p111,p110,p010,p011,p111]) > ffpos.append([p000,p010,p110,p000,p110,p100]) > ffpos.append([p001,p111,p011,p001,p101,p111]) > fwpos = [] > fwpos.append([p000,p001,p011,p001,p000]) > fwpos.append([p100,p101,p111,p101,p100]) > fwpos.append([p000,p100,p101,p001,p000]) > fwpos.append([p010,p110,p111,p011,p010]) > fwpos.append([p000,p010,p110,p100,p000]) > fwpos.append([p001,p011,p111,p101,p001]) > # save positions of extreme vertexes > self.__p000 = p000 > self.__p111 = p111 > return (ffpos, fwpos) > > def redraw(self): > """Recalc and correct the faces""" > ffpos, fwpos = self._calcfaces(self.__size, self.__origin) > # correct the faces > for face in range(6): > self.__ff[face].pos = ffpos[face] > self.__ff[face].color = self.__colors[face] > self.__ff[face].visible = self.__solid > # wireframe faces > self.__fw[face].pos = fwpos[face] > self.__fw[face].color = self.__colorw > self.__fw[face].visible = self.__wireframe > > def getsize(self): > """Get size""" > return self.__size > > def setsize(self, size): > """Set size and redraw""" > self.__size = size > self.redraw() > > size = property(getsize, setsize) > > def getorigin(self): > """Get origin""" > return self.__origin > > def setorigin(self, origin): > """Set origin and redraw""" > self.__origin = origin > self.redraw() > > origin = property(getorigin, setorigin) > > def getcolors(self): > """Get colors of the faces""" > return self.__colors > > def setcolors(self, colors): > """Set colors of the faces and redraw""" > self.__colors = colors > self.redraw() > > colors = property(getcolors, setcolors) > > def getcolorw(self): > """Get color of the wireframe""" > return self.__colorw > > def setcolorw(self, colorw): > """Set color of the wireframe and redraw""" > self.__colorw = colorw > self.redraw() > > colorw = property(getcolorw, setcolorw) > > def getwireframe(self): > """Get wireframe state""" > return self.__wireframe > > def setwireframe(self, wireframe): > """Set wireframe state and redraw""" > self.__wireframe = wireframe > self.redraw() > > wireframe = property(getwireframe, setwireframe) > > def getsolid(self): > """Get solid state""" > return self.__solid > > def setsolid(self, solid): > """Set solid state and redraw""" > self.__solid = solid > self.redraw() > > solid = property(getsolid, setsolid) > > def getvisible(self): > """Get visibility""" > # This property is redefined from EFrame > return self.__visible > > def setvisible(self, visible): > """Set visibility and redraw or correct""" > # This property is redefined from EFrame > # Set the visibility of the eframe > super(EBox, self).setvisible(visible) > # Set the visibility of the object > self.__visible = visible > if visible: self.redraw() > else: > for face in range(6): > self.__ff[face].visible = False > self.__fw[face].visible = False > > visible = property(getvisible, setvisible) > > def getabsff(self): > """Calc the absolute orientation of the faces""" > absrotz = calcabsrotz(self) > if absrotz == 0: > absff = ["x0","x1","y0","y1","z0","z1"] > elif absrotz == 1: > absff = ["y0","y1","x1","x0","z0","z1"] > elif absrotz == 2: > absff = ["x1","x0","y1","y0","z0","z1"] > elif absrotz == 3: > absff = ["y1","y0","x0","x1","z0","z1"] > else: > raise Exception("Unknown rotation of an EBox!") > return absff > > absff = property(getabsff) > > def getabscoordinates(self): > """Get absolute coordinates, as in FDS convention. > This works only for pi/2 rotations!""" > pos0 = calcabspos(self, self.__p000) > pos1 = calcabspos(self, self.__p111) > abscoordinates = [min(pos0.x,pos1.x), max(pos0.x,pos1.x), > min(pos0.y,pos1.y), max(pos0.y,pos1.y), > min(pos0.z,pos1.z), max(pos0.z,pos1.z)] > return abscoordinates > > abscoordinates = property(getabscoordinates) > > class Surf(object): > """FDS SURF directive. This describes a particular boundary condition. > id: string, id of the SURF. > color: triplet, color of the SURF. > fdsparam: string, FDS parameters of the SURF. These are passed to FDS as they are. > fdscommand: string, FDS command to export. > """ > def __init__(self, id, color=color.white, fdsparam=None): > self.id = id > self.__color = color > self.fdsparam = fdsparam > > def getcolor(self): > """Get color of the Surf""" > return self.__color > > def setcolor(self, color): > """Set color of the Surf and redraw all""" > self.__color = color > #FIX IT redrawall() > > color = property(getcolor, setcolor) > > def getfdscommand(self): > """Get the FDS command of this obj""" > fdscommand = "&SURF " > fdscommand += "ID=\'" + self.id + "\'" > fdscommand += ",COLOR=\'" + str(self.__color) + "\'" > if self.fdsparam: fdscommand += "," + self.fdsparam > fdscommand += " \\" > return fdscommand > > fdscommand = property(getfdscommand) > > class Obst(EBox): > """FDS OBST directive. This describes an obstacle. > surfs: list, list of 1, 3, 6 SURFs as boundary conditions for the OBST (SURF_ID, SURF_IDS, SURF_ID6) > fdsparam: string, FDS parameters of the OBST. These are passed to FDS as they are. > fdscommand: string, FDS command to export. > """ > def __init__(self, surfs = None, fdsparam=None, wireframe=True, solid=True, **args): > self.__surf6 = self.__calcsurf6(surfs) # convert surfs in surf6 (6 values). Useful for rotation of faces! > colors = self.__calccolors(self.__surf6) # take colors of the 6 surf6 > self.fdsparam = fdsparam # record the FDS additional parameters > # send the colors to the EBox, if they exist > if colors: > super(Obst, self).__init__(colors = colors, wireframe=wireframe, solid=solid, **args) > else: > super(Obst, self).__init__(wireframe=wireframe, solid=solid, **args) > > def getsurfs(self): > """Get __surf6 list""" > return self.__surf6 # surfs are now surf6, whether they were entered > > def setsurfs(self, surfs): > """Set __surf6 list""" > self.__surf6 = self.__calcsurf6(surfs) # convert surfs in surf6 (6 values) > self.colors = self.__calccolors(self.__surf6) # take colors of the 6 surf6 and set the property > self.redraw() # and now redraw, with new colors > > surfs = property(getsurfs, setsurfs) > > def __calcsurf6(self, surfs): > """transform the surfs (SURF_ID, SURF_IDS, SURF_ID6) in surf6 (SURF_ID6)""" > if surfs: > if len(surfs) == 1: # SURF_ID, 1 bc for 6 faces > surf6 = [surfs[0]] * 6 > return surf6 > elif len(surfs) == 3: # SURF_IDS, 3 bc: top, sides, bottom > surf6 = [surfs[1]] * 4 # sides, x0 x1 y0 y1 > surf6.append(surfs[2]) # bottom, z0 > surf6.append(surfs[0]) # top, z1 > return surf6 > elif len(surfs) == 6: # SURF_ID6, 6 bc for 6 faces > return surfs > else: # Something bad has happened, no bc set > return None > > def __calccolors(self, surf6): > """transform the surfs (SURF_ID, SURF_IDS, SURF_ID6) in surf6 (SURF_ID6)""" > if surf6: > return [ surf6[i].color for i in range(6) ] # Returns the color of each face > else: > return None > > def getabssurf6(self): > """Get absolute surf6 (boundary conditions), as in FDS convention. > This works only for pi/2 rotations!""" > # reorder the __surf6 list of bc, depending on absolute rotation of faces around z axis (absff) > ff = ["x0","x1","y0","y1","z0","z1"] # all the faces in list order > return [dict(zip(self.absff,self.__surf6))[face].id for face in ff] > > abssurf6 = property(getabssurf6) > > def getfdscommand(self): > """Get the FDS command of this obj""" > fdscommand = "&OBST " > fdscommand += "ID=\'" + self.id + "\'" > fdscommand += ",XB=" + ",".join([str(a) for a in self.abscoordinates]) > fdscommand += ",SURF_ID6=" + ",".join([str(a) for a in self.abssurf6]) > if self.fdsparam: fdscommand += "," + self.fdsparam > fdscommand += " \\" > return fdscommand > > fdscommand = property(getfdscommand) > > class Hole(EBox): > """FDS HOLE directive. This describes an hole in an obstacle. > fdsparam: string, FDS parameters of the HOLE. (Is there any? No.) These are passed to FDS as they are. > fdscommand: string, FDS command to export. > """ > def __init__(self, surfs = None, fdsparam=None, wireframe=True, solid=False, **args): > self.fdsparam = fdsparam > super(Hole, self).__init__(wireframe=wireframe, solid=solid, colorw=(0,1,1), **args) > > def getfdscommand(self): > """Get the FDS command of this obj""" > fdscommand = "&HOLE " > fdscommand += "ID=\'" + self.id + "\'" > fdscommand += ",XB=" + ",".join([str(a) for a in self.abscoordinates]) > if self.fdsparam: fdscommand += "," + self.fdsparam > fdscommand += " \\" > return fdscommand > > fdscommand = property(getfdscommand) > > class Vent(EBox): > """FDS VENT directive. This is used to apply a particular bc to a solid obstruction or a mesh boundary. > surf: obj, the boundary conditions to apply > size2d: 2-plet, size of the 2D VENT. > normal: vector, normal to the surface > fdsparam: string, FDS parameters of the VENT. These are passed to FDS as they are. > fdscommand: string, FDS command to export. > """ > def __init__(self, surf=None, fdsparam=None, wireframe=True, solid=True, size2d=(1,1), normal=(1,0,0), **args): > self.__surf = surf # records the surf > color = self.__surf.color # records the color of the surf > self.fdsparam = fdsparam # record the FDS additional parameters > self.__size2d = size2d # records the size. Only the first two value will be used! > self.__normal = normal # records the normal vector > super(Vent, self).__init__(colors = [color] * 6, wireframe=wireframe, solid=solid, size=self.__calcsize3d(size2d,normal), **args) > > def __calcsize3d(self, size2d, normal): > if normal == (1,0,0): > size3d = (0, size2d[0], size2d[1]) > elif normal == (0,1,0): > size3d = (size2d[0], 0, size2d[1]) > else: > size3d = (size2d[0], size2d[1], 0) > return size3d > > def getsize2d(self): > return self.__size2d > > def setsize2d(self, size2d): > self.__size2d = size2d > self.__size = self.__calcsize3d(size2d, self.__normal) > self.redraw() > > size2d = property(getsize2d, setsize2d) > > def getnormal(self): > return self.__normal > > def setnormal(self, normal): > self.__normal = normal > self.__size = self.__calcsize3d(self.__size2d, normal) > self.redraw() > > normal = property(getnormal, setnormal) > > def getsurf(self): > """Get __surf element""" > return self.__surf # surf is the applied bc > > def setsurf(self, surf): > """Set __surf element""" > self.__surf = surf # records the surf > color = self.__surf.color # records the color of the surf > self.redraw() # and now redraws, with new color > > surf = property(getsurf, setsurf) > > def getfdscommand(self): > """Get the FDS command of this obj""" > fdscommand = "&VENT " > fdscommand += "ID=\'" + self.id + "\'" > fdscommand += ",XB=" + ",".join([str(a) for a in self.abscoordinates]) > fdscommand += ",SURF_ID=" + self.__surf.id > if self.fdsparam: fdscommand += "," + self.fdsparam > fdscommand += " \\" > return fdscommand > > fdscommand = property(getfdscommand) > > # main > > print "scene" > scene = display(title="FDSCad view", forward=(-1,-1,0),up=(0,0,1), autocenter=True, autoscale=True) > > # Building frames > print "Building frames:" > print " O : universe" > print " f1: first frame depending on the universe" > print " f2: second frame depending on f1" > > O = EFrame(frame=None, id="O", pos=(0,0,0)) > f1 = EFrame(frame=O, id="f1", pos=(1,2,1)) > f1.rotate() > f2 = EFrame(frame=f1, id="f2", pos=(4,2,0)) > f2.rotate() > raw_input("Proceed?") > > # Test visibility > print "Test visibility of f2" > f2.visible = False > raw_input("Proceed?") > f2.visible = True > > # Defining boundary conditions > wood = Surf(id="wood",color=(1,0,0),fdsparam="PROVA") > water = Surf(id="water",color=(0,0,1),fdsparam="PROVA") > inert = Surf(id="inert",color=(1,1,1),fdsparam="PROVA") > print wood.fdscommand > print water.fdscommand > print inert.fdscommand > > # Building an obstacle > print "Building an obstacle o1, depending on f2" > surfs = [wood,water,inert] > o1 = Obst(frame=f2, id="o1", pos=(3,2,0), size=(5,4,3), origin=(0,0,0), surfs=surfs, fdsparam="PROVA") > print o1.fdscommand > raw_input("Proceed?") > > # Building an obstacle > print "Building an obstacle o2, depending on f1" > surfs = [inert] > o2 = Obst(frame=f1, id="o2", pos=(-2.5,-2,0), size=(1,1,5), origin=(0,1,.5), surfs=surfs, fdsparam="PROVA2") > print o2.fdscommand > raw_input("Proceed?") > > # test changing bounday conditions > print "Changing o1 boundary conditions." > surfs = [wood,water,inert,inert,inert,inert] > o1.surfs = surfs > print o1.fdscommand > raw_input("Proceed?") > > # Building an hole > print "Building an hole h1, to o1." > h1 = Hole(frame=o1, id="h1", pos=(3,2,1), size=(2,3,1), origin=(.5,0,0), fdsparam="PROVA") > print h1.fdscommand > raw_input("Proceed?") > > # Testing wireframe > print "Wireframe o1." > o1.solid = False > raw_input("Proceed?") > o1.solid = True > > # Building a Vent > print "Building a Vent 1, to o1." > s1 = Vent(frame=o1, id="s1", pos=(-0.01,1,1), size2d=(2,1), surf=water, normal=(1,0,0)) > print s1.fdscommand > raw_input("Proceed?") > > # Rotate, calculate the coordinates and the absolute positions of faces > for i in range(4): > o1.rotate() > print "o1 rotation #" + str(i) > print " o1 abs pos of origin (handler): ", o1.abspos > print " o1 abs coords of the box (FDS notation): ", o1.abscoordinates > print " o1 abs faces (FDS notation: faces x0, x1, y0, y1, z0, z1): ", o1.abssurf6 > print " o1 fdsparam (passed as it is to FDS): ", o1.fdsparam > print o1.fdscommand > print > raw_input("Proceed?") > > for i in range(4): > f2.rotate() > print "f2 rotation #" + str(i) > print " o1 abs pos of origin (handler): ", o1.abspos > print " o1 abs coords of the box (FDS notation): ", o1.abscoordinates > print " o1 abs faces (FDS notation: faces x0, x1, y0, y1, z0, z1): ", o1.abssurf6 > print " o1 fdsparam (passed as it is to FDS): ", o1.fdsparam > print o1.fdscommand > print > raw_input("Proceed?") > > for i in range(4): > f1.rotate() > print "f1 rotation #" + str(i) > print " o1 abs pos of origin (handler): ", o1.abspos > print " o1 abs coords of the box (FDS notation): ", o1.abscoordinates > print " o1 abs faces (FDS notation: faces x0, x1, y0, y1, z0, z1): ", o1.abssurf6 > print " o1 fdsparam (passed as it is to FDS): ", o1.fdsparam > print o1.fdscommand > print > raw_input("Proceed?") > > print "Ended." > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > > > ------------------------------------------------------------------------ > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |