I’m trying to replicate a simple chain of nodes in a Design Script node but can’t for the life of me flatten it with Design Script the same way I was able to do it with the nodes. My first step was to carefully check that the inputs were the same and structured the same. They were. I also tried different methods to force more levels of flattening but I couldn’t get it to output the same as above. In the screen cap one can see “2” as the level but I also tried different nested and looped configurations but in the end couldn’t get it to flatten like the nodes above.
Am I missing anything small and simple? I’m on REVIT 2018.3 and Dynamo 2.0.2.
es.
I’m guessing it’s because the Flatten process is within your defined function. Your function takes a few inputs, does some stuff, and then flattens the output; but now it’s doing that on a list of inputs. Essentially you’re flattening each line of inputs rather than the entire list at the end. You would have to set up your function to accept list inputs and loop through each item.
1 Like
Ah. So you think I need to loop the list through flatten first. Nice catch. I will try that tomorrow.
dynamo wants to replicate - if you know that your inputs are lists (and not single items so you don’t want to replicate) then mark them as var… - then whatever you pass into the function will be exactly what you will get and your function will only be called once.
Spent more time today on this issue but couldn’t get a flatten loop working or List.Map in a design script node.
Can you describe in a bit more detail because the planes var is indeed coming in as a list and I suspect that is the root cause but trying to place “…” at a couple places didn’t clear the error. Just need some more hints I think.
sure, what I mean is to make all your input params to your function of type var[]..[]
- then your function won’t replicate - it will only be called once over the entire set of inputs, like if you were using python or c.
This type is called an arbitrary rank array,
If some of your inputs are marked this way and some not, dynamo may still replicate over the non arbitrary ranked inputs.
I thought your workaround sounded quite straightforward but when I was working through it today I got the unexpected error “closeparen expected”. Searching online it looks like this is almost certainly 100% user error but I couldn’t find my mistake. Could this be a bug in Dynamo 2.0.2? In any case, I must avail myself to the forums again for help.
The reason I’m trying to write a script that segments exterior wall geometry by level is because I don’t necessarily want to segment and post-process each exterior building wall the same. The post-processing I want to try on each surface is trivial assuming I can actually get the list into a usable configuration. I’m trying to achieve a flat 1 level deep list as output .
Original:
Error:
What @Michael_Kirschner2 is stating is that you have to mark your variables with var… like this:
4 Likes
What a pain but I did get it fixed and appreciate the help. Now on to part 2!
1 Like