AnsweredAssumed Answered

I wish to create a macro to replace a value with a formula and vice versa

Question asked by Mitch Parlette on Jan 19, 2019
Latest reply on Jan 19, 2019 by Mitch Parlette

Hi All,

I wish to create a macro to replace a value with a formula and vice versa in the sheetmetal feature-- Bend Radius. I have a macro that will change the K-Factor because we are using a specific value, namely 0.33. We have found that BendRadius=Thickness +0.015" works precisely for our new press brake tooling.


The problem is we have a lot of part files with either a Bend Radius equal to Material Thickness value, which I can deal with with the macro we are using now, or we have parts with the a formula in place of a Bend Radius value. The macro will not change the formula, and I have spent many sleepless nights trying to fix this issue.


My skill with VBA are minimal at best, and I need a push in the right direction to solve this issue.


Also, I have to pre-select the SheetMetal feature to get the macro to work. Is there a way to have the macro select the SheetMetal feature on its own? That would help speed up the conversion process.


So, I am looking for help to create or adapt a macro to be able to select the SheetMetal feature, change the formula in the SheetMetal feature BendRadius from whatever it is to either BendRadius =Thickness+.015" or to delete the formula (or replace it) with a value and the current macro will change that value to what we need, namely Thickness +0.015"


I know that sounds like a lot to ask; I sorely need the help.


I've attached the macro we are using. Whoever wrote it, we are indebted to you.


Any thoughts on this will be most appreciated.