Closed santoshphilip closed 5 years ago
Solution: This problem can be resolved with two new functions
extensiblefields2list(idfobject)
list2extensiblefields(idfobject, newlist)
As an example:
points = extensiblefields2list(surface)
print(points)
>> [(2,3,4), (4,5,6), (6,4,3), (9,0,8)]
oldpoints = [(2,3,4), (4,5,6), (6,4,3), (9,0,8)]
newpoints = oldpoints + [(3,4,19)]
list2extensiblefields(surface, newpoints)
Similarly:
branches = extensiblefields2list(branchlist)
print(branches)
>> ["Branch1", "Branch2"]
branches.append("Branch3")
list2extensiblefields(branchlist, branches)
from the pull request:
Problem: need and easy way to work with extensible fields in the idfobject Solution: new functions extensiblefields2list() and list2extensiblefields()
Limitation: both the functions work with flat lists. For the coordinates of a building surface it will return [2,3,4,22,33,44] instead of [(2,3,4),(22,33,44)]
All tests pass no complaints form lint
The pull request has been merged
Problem: Right now if you have branch list, it is difficult to remove an item from the middle of the list. The other items in the list have to move up to fill the gap made by the removed item. Usually this has to be done line by line.
Consider an example branch list
If you want to remove the
Central Boiler Branch
(Branch 2 Name), the corresponding eppy code would look like:Actually there is no esy way to remove "Branch 4 Name"" :-(
You can manipulate values in the list
branchlist.fieldvalues
. But you have to know what you are doing.As similar issue occurs with vertices of a surface such as BuildingSurface:Detailed
You can see this when using idfEditor too. It is much easier to do this in the text editor.
There is a need for a function that makes it easy to add, insert, remove, find or pop an items in extensible fields.
Documentation of extensible fields from the idd file