4 Replies Latest reply on Dec 28, 2017 6:54 PM by Rob Edwards

    Rounding Dimension

    Mahmood M.

      How i can round a dimension on the custom unit in drafting? for example I have a dimension "460.12". I want round it on 50 unit precision that show me "450".

        • Re: Rounding Dimension
          Kevin Chandler

          Hello,

           

          I don't know why you would want to do this, but it wo0uld be better to restrict the part itself to the multiples of 50 and not modify the drawing.

          You can use equations in the part file to drive this.

          In Manage Equations, create Global variables:

               MultipleFactor = 50

               MultipleCount = INT(PartDimension / MultipleFactor)

               MultipleRemainder = PartDimension - (MultipleCount * MultipleFactor)

               MultipleRemainderAdder = if(((MultipleRemainder) > (MultipleFactor/2)), 1, 0)

               MultipleDim = (MultipleCount + MultipleRemainderAdder) * MultipleFactor

           

          This sets the variable "MultipleDim" to the closet multiple, (optionally) rounding up.

          So a PartDimension of "460.12" would make "MultipleDim" = 450

               MultipleCount = INT(460.12 / 50) = 9

               MultipleRemainder = 460.12 - (9 * 50) = 10.12

               MultipleRemainderAdder = if(((10.12) > (50/2)), 1, 0) = 0

               MultipleDim = (9 + 0) * 50 = 450

           

          A PartDimension of "475.12" would make "MultipleDim" = 500

           

          In Manage Equations, use "MultipleDim" to equate the part dimension that drives the feature.

           

          SW Drawings don't have equations and it's best that the drawing truly reflect the part.

           

          Cheers,

           

          Kevin

           

          EDIT: If you wish to just override the dimension's value, select the dimension and in the Proprty Manager, delete "<DIM>" and type in the value you want.

          You may get a warning message, but you can continue modifying the dimension value.

          Also, on the value tab, you can check to override the value.

           

          EDIT 2: A caution on overriding a dimension (for any reason):

          With <DIM> removed form the dimension, the drawing dimension is effectively severed from the model and regardless of all model changes, the dimension will not change.

          Additionally, there's no apprearance difference between a dimension that has its <DIM> and one that doesn't.

          So, not only must you remember every such dimension and maintain them, you must inform everyone else that these dimensions will not update to their models.

          • Re: Rounding Dimension
            Kevin Chandler

            Hello again,

             

            I'm not in front of SolidWorks to test this, but another approach may be to use the fraction option for the dimension.

            1. On the dimension's Property Manager, Value tab (I think, it's one of the tabs), change Decimal to Fractions
            2. On the same tab, for the fraction unit value, enter 0.02
              1. The value entered is the recipricol of the desired fraction, so for 1/16, you'd enter 16
                For 50, you enter 0.02 (aka 1/50)

             

            Caveats:

            1. Solidworks permits fractions for units other than inches (or feet/inches)
            2. Solidworks permits fraction unit values less than one into the input box.
              1. This feature is designed for fractions and the recipricol of any number less than one isn't a fraction
            3. Solidworks uses the entire dimension value to compute the fractional value and not just the remainder after the decimal point
              1. I don't know the code, but using the entire dimension value is a simple algorithm to get the fractional value for displaying:
                Fractional Value = (INT(Decimal Value * Fraction Unit)) / Fraction Unit
            4. I believe SolidWorks fraction display only rounds down
              1. With your large 50 rounding (and only rounding down), percent error from actual can be large (~10% for 499.99 as 450) and the error grows rapidly for smaller actual values
              2. For actual values under 50, zero is returned and your part and drawing aren't proper.

             

            You can also set the fraction precision for the whole document in Document options>Units.

            But as for the individual dimension, this approach may not work for your purpose as the caveats above still apply.

             

            Cheers,

             

            Kevin

            • Re: Rounding Dimension
              Andrej O'Blak

              Curently you can ot round the dimension. I'm having the same problem. That is why I created the idea for the Top Ten List Dimension round off in drawing for individual dimension based on specified increments (such as to the nearest 5 or 10)

              Please vote, maybe it will be implemented.

              • Re: Rounding Dimension
                Rob Edwards

                Hi Mahmood, here's a dirty little trick that might work for you.  You will have to insert the dim into the drawing as a model item, or to the sketch point.

                video attached

                 

                edit: another option I might consider is use a tabulated dimension in a BOM - you have options for precision there.

                In the bom list, how to set the decimal digits