本文整理汇总了Python中eppy.modeleditor.IDF.popidfobject方法的典型用法代码示例。如果您正苦于以下问题:Python IDF.popidfobject方法的具体用法?Python IDF.popidfobject怎么用?Python IDF.popidfobject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eppy.modeleditor.IDF
的用法示例。
在下文中一共展示了IDF.popidfobject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_newidfobject
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import popidfobject [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'
示例2: test_popidfobject
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import popidfobject [as 别名]
def test_popidfobject(self):
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.popidfobject(key, 2)
assert buildings[2].Name == "Building2"
assert idf.model.dt[key][2][1] == "Building2"
示例3: test_newidfobject
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import popidfobject [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 == ''
示例4:
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import popidfobject [as 别名]
#
# 1. Shiny new material object
# 2. Lousy material
# 3. third material
# <headingcell level=3>
# Deleting an idf object
# <markdowncell>
# Let us remove 2. Lousy material. It is the second material in the list. So let us remove the second material
# <codecell>
idf.popidfobject('MATERIAL', 1) # first material is '0', second is '1'
# <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>