Codeblock for loops with nodes

Aren’t you missing “name=Revit.Element.Name()” before Imperative?

I haven’t tested it.

@M.Perez
you mean to call the function?
The error says: Function not found

Random thought : Maybe executing the graph on Dynamo 2.0 is the solution.

You’re saying if (s=="Keine") but s is your loop counter so it’ll always go to else. You want to be checking if (lst_str[e] == "Keine") (or lst_str[s], I guess).

Not sure why the else block isn’t yielding anything, though…

As for the name=Revit.Element.Name, (no brackets) you should then replace Revit.Element.Name in the imperative block with just name

thx for your help! Im getting to unterstand this.
But there is still a mistake in it.
The else loop seems not to work right.

Not just the Revit part :wink:

Also I think the other one works fine but you only need one for-loop (assuming k and p are always going to be the same) since now you’re overwriting the new list. The results[s] assignment is currently independent of the if-statement, which is why Phase continues to show up at the end.


Can’t directly test it as I don’t have the correct inputs ready but I think this should work (the if test to see if k==p is entirely optional).
PS Be sure to change the bracket type on line 7 to {}

yes, the second loop was overwriting the list.


But with "name(lst_elements[s]);
i get this error:
Eine Ausnahme vom Typ “ProtoCore.Exceptions.CompilerInternalException” wurde ausgelöst.

   bei ProtoCore.DSASM.Executive.CallrForMemberFunction(Int32 blockIndex, Int32 classIndex, Int32 procIndex, Boolean hasDebugInfo, Boolean& isExplicitCall)
   bei ProtoCore.DSASM.Executive.CALLR_Handler(Instruction instruction)
   bei ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, Language language)
   bei ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, List`1 breakpoints, Language language)
   bei ProtoCore.DSASM.Executive.BounceUsingExecutive(Executive executive, Int32 exeblock, Int32 entry, StackFrame stackFrame, Int32 locals, Boolean fepRun, Executive exec, List`1 breakpoints)
   bei ProtoScript.Runners.ProtoScriptRunner.ExecuteLive(Core core, RuntimeCore runtimeCore)
   bei ProtoScript.Runners.LiveRunner.Execute(Boolean isCodeCompiled)
   bei ProtoScript.Runners.LiveRunner.CompileAndExecute(List`1 astList)
   bei ProtoScript.Runners.LiveRunner.CompileAndExecuteForDeltaExecution(List`1 astList)
   bei ProtoScript.Runners.LiveRunner.SynchronizeInternal(GraphSyncData syncData)
   bei ProtoScript.Runners.LiveRunner.UpdateGraph(GraphSyncData syncData)
   bei Dynamo.Scheduler.UpdateGraphAsyncTask.HandleTaskExecutionCore()
   bei Dynamo.Scheduler.AsyncTask.Execute()

I think you can just change it back to Element.Name, since it doesn’t appear you have namespace issues?

Another approach. Maybe this will solve your problem.

Ps : don’t care about the three first node, they’re just there to create a list of objects ressembling yours.

keine.dyn (16.1 KB)

changed it back to Element.Name


Eine Ausnahme vom Typ “ProtoCore.Exceptions.CompilerInternalException” wurde ausgelöst.

   bei ProtoCore.DSASM.Executive.CallrForMemberFunction(Int32 blockIndex, Int32 classIndex, Int32 procIndex, Boolean hasDebugInfo, Boolean& isExplicitCall)
   bei ProtoCore.DSASM.Executive.CALLR_Handler(Instruction instruction)
   bei ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, Language language)
   bei ProtoCore.DSASM.Executive.Execute(Int32 exeblock, Int32 entry, List`1 breakpoints, Language language)
   bei ProtoCore.DSASM.Executive.BounceUsingExecutive(Executive executive, Int32 exeblock, Int32 entry, StackFrame stackFrame, Int32 locals, Boolean fepRun, Executive exec, List`1 breakpoints)
   bei ProtoScript.Runners.ProtoScriptRunner.ExecuteLive(Core core, RuntimeCore runtimeCore)
   bei ProtoScript.Runners.LiveRunner.Execute(Boolean isCodeCompiled)
   bei ProtoScript.Runners.LiveRunner.CompileAndExecute(List`1 astList)
   bei ProtoScript.Runners.LiveRunner.CompileAndExecuteForDeltaExecution(List`1 astList)
   bei ProtoScript.Runners.LiveRunner.SynchronizeInternal(GraphSyncData syncData)
   bei ProtoScript.Runners.LiveRunner.UpdateGraph(GraphSyncData syncData)
   bei Dynamo.Scheduler.UpdateGraphAsyncTask.HandleTaskExecutionCore()
   bei Dynamo.Scheduler.AsyncTask.Execute()

and


gives me the error: "Waring:‘DSCore.List.Flatten()’ is not a static method.

Should i install Dynamo 1.3 new?

There is something wrong with your IndexOf method. It should return 3, not -1.
For the error, try return = l; instead of return = List.Flatten(l); and flatten the list afterwards.

don’t know why indexOF works wrong…it should be 3


The result has now a lenth of 7, but it should be 6.

haha…i have purched Dynamo and installed 1.3 new:
Now i have a list with 6 elements …this is good, but IndexOf is still wrong

Another way to test the elements and bypass your List.IndexOf problem (i guess ?). Maybe the node does not suit elements but does suit booleans.

Care about the lacing on the new == node.


yes this solves the problem.
Thx you for your help.

1 Like

@Fiesta The issue seems to be similar to lists that begin with null
Introduce (and later remove) a dummy Phase element to the top of your list to resolve this
phaseNone.dyn (6.9 KB)

1 Like

thx Vikram, this solution works good

1 Like