当前位置: 首页>>代码示例>>Python>>正文


Python IDF.removeidfobject方法代码示例

本文整理汇总了Python中eppy.modeleditor.IDF.removeidfobject方法的典型用法代码示例。如果您正苦于以下问题:Python IDF.removeidfobject方法的具体用法?Python IDF.removeidfobject怎么用?Python IDF.removeidfobject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eppy.modeleditor.IDF的用法示例。


在下文中一共展示了IDF.removeidfobject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_newidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import removeidfobject [as 别名]
def test_newidfobject():
    """py.test for newidfobject"""
    # make a blank idf
    # make a function for this and then continue.
    idf = IDF()
    idf.new()
    objtype = 'material:airgap'.upper()
    obj = idf.newidfobject(objtype, Name='Argon')
    obj = idf.newidfobject(objtype, Name='Krypton')
    obj = idf.newidfobject(objtype, Name='Xenon')
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Krypton'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    # remove an object
    idf.popidfobject(objtype, 1)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    lastobject = idf.idfobjects[objtype][-1]
    idf.removeidfobject(lastobject)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ]
    # copyidfobject
    onlyobject = idf.idfobjects[objtype][0]
    idf.copyidfobject(onlyobject)

    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Argon'],
                                     ]
    # test some functions
    objtype = 'FENESTRATIONSURFACE:DETAILED'
    obj = idf.newidfobject(objtype, Name='A Wall')
    assert obj.coords == []
    assert obj.fieldvalues[1] == 'A Wall'
开发者ID:jamiebull1,项目名称:eppy,代码行数:36,代码来源:test_modeleditor.py

示例2: test_zonearea_zonevolume

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import removeidfobject [as 别名]
def test_zonearea_zonevolume():
    """py.test for zonearea and zonevolume"""
    idftxt = "Zone, 473222, 0.0, 0.0, 0.0, 0.0, , 1;  BuildingSurface:Detailed, F7289B, Floor, Exterior Floor, 473222, Ground, , NoSun, NoWind, , 4, 2.23, 2.56, 0.0, 2.23, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.56, 0.0;  BuildingSurface:Detailed, F3659B, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.56, 1.49, 2.23, 2.56, 0.0, 0.0, 2.56, 0.0, 0.0, 2.56, 1.49;  BuildingSurface:Detailed, 46C6C9, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 0.0, 1.49, 2.23, 0.0, 0.0, 2.23, 1.02548139464, 0.0, 2.23, 1.02548139464, 1.49;  BuildingSurface:Detailed, 4287DD, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 2.56, 1.49, 0.0, 2.56, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.49;  BuildingSurface:Detailed, 570C2E, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 0.0, 1.49, 0.0, 0.0, 0.0, 2.23, 0.0, 0.0, 2.23, 0.0, 1.49;  BuildingSurface:Detailed, BAEA99, Roof, Exterior Roof, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 2.56, 1.49, 0.0, 0.0, 1.49, 2.23, 0.0, 1.49, 2.23, 2.56, 1.49;  BuildingSurface:Detailed, C879FE, Floor, Exterior Floor, 473222, Ground, , NoSun, NoWind, , 4, 3.22, 2.52548139464, 0.0, 3.22, 1.02548139464, 0.0, 2.23, 1.02548139464, 0.0, 2.23, 2.52548139464, 0.0;  BuildingSurface:Detailed, 25B601, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 1.02548139464, 1.49, 2.23, 1.02548139464, 0.0, 2.23, 2.52548139464, 0.0, 2.23, 2.52548139464, 1.49;  BuildingSurface:Detailed, F5EADC, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 1.02548139464, 1.49, 2.23, 1.02548139464, 0.0, 3.22, 1.02548139464, 0.0, 3.22, 1.02548139464, 1.49;  BuildingSurface:Detailed, D0AABE, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 3.22, 1.02548139464, 1.49, 3.22, 1.02548139464, 0.0, 3.22, 2.52548139464, 0.0, 3.22, 2.52548139464, 1.49;  BuildingSurface:Detailed, B0EA02, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 3.22, 2.52548139464, 1.49, 3.22, 2.52548139464, 0.0, 2.23, 2.52548139464, 0.0, 2.23, 2.52548139464, 1.49;  BuildingSurface:Detailed, E6DF3B, Roof, Exterior Roof, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.52548139464, 1.49, 2.23, 1.02548139464, 1.49, 3.22, 1.02548139464, 1.49, 3.22, 2.52548139464, 1.49;  BuildingSurface:Detailed, 4F8681, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.52548139464, 1.49, 2.23, 2.52548139464, 0.0, 2.23, 2.56, 0.0, 2.23, 2.56, 1.49;  "
    idf = IDF(StringIO(idftxt))
    result = modeleditor.zonearea(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zonearea_floor(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zonearea_roofceiling(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zone_floor2roofheight(idf, '473222')
    assert almostequal(result, 1.49)
    result = modeleditor.zoneheight(idf, '473222')
    assert almostequal(result, 1.49)
    result = modeleditor.zone_floor2roofheight(idf, '473222')
    assert almostequal(result, 1.49)
    result = modeleditor.zonevolume(idf, '473222')
    assert almostequal(result, 10.718762)
    # remove floor
    zone = idf.getobject('ZONE', '473222')
    surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
    zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
    floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR']
    for floor in floors:
        idf.removeidfobject(floor)
    result = modeleditor.zonearea_floor(idf, '473222')
    assert almostequal(result, 0)
    result = modeleditor.zonearea_roofceiling(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zonearea(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zoneheight(idf, '473222')
    assert almostequal(result, 1.49)
    result = modeleditor.zonevolume(idf, '473222')
    assert almostequal(result, 10.718762)
    # reload idf and remove roof/ceiling
    idf = IDF(StringIO(idftxt))
    zone = idf.getobject('ZONE', '473222')
    surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()]
    zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name]
    roofs = [s for s in zone_surfs if s.Surface_Type.upper() == 'ROOF']
    ceilings = [s for s in zone_surfs if s.Surface_Type.upper() == 'CEILING']
    topsurfaces = roofs + ceilings
    for surf in topsurfaces:
        idf.removeidfobject(surf)
    result = modeleditor.zonearea_roofceiling(idf, '473222')
    assert almostequal(result, 0)
    result = modeleditor.zonearea(idf, '473222')
    assert almostequal(result, 7.1938)
    result = modeleditor.zoneheight(idf, '473222')
    assert almostequal(result, 1.49)
    result = modeleditor.zonevolume(idf, '473222')
    assert almostequal(result, 10.718762)
        
开发者ID:JasonGlazer,项目名称:eppy,代码行数:55,代码来源:test_modeleditor.py

示例3: test_removeidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import removeidfobject [as 别名]
 def test_removeidfobject(self):
     """py.test for IDF.removeidfobject """
     idftxt = ""
     idfhandle = StringIO(idftxt)
     idf = IDF(idfhandle)
     key = "BUILDING"
     idf.newidfobject(key, Name="Building_remove")
     idf.newidfobject(key, Name="Building1")
     idf.newidfobject(key, Name="Building_remove")
     idf.newidfobject(key, Name="Building2")
     buildings = idf.idfobjects["building".upper()]
     removethis = buildings[-2]
     idf.removeidfobject(removethis)
     assert buildings[2].Name == "Building2"
     assert idf.model.dt[key][2][1] == "Building2"
开发者ID:Nobatek,项目名称:eppy,代码行数:17,代码来源:test_IDF.py

示例4: test_newidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import removeidfobject [as 别名]
def test_newidfobject():
    """py.test for newidfobject"""
    # make a blank idf
    # make a function for this and then continue.
    idf = IDF()
    idf.new()
    objtype = 'material:airgap'.upper()
    obj = idf.newidfobject(objtype, Name='Argon')
    obj = idf.newidfobject(objtype, Name='Krypton')
    obj = idf.newidfobject(objtype, Name='Xenon')
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Krypton'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    # remove an object
    idf.popidfobject(objtype, 1)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    lastobject = idf.idfobjects[objtype][-1]
    idf.removeidfobject(lastobject)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ]
    # copyidfobject
    onlyobject = idf.idfobjects[objtype][0]
    idf.copyidfobject(onlyobject)

    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Argon'],
                                     ]
    # test some functions
    objtype = 'FENESTRATIONSURFACE:DETAILED'
    obj = idf.newidfobject(objtype, Name='A Wall')
    assert obj.coords == []
    assert obj.fieldvalues[1] == 'A Wall'
    
    # test defaultvalues=True and defaultvalues=False
    sim_deftrue = idf.newidfobject('SimulationControl'.upper(), defaultvalues=True)
    assert sim_deftrue.Do_Zone_Sizing_Calculation == 'No'
    sim_deffalse = idf.newidfobject('SimulationControl'.upper(), defaultvalues=False)
    assert sim_deffalse.Do_Zone_Sizing_Calculation == ''
开发者ID:santoshphilip,项目名称:eppy,代码行数:42,代码来源:test_modeleditor.py

示例5: print

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import removeidfobject [as 别名]
# <codecell>

print(idf.idfobjects['MATERIAL'])

# <markdowncell>

# You can see that the second material is gone ! Now let us remove the first material, but do it using a different function

# <codecell>

firstmaterial = idf.idfobjects['MATERIAL'][-1]

# <codecell>

idf.removeidfobject(firstmaterial)

# <codecell>

print(idf.idfobjects['MATERIAL'])

# <markdowncell>

# So we have two ways of deleting an idf object:
# 
# 1. popidfobject -> give it the idf key: "MATERIAL", and the index number
# 2. removeidfobject -> give it the idf object to be deleted

# <headingcell level=3>

# Copying/Adding an idf object
开发者ID:Nobatek,项目名称:eppy,代码行数:32,代码来源:newfunctions.py


注:本文中的eppy.modeleditor.IDF.removeidfobject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。