SolidWorks API: Set sheetmetal bend allowance from gauge table

Greetings, 

has anyone been able to set a sheetmetal part to use a gauge table with K factors inside and properly link the bend allowance to that very table using an API macro? 

 

I'm developing a macro for updating an existing sheetmetal part - where the custom bend allowance was a fixed-manually specified value - to a new system using a gauge table with K factors inside.

So far:

  • When setting the sheetmetal feature manually, the new table works just fine
  • By API instead, I can reliably load the table in an part without issues but cannot set the "bend allowance" menu to "gauge table" instead of "bend table". 
    Interestingly, the supposed bend table is the same as the gauge one and the only I have in my SolidWorks settings (which are common throughout all users, by the way).
    So the software is interpreting the gauge table as a bend table and cannot return the correct values for the K factor. 
    End result: any flattening function o flat pattern do not work and return errors.

 

By the API documentation, the bend allowance type is an integer from 1 to 5 where "2" is just the bend table, not the gauge one. 

If I get the bend allowance with [swCustomBendAllowance.Type] I can see that a properly working part where bend allowance is manually set on "gauge table", has this value on "-1". 

This values is also not documented anywhere on the API guide.

 

Trying to force this value after loading the gauge table doesn't work however: it gets ignored and can be checked to be still at "2".

 

Has anyone had a similar experience?
 

Thanks for your attention.