Macro to Extract values from cutlist to variable and add

Hello,
If this has been talked about, kindly point me in the right direction. I want to take 2 variables from my sheetmetal cutlist and add them together to make another value. The variables are the inner and outer perimeters to get a complete perimeter. Is there a way to do this using a macro?

If you go to the help and type in “Linking a Cut List Folder to a Cut List Property” it gives you the steps to do what I think you want to do…

In the Cut-List Properties dialog box, you can add a custom property that links a cut list folder to its cut list folder name. You can then include this cut-list property in BOMs, notes, and sheet formats. This property helps to identify members in large multibody weldments.

To link a cut list folder to a cut list property:

In the FeatureManager design tree, right-click a Cut-List-Folder and click Properties.
On the Cut List Summary tab, click an empty cell under Property Name and add a new property.
Under Value/Text Expression, choose Cut List Item Name from the list.

The text in Value/Text Expression displays SW-CutListItemName@@@@<Part name.Sldprt and the evaluated value displays the cut list folder name.

I believe the thing it does not tell you is you need to use the drop down under Type and select equation to add the fields together.
image.png
I added cutting length outer and bend allowance. 27.584 + 0.208 equals the 27.792 value shown

When you select equation for type you get a list of the cut list properties show up when you click the box
image.png

I was able to pull the numbers out of the cutlist, and “add them together”, but as per your example mine says 27.5840.208. If I go to the properties, I can select “Equation” from the dropdown, and it will add them together. Question is, how do I get the Type to be “Equation”, not “Text” within the macro?

See if these links are of any help.

Add3 Method

swCustomInfoType_e Enumeration

Thanks for the links! I think I found my issue. The SW I am currently running is 2023, but according to the links swCustomInfoEquation has been added with 2024. So I will have to upgrade, which is soon anyway.
I have used the Add3 and it was working but again got stuck on the Equation bit.
Thanks Everyone for the tips!

According to this person on Reddit, there was a time it defaulted to Equation instead of text.

https://www.reddit.com/r/SolidWorks/comments/qlyueu/api_swcustominfotype_for_text_vs_equation/

I saw that post too. I could get my macro to add if they are actual numbers, say if I use a=5 and b=6 I get 11 as my property. But if I try to take a property out of the cutlist like “SW-Bounding Box Length@@@Cut-List-Item1@J600840-206.SLDPRT”, I get 56 instead of 11. But like I said earlier, if I change the Text to Equation, I get 11. Now that being said, could it be how my variable is declared? If so what would be the correct declaration?

Look at this links → https://forum.cadmunity.com/t/missing-enumartion-for-equation/2110/1
for a workaround with the trouble with the Add3 Methode and the Equation