6 Replies Latest reply on Feb 12, 2019 8:27 AM by Josh Brady

    How do I control the units an equation evaluates to in a Global Variable?

    Chase Nichole
      1. I am using a weldment part to generate multiple strips of EVA foam for use as padding in a higher level assembly. The strips do not require individual part files, and are cut from a large stock of sheet. I need to create a variable that can be used in the BOM of the assembly drawing to show how much of the material is required each time one of these assemblies is built. The variable should have the same UOM our supply department has assigned to the sheet--in this case it is sq-in. I can get the number I need simply by dividing the volume (i.e. SW-Volume) of the part(s) by the thickness of the sheet stock (i.e. the respective dimension for thickness shown in the custom weldment profile of the strip's cross section). I created the equation, but the units are inches instead of sq-in, and I cannot find a way to change it. Solidworks does not seem to understand that multiplying two of the same units together raises the exponent. Is there a way to control this?

       

       

        • Re: How do I control the units an equation evaluates to in a Global Variable?
          Frederick Law

          Try Add: * 1 in to your equation.

          Noop, it doesn't work.  Every evaluate to 'in'.

          • Re: How do I control the units an equation evaluates to in a Global Variable?
            Josh Brady

            Global variables don't "understand" exponential units at all (area/volume).  You can see this by just picking volume for the value.  No units are shown.  Therefore, you will never be able to get the units to display as square inches.  You can get it to display without any units by first linking a custom property to your dimension value, then dividing volume by that custom property.  Linking dim to custom property strips off the unit "intelligence", so you'll just get a number.

             

              • Re: How do I control the units an equation evaluates to in a Global Variable?
                Matt Peneguy

                Josh Brady wrote:

                 

                Global variables don't "understand" exponential units at all (area/volume). You can see this by just picking volume for the value. No units are shown. Therefore, you will never be able to get the units to display as square inches. You can get it to display without any units by first linking a custom property to your dimension value, then dividing volume by that custom property. Linking dim to custom property strips off the unit "intelligence", so you'll just get a number.

                 

                Wow, pretty short sighted don't ya think?  This would have been a good Top Ten List idea!

                  • Re: How do I control the units an equation evaluates to in a Global Variable?
                    Josh Brady

                    What do you mean short sighted?  Problem was stated after the Top Ten voting was closed.

                    This solution works today without waiting for someone to fix something.

                    Rob's "Equations - make them better" idea incorporates a load of aspects that (if they were implemented) would fix this.

                     

                    I should probably also note... the value used in the Global Variable calculation will be the rounded, text value shown in Custom Properties. For example, above my thickness is displayed in the custom property as 9.53.  It's actually a 3/8" thick plate, or 9.525mm.  In order for the calculated area to be correct, I had to go back and change the precision of the sketch dimension display to X.XXX so that the custom property value would be 9.525.

                      • Re: How do I control the units an equation evaluates to in a Global Variable?
                        Matt Peneguy

                        Josh Brady wrote:

                         

                        What do you mean short sighted? Problem was stated after the Top Ten voting was closed.

                        This solution works today without waiting for someone to fix something.

                        Rob's "Equations - make them better" idea incorporates a load of aspects that (if they were implemented) would fix this.

                         

                        I should probably also note... the value used in the Global Variable calculation will be the rounded, text value shown in Custom Properties. For example, above my thickness is displayed in the custom property as 9.53. It's actually a 3/8" thick plate, or 9.525mm. In order for the calculated area to be correct, I had to go back and change the precision of the sketch dimension display to X.XXX so that the custom property value would be 9.525.

                        I meant on SW's part.  If you are going to allow values from things like Custom Properties, then the software should understand the units.