Subtract List A from List B to create List C


#1

I need help guys, I’m still learning all the nodes functions I have no idea how to do this. Now, I’ve been cracking my head since yesterday trying to find out how to do a simple operation like this on lists. I have a couple of Lists, List A (0,1,2,3,4,5) and List B (1,2,3,4,5,6). I want to combine these lists into List C and while doing so I would also like to do a simple operation like <span>Subtract</span> List A from List B. I tried using the operations function “x-y” but it doesn’t seem to work for arrays. An elaborate explanation with the solution would be greatly appreciated.


#2

You mean something like this?

List A- List B


#3

Yes! but I’m trying to do it from a List of selected Revit Elements that has its own set of parameters. and it doesn’t seem to work from those.

The selected Revit Element has Parameters A & B… i want to generate Parameter C from them using Dynamo so that I can export the results to excel.
<span style=“color: #3366ff;”> --> List A has parameter A (length)</span>

<span style=“color: #3366ff;”>Revit Element – --> Subtract List A from List B to generate List C with the difference of A-B = C (length)</span>

<span style=“color: #3366ff;”> --> List B has parameter B (length)</span>

 

I need to Subtract Parameter A from Parameter B to get Parameter C.

 


#4

Yes! but I’m trying to do it from a List of selected Revit Elements that has its own set of parameters. and it doesn’t seem to work from those.

The selected Revit Element has Parameters A & B… i want to generate Parameter C from them using Dynamo so that I can export the results to excel.

Capture

 

I need to Subtract Parameter A from Parameter B to get Parameter C.

 

 

Edit: Sorry for the double post I don’t know how to delete my previous post…


#5

Hello Wulfrum,

As I don’t have your graph but I am guessing, the value which you are getting for Parameter is must be with units mention in it.

Generally after getting Parameter value, we need to extract Number from it, if we are going to pass that value to another Node.

See attached graph for more details.

Do let me know if this doesn’t solve your problem.

Thanks,

Ritesh

ParameterValueInNumber


#6

Thanks Ritesh! this solves my problem :smiley:


#7

Hi Ritesh

Now I have another problem, I’m trying to multiply List A with List B. However, the SIUnit.Value does not seem to help me this time.

I keep getting this error.

Error


#8

Hi Wulfrum, check your list structure. At least one of your lists is not flat. The * operator works just like you would expect it to, but it needs to be on a flat list. Use the * node and map it to nested lists if you want to keep an existing structure.