def test_readsketchup():
    """py.test for readsketchup"""
    data = readsketchup_data
    result = readsketchup.readsketchup(data.txt)
    dct = data.dct
    assert set(tuple(result.keys())) == set(tuple(dct.keys()))
    # for key in result.keys():
    #     print result[key]
    #     print dct[key]
    #     assert result[key] == dct[key]
    assert result == dct
Ejemplo n.º 2
0
def makeidf(txt):
    """make idf file from the file generated by sketchup"""
    dct = readsketchup.readsketchup(txt)
    dct = readsketchup.duplicatewindows(dct)
    dct = readsketchup.inch2meters(dct)
    zonestxt = eplusgeom.makezones(dct)
    wallstxt = eplusgeom.makewalls(dct)
    windowstxt = eplusgeom.makewindows(dct)

    snippet1 = """
VERSION,
    1.3;                     !- Version Identifier

!-   ===========  ALL OBJECTS IN CLASS: BUILDING ===========

BUILDING,
    Building,                !- Building Name
    0.,                      !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value {W}
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullExterior,            !- Solar Distribution
    25;                      !- Maximum Number of Warmup Days


"""
    snippet2 = """
!-   ===========  ALL OBJECTS IN CLASS: SURFACEGEOMETRY ===========

SurfaceGeometry,
    UpperLeftCorner,         !- SurfaceStartingPosition
    CCW,        !- VertexEntry
    WCS;                     !- CoordinateSystem


"""


    eplustxt = snippet1 + zonestxt + snippet2 + wallstxt + windowstxt
    eplustxt = eplustxt.replace('\n', '\r\n')
    return eplustxt
Ejemplo n.º 3
0
"""testing to see in what order the points in sketchup are given
Results: Right hand corkscrew in the direction of the normal"""

from Scientific.Geometry import Vector
import readsketchup
import geometry

txt = open('e.txt', 'r').read()
dct = readsketchup.readsketchup(txt)
for key in dct.keys():
    plane = dct[key]['points']
    normal = Vector(dct[key]['normal'])
    calcnormal = geometry.facenormal(plane)
    # print normal
    # print calcnormal
    print normal.angle(calcnormal)
    print
    
Ejemplo n.º 4
0
def etxtdct(fname='e.txt'):
    """get dct from a file"""
    import readsketchup
    txt = open(fname, 'r').read()
    return readsketchup.readsketchup(txt)