First time here? Check out the Help page!
1 | initial version |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |resource|
if resource.directUseCount == 0
unused_flag_counter += 1
resource.remove
end
end
@david-goldwasser or I can probably add curves to the Remove Orphan Objects and Unused Resources BCL measure.
2 | No.2 Revision |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |resource|
if resource.directUseCount == 0
unused_flag_counter += 1
resource.remove
end
end
@david-goldwasser or I can probably add I've added curves to the Remove Orphan Objects and Unused Resources measure. The updated version should be on BCL measure.in the next week or so, or you can grab it from GitHub here.
3 | No.3 Revision |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |resource|
if resource.directUseCount == 0
unused_flag_counter += 1
resource.remove
end
end
I've added curves to the Remove Orphan Objects and Unused Resources measure. The updated version should be on BCL in the next week or so, or you can grab it from GitHub here.
4 | No.4 Revision |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |resource|
|curve|
if resource.directUseCount curve.directUseCount == 0
unused_flag_counter += 1
resource.remove
model.removeObject(curve.handle)
end
end
I've added curves to the Remove Orphan Objects and Unused Resources measure. The updated version should be on BCL in the next week or so, or you can grab it from GitHub here.
5 | No.5 Revision |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |curve|
if curve.directUseCount == 0
unused_flag_counter += 1
model.removeObject(curve.handle)
end
end
I've added curves to the Remove Orphan Objects and Unused Resources measure. The updated version should be on BCL in the next week or so, or you can grab it from GitHub here.
EDIT: use model.removeObject instead of curve.remove because of this issue. Thanks to @Eric Ringold for the workaround.
6 | No.6 Revision |
Take a look at the Remove Orphan Objects and Unused Resources measure on BCL for an example.
OpenStudio::Model::Curve
objects are a child of OpenStudio::Model::ResourceObject
[link to documentation], which has a directUseCount
method.
So your code could look as simple as:
unused_flag_counter = 0
model.getCurves.sort.each do |curve|
if curve.directUseCount == 0
unused_flag_counter += 1
model.removeObject(curve.handle)
end
end
I've added curves to the Remove Orphan Objects and Unused Resources measure. The updated version should be on BCL in the next week or so, or you can grab it from GitHub here.
EDIT: use model.removeObject instead of curve.remove because of this issue. Thanks to @Eric Ringold for the workaround.