I want to combine parameters for room based on the user input and push it to the target text parameter.
user will provide input in form of defined syntax. anything inside {} brackets are parameters and anything inside ""is a separator.
i got the parameters for each room but now i don’t know how can i concatenate based on the input provided.
overall goal is to be flexible and in future i want to control all these combined parameters from excel. i am stuck now here how to combine based on the input provided.
or i am doing it wrong and there is any easy way of doing it?
i know schedules can do combine parameters but i need try a lot of other things once i get how to achieve this.
thanks
The problem is that your separators change in number and in combination. If it was one or the other (single separator value but any number of parameters or any combination of separator values but always the same number of parameters) then you’d be able to easily hardcode one or the other. Without that limitation you’re better off doing everything in python - which isn’t too hard for what you’re looking for.
Using your second python script as a starting point (because it has both the parameter names and the separators already in order), you just need to introduce a loop to alternate between appending a returned parameter value and appending the current string.
I haven’t had a chance to actually test this, but it should get you pretty close:
# values = your list of alternating parameter names and separators (previously calculated)
# result = an empty string to append to
# isParam = a boolean to remember whether we're on a parameter name or a separator value
# rooms = a list of room elements to retrieve parameter values from (previously collected)
# output = list to append room results to
output = []
for room in rooms:
result = ""
isParam = True
for val in values:
if isParam:
result += room.LookupParameter(val).AsValueString()
else:
result += val
isParam = not isParam
output.append(result)
OUT = output