Here’s an issue I’ve been struggling with for DAYS (aaghhh!!!) - any help would be hugely appreciated
I have a piece of script I’ve found online and fiddled with - essentially there are two variables; a “Roof Shape Code” and a “Roof Shape Name”. I’m trying to ask Dynamo to check the Sheet Properties of a given sheet for it’s “Roof Shape Code” parameter, and return a value to its “Roof Shape Name”.
If I “hard code” these answers, then there is no problem (i.e., if Roof Shape Code = R3, then return = “This works”); the problem occurs when I want to return a variable (i.e., if Roof Shape Code = R1, then return = r1Ans - whereby “r1Ans” is a property of the Revit Project).
The three small watch windows on the right prove that the script is finding the Project Information parameters I’m looking for; however the large watch on the far right illustrates the problems highlighted with red (null). Similarly, the highlighted box above shows that the “Roof Shape Name” is not being set correctly.
I’ve purposely set the last one (R3) to a fixed value “This works”, to show that this does work - it’s the variables I’m having trouble with (i.e., r1Ans, r2Ans and r3Ans).
(The areas highlighted with blue pen are supposed to be blank, so this is fine )
pass your values you want to return into the function - ie make those parameters of your function - they are null now in the scope of your roofStyle function.
I’ve checked, and the data being received from “RoofNameR1” et al. are definitely strings (see example within screenshot). I believe the problem is occurring because I’m not stating the Roof Style Name (i.e., “Ridge”) in Dynamo, but within Revit. This is to make it easier for non-Dynamo users.
I believe the issue is that your output from the “Element.GetParameterValueByName” is a list. In your definition of “RoofStyle” there is no rank specified.
Either retrieve the string from the list returned by “Element.GetParameterValueByName” or define your variables with rank.
Sounds like you may have hit on something there lsmm - when I replace the “Element.GetParameterValueByName” for each of the “RoofName_R1” etc. sections with a straight forward codeblock string, it works. The difference being that I am inputting a string, rather than a list of strings.
How do I tell Dynamo to convert a list of one item, into a single string?