Codeblock for loops with nodes

#21

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

I haven’t tested it.

0 Likes

#22

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

0 Likes

#23

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

0 Likes

#24

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

0 Likes

#25

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.

0 Likes

#26

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 {}

0 Likes

#27

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()
0 Likes

#28

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

0 Likes

#29

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)

0 Likes

#30

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?

0 Likes

#31

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.

0 Likes

#32

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


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

0 Likes

#33

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

0 Likes

#34

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.

0 Likes

#35


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

1 Like

#36

@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

#37

thx Vikram, this solution works good

1 Like