Bommer now allows you to use if-then-else
conditional statements inside your Bommer formulas, to accomplish a whole host of automation tasks within your BOM. Bommer tries to introduce features like this in as seamless a way as possible, but in this case there are some specific considerations for introducing this feature. As a result, we have designed it so that conditional statements are enabled by default on new documents, but to you use conditional statements in existing documents, you must run a command to enable them.
Quick Start
To enable conditional statements:
1. Open the design in Fusion 360
2. In the Design workspace, click on Utilities, and then expand the Bommer drop down
3. Look for a command entitled “Enable conditional statements in formulas”:
4. Click on the line in the menu to run the command. If your design has any linked components, it will ask you if you want to enable conditionals for all referenced documents:
5. After answering Yes or No, you can open any of the Bommer editors (Edit bill of materials, Edit part properties) to add conditional statements into your Bommer formulas
6. This may create errors in your existing formulas if they used any of the new reserved words. Because of this, the command is fully undoable using the Fusion 360 Undo button or keystroke.
7. Read below in the Background and Explanation section for more information.
💡 Note that enabling conditional statements for referenced documents will not create new revision of that document automatically. You must go through the normal Push edits to linked components workflow in order to finish enabling conditional statements for that document.
Background and Explanation
To support conditional statements, we added several “reserved words” (if
, then
, else
, and
, or
, not
) to our formula processor. A reserved word is a word that has special meaning inside a formula; this is how the formula processor knows how to process a statement or expression. Because we never restricted these words before, it was always allowed to create property names that contain these words; it is possible these existing formulas are incompatible (i.e. they would create errors where previously they were correct, or evaluate incorrectly without an error) with the new conditional statements.
As an example, consider the formula = if & then & else
. This formula would correctly compute “ifthenelse” without conditionals enabled, but would be an error with conditionals enabled because it does not follow the required format. Similarly, if one had a property called Make or Buy
and a formula = Make or Buy & " " & please.
, that might evaluate to “Make please” without conditionals enabled, and “true please” with conditionals enabled (if Make and Buy are separately TrueFalse properties).
Because these cases may exist (and may exist inside released CAD files), we created an opt-in workflow to let you decide when you want to upgrade your existing documents.
💡 This only applies to existing files. New files will automatically have conditional statements enabled.
User Alerts
Bommer will display an orange alert at the top of the Edit bill of materials and Edit part properties commands for any parts or lineitems that do not have conditional statements enabled:
Please note that these are not errors. They are notices that conditionals may not work the way you expect them to in this bill of materials, but you do not need to “fix” them if you don’t want to or need to. If you try and type conditional statements
Bommer will also display the Enable conditional statements in formulas command only when it needs to enable conditionals for the top level document or one or more referenced documents. If that command doesn’t appear, you should be good to use conditional statements.
Mixing enabled and not-enabled documents
Bommer tracks the enabled state at the document level, which means that a complex assembly may have referenced documents that are both enabled and not-enabled for conditional editing. In order to maintain the most compatibility, Bommer evaluates each BOM lineitem’s formulas according to that component’s document’s enabled state; having mixed-mode assemblies is not only supported, it is expected to occur, and so we wanted to make sure it worked flawlessly.
In other words, if you do not need to edit a file you are not forced to enable conditional statements (and fix any errors that may arise); your old data works just the same as it did before.
Migrating large documents
If you may have a large complex assembly with many “at risk” formulas, it may be a burden to go thru and fix each one before you can safely enable conditional statements. If you are in this camp, please file a support issue so we can help. We are working on migration tools to take care of this work automatically, which we can enable on a case-by-case basis.
Comments
0 comments
Please sign in to leave a comment.