I see the issue: on a long enough press brake, this would be formed with two bending operations. But Inventor is counting a bend for each of the flange operations in the model. You could incorporate some logic to remove from the count any colinear bends, but that will cause errors. Open the attached file and walk with me...
To illustrate, let's look at three cases:
1-Real life bend count--how it is made in the shop
2-My code above (all Inventor bends)
3-Code that deducts colinear bend lines from Inventor's bend count
Look at the attached part. For the three cases:
1-Three bends
2-Four bends
3-Two bends. Two "real life" bending operations are required to accomplish what I created with Face4, but the bends are colinear!
I am sure it is possible to come up with some more elaborate code to better calculate the number of bends, but you're probably looking at a lot more code, and I doubt you will ever be able to program something that's right every time.