Пример #1
0
def test_obj2bunch():
    """py.test for obj2bunch"""
    thedata = (
        ([
            "ZONE",
            "",
            "0",
            "0",
            "0",
            "0",
            "1",
            "1",
            "autocalculate",
            "autocalculate",
            "autocalculate",
            "",
            "",
            "Yes",
        ]),  # obj
    )
    for obj in thedata:
        key_i = data.dtls.index(obj[0].upper())
        abunch = idfreader.makeabunch(commdct, obj, key_i)
        result = modeleditor.obj2bunch(data, commdct, obj)
        assert result.__repr__() == abunch.__repr__()
Пример #2
0
def test_addthisbunch():
    """py.test for addthisbunch"""
    obj1 = ['ZONE', 'weird zone', '0', '0', '0', '0', '1', '1', 'autocalculate', 
        'autocalculate', 'autocalculate', '', '', 'Yes']
    thisbunch = modeleditor.obj2bunch(data, commdct, obj1)
    modeleditor.addthisbunch(bunchdt, data, commdct, thisbunch)
    assert data.dt["ZONE"][-1] == obj1
Пример #3
0
def test_addthisbunch():
    """py.test for addthisbunch"""
    obj1 = [
        'ZONE', 'weird zone', '0', '0', '0', '0', '1', '1', 'autocalculate',
        'autocalculate', 'autocalculate', '', '', 'Yes']
    thisbunch = modeleditor.obj2bunch(data, commdct, obj1)
    modeleditor.addthisbunch(bunchdt, data, commdct, thisbunch)
    assert data.dt["ZONE"][-1] == obj1
Пример #4
0
def addthisbunch(bunchdt, data, commdct, thisbunch, theidf):
    """add a bunch to model.
    abunch usually comes from another idf file
    or it can be used to copy within the idf file"""
    key = thisbunch.key.upper()
    obj = copy.copy(thisbunch.obj)
    abunch = obj2bunch(data, commdct, obj)
    bunchdt[key].append(abunch)
    return abunch
Пример #5
0
def test_obj2bunch():
    """py.test for obj2bunch"""
    thedata = ((['ZONE', '', '0', '0', '0', '0', '1', '1', 'autocalculate', 
        'autocalculate', 'autocalculate', '', '', 'Yes']), # obj
    )
    for obj in thedata:
        key_i = data.dtls.index(obj[0].upper())
        abunch = idfreader.makeabunch(commdct, obj, key_i)
        result = modeleditor.obj2bunch(data, commdct, obj)
        assert result.__repr__() == abunch.__repr__()
Пример #6
0
    def newidfobject(self, key, aname='', **kwargs):
        """
        Add a new idfobject to the model. If you don't specify a value for a
        field, the default value will be set.

        For example ::

            newidfobject("CONSTRUCTION")
            newidfobject("CONSTRUCTION",
                Name='Interior Ceiling_class',
                Outside_Layer='LW Concrete',
                Layer_2='soundmat')

        Parameters
        ----------
        key : str
            The type of IDF object. This must be in ALL_CAPS.
        aname : str, deprecated
            This parameter is not used. It is left there for backward 
            compatibility.
        **kwargs
            Keyword arguments in the format `field=value` used to set the value
            of fields in the IDF object when it is created. 

        Returns
        -------
        EpBunch object

        """
        obj = newrawobject(self.model, self.idd_info, key)
        abunch = obj2bunch(self.model, self.idd_info, obj)
        if aname:
            warning.warn("The aname parameter should no longer be used.")
            namebunch(abunch, aname)
        self.idfobjects[key].append(abunch)
        for k, v in kwargs.items():
            abunch[k] = v
        return abunch