9 Replies Latest reply on May 23, 2014 2:40 AM by Mati Link

    Round off option in dimensioning

    Suresh Kumar Radhakrishnan

      round off dimensioning.pnground off dimensioning_1.png



      Is round off option available for dimensioning in solid works detailing. It is available in Autocad. In solid works, we able to find only precision setting option. If we set none, dimension comes without digit. If i want it in mulitples of 10 or 100, i need to manually override the dimension. During that, there may be a chance for mistakenly enter the wrong value. Kindly give an idea if it is possible to round off.



        • Re: Round off option in dimensioning
          Matthew Lorono



          Short answer is that SolidWorks currently uses common rounding, and is controlled by your decimal places.  Rounding off to a particular multiple is an interesting idea.  Do you have case where the decimal place setting does not provide you with the result you desire?

            • Re: Round off option in dimensioning
              Suresh Kumar Radhakrishnan

              Hi Matthew,

              i have no problem with the decimal place and precision setting. it is fine for me. I am working in plant layout and we are using solid works for the design purpose. So, when we place the equipments in metres distance, we are not giving importance for 5 or 6 mm difference. For example, if the distance between the two equipments is 3996mm, normally we will show it 4000mm. In Auto cad, if we select round of 10mm, automatically 4000mm will come. Like the same option, i am expecting in solidworks.



            • Re: Round off option in dimensioning
              Steven Smith

              Why would you want to round off the dimension in incriments of 10 and 100 so severely?

              Surely that defetes the purpose of using CAD.

              • Re: Round off option in dimensioning
                Mati Link

                I also came about this need and compiled a simple macro to do that. It overrides with rounded value. When you run next time it removes override.

                I can be made more sexy for persisten dialog box with setting so go ahead and make modifications and share here. I also used examples found if forum.



                'prerequisite: choose dimension(s) on drawing


                'rounds to closest 1000




                Dim swApp As SldWorks.SldWorks

                Dim swDoc As SldWorks.ModelDoc2

                Dim swSelMgr As SldWorks.SelectionMgr

                Dim swDisplayDim As SldWorks.DisplayDimension

                Dim i As Long

                Dim retval As Double

                Dim DocUnits As Long



                Const AllSelections = -1



                Sub main()



                Set swApp = Application.SldWorks

                Set swDoc = swApp.ActiveDoc

                Set swModel = swApp.ActiveDoc

                Set swSelMgr = swDoc.SelectionManager



                For i = 1 To swSelMgr.GetSelectedObjectCount2(-1)



                    If swSelMgr.GetSelectedObjectType3(i, -1) = swSelDIMENSIONS Then


                        Set swDisplayDim = swSelMgr.GetSelectedObject6(i, -1)


                        retval = swDisplayDim.GetDimension2(0).GetValue3(swInConfigurationOpts_e.swThisConfiguration, "")(0)


                        retval = Round((retval + 0.000001) / 1000) * 1000   'https://stackoverflow.com/questions/326476/how-to-round-a-number-in-vba-to-the-nearest-5-or-10-or-x

                                                                            'round to closest 1000

                        retval = retval / 1000 'm to mm


                        If swDisplayDim.GetOverride = False Then    'checking if already overriden


                            swDisplayDim.SetOverride True, retval   'setting override value



                            Else: swDisplayDim.SetOverride False, retval    'User wants to revert override


                        End If






                        MsgBox "Selected object must be a dimension."


                    End If



                Next i






                End Sub