本文整理汇总了Python中eppy.modeleditor.IDF.copyidfobject方法的典型用法代码示例。如果您正苦于以下问题:Python IDF.copyidfobject方法的具体用法?Python IDF.copyidfobject怎么用?Python IDF.copyidfobject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eppy.modeleditor.IDF
的用法示例。
在下文中一共展示了IDF.copyidfobject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_newidfobject
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import copyidfobject [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_newidfobject
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import copyidfobject [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 == ''
示例3: print
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import copyidfobject [as 别名]
materials[-1].Conductivity = 0.16
materials[-1].Density = 600
materials[-1].Specific_Heat = 1500
# <codecell>
print(materials[-1])
# <headingcell level=4>
# Copy an existing material
# <codecell>
Peanutbuttermaterial = materials[-1]
idf1.copyidfobject(Peanutbuttermaterial)
materials = idf1.idfobjects["MATERIAL"]
len(materials)
materials[-1]
# <headingcell level=2>
# Python lesson 3: indentation and looping through lists
# <markdowncell>
# I'm tired of doing all this work, it's time to make python do some heavy lifting for us!
# <markdowncell>
# Python can go through each item in a list and perform an operation on any (or every) item in the list.
示例4:
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import copyidfobject [as 别名]
# <headingcell level=3>
# Copying/Adding an idf object
# <markdowncell>
# Having deleted two "MATERIAL" objects, we have only one left. Let us make a copy of this object and add it to our idf file
# <codecell>
onlymaterial = idf.idfobjects["MATERIAL"][0]
# <codecell>
idf.copyidfobject(onlymaterial)
# <codecell>
print(idf.idfobjects["MATERIAL"])
# <markdowncell>
# So now we have a copy of the material. You can use this method to copy idf objects from other idf files too.
# <headingcell level=2>
# Making an idf object with named arguments
# <markdowncell>