LunchBox Mass Addition

Is the LunchBox Mass Addition node still available (via package)?

Thanks in advance.
Knipsel

Double click the node, then see if there are any errors in the custom node graph

@t.large

I’m not fully understand what you mean?

Right click on the Mass Addition node, and hit “Edit Custom Node”, this will bring you to the Custom Node editor (where the background is of a yellow hue.) Take a screenshot there, and try to capture any error messages.

Here you will see the nodes that construct the Custom Node itself, in this case “LunchBox Mass Addition”

Sometimes you can fix the verbiage of an input node or something small that will correct the functionality of the node. Worst case is that you screw up the node, and then save it. In that case you can just delete the package and reinstall the same package.

There’s a bit of a learning curve with fixing expired Package Nodes, but it’s usually possible.

Because the node is unresolved there is nothing to open.

Fortunately mass addition is straight forward. Something like this should work in Design Script.

Math.Sum(DSCore.List.Drop(lst@, -DSCore.List.Count(lst)..0));

1 Like

@kyle_martin_Gensler

Can you maybe share the python script (see also fig. 1)?

Fig-1
Fig.1

Thanks in advance.

@JacobSmall

I get the following messages (first fig.1 afterwards fig. 2)
Where do I place the " " (closeparen)?


Fig. 1


Fig. 2

Thanks in advance.

@j.boonen - ProvingGround has stopped updating and further developing the LunchBox package for Dynamo, however they have made the source code for all previous nodes available on GitHub!

ProvingGround Apps page (notice of discontinued Dynamo at bottom):

GitHub source code for Lunchbox Mass Addition specifically:
https://bitbucket.org/provingground-io/lunchbox-for-dynamo/src/master/Custom%20Nodes/LunchBox%20Mass%20Addition.dyf

Below is my best attempt at pasting the Python-specific portion. Notice there are two outputs in the original node – Result & Partials (each sequential number with the previous sum added). You want the Partials code only (green arrow, 2nd section of Python code below). Instructions: if you place a NEW Python not on your Dynamo canvas > right-click > Edit… > paste this code, it should function the same as Mass Addition.

Lastly, shout-out to Nate Miller & Team for this wonderful contribution to expanding OOTB Dynamo functionality!


#Copyright(c) 2014, Nathan Miller
#The Proving Ground
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

#The input to this node will be stored in the IN[0] variable.
list = IN[0]
mass = 0
masspart =

if hasattr(list, “iter”):
for i in range(0,len(list)):
mass = mass + list[i]
masspart.append(mass)
else:
masspart.append(list)

#Assign your output to the OUT variable
OUT = masspart


#Copyright(c) 2014, Nathan Miller
#The Proving Ground
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

#The input to this node will be stored in the IN[0] variable.
list = IN[0]
mass = 0
if hasattr(list, “iter”):
for i in range(0,len(list)):
mass = mass + list[i]
else:
mass = list

#Assign your output to the OUT variable
OUT = mass

1 Like

Sorry - typed taht a bit too quick. It should be lst@L2<1>, so the full line of code is:

Math.Sum(DSCore.List.DropItems(lst@L2<1>, -DSCore.List.Count(lst)..0));
1 Like

I believe this node from Crumple should do the same thing and is in python:

1 Like

@jacob.small @kyle_martin_Gensler @GavinCrump

Thanks for all your help!

I did a quick test of all incoming input.

#Python script Crumple = Gavin
#Python script copy = OUT masspart = Kyle
#Python script copy = OUT mass = Kyle
Code Block = Math.Sum(DSCore.List.DropItems(lst@L2<1>, -DSCore.List.Count(lst)…0)); = Jacob

I’m still stuck with different outputs see screenshot as well as source data. Is this to do with me working in Revit 2022 (and dynamo version 2.12)?

Fig. 1

Source data:
202101_BGD_XX_ZZ_M3_A_0037_Space-planning.dyn (321.0 KB)
(v19 version Autodesk Construction Cloud)

Thanks in advance.

Make sure you’re not just blindly copying code. Most of the python suggestions contain the solution but still need to be modified in order to work properly.

Simple python solution:

m = 0
out = []
for n in IN[0]:
    m = m+n
    out.append(m)
OUT = out

Simple DesignScript solution:
Math.Sum(List.TakeItems(nums,1..List.Count(nums)));

4 Likes

@Nick_Boyts

Thanks for the above post.
Should I get the same output with the above?
As well as do you recommend working with python script or via design script?

Currently, I get the following (see fig 1).


Fig.1

Source data:
202101_BGD_XX_ZZ_M3_A_0037_Space-planning.dyn (326.8 KB)
(v20 version Autodesk Construction Cloud)

Thanks in advance.

Can you show the python code and your input into the node?

@Nick_Boyts

Python Code:
Fig-6

Input (fig. 1 and fig. 2)


Fig. 1

Fig-5
Fig. 2

That looks like a screenshot of the code I posted. We need to see the actual python node you’re using to see what’s happening. You’re not getting an error, so it seems like you’re just missing something in the node.

@Nick_Boyts

Thanks in advance.

Ah. Looks like you’re editing the node name, not the actual python code. Make sure you double-click in the light gray space or right-click and edit.

@Nick_Boyts

Thanks!


Fig. 1

@Nick_Boyts @JacobSmall @kyle_martin_Gensler @GavinCrump

Thanks for the posts above.

However, further into the script I also run into the following “LunchBox Mass Addition”, however the Designscript/ Python scripts from above for this does not help at the moment.

Do you guys see what’s going wrong?


Fig. 1


Fig. 2

Thanks in advance.