3 Replies Latest reply on Aug 21, 2017 8:27 AM by Alex Burnett

    Changing Primary precision - Unit Precision from API doesn't change dimensions

    Swme Eng

      I am automating the change of primary and secondary unit precision for the large volume of imported non-native SW files I deal with, but I am finding that my changes to primary and secondary unit precision change the settings, but have no effect on the dimensions I have created within an assembly file  (annotations in 3D space).

       

      I tried forcerebuild3 and still no changes, only think that makes it work is to go back into settings and change the settings to something else and then click ok.

       

      Has anyone else seen this behavior and found a way to fix it?

        • Re: Changing Primary precision - Unit Precision from API doesn't change dimensions
          Alex Burnett

          I was able to get this to work with the following code for my c# program. This works without the need for me to do a rebuild.

           

          If you aren't using these methods, how are you going about changing your decimal precision?

           

          // Change drawing units to "Custom"
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitSystem, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swUnitSystem_e.swUnitSystem_Custom);
          
          // Change linear units to MM
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinear, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swLengthUnit_e.swMM);
          
          // Set linear unit display as Decimal
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalDisplay, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swFractionDisplay_e.swDECIMAL);
          
          // Set linear unit decimal places to value passed in
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsLinearDecimalPlaces, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, primaryDecPlcs);
          
          // Set dual linear units to inches
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsDualLinear, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swLengthUnit_e.swINCHES);
          
          // Set dual linear unit display to decimal
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsDualLinearDecimalDisplay, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, (int)swFractionDisplay_e.swDECIMAL);
          
          // Set dual linear unit decimal places to value passed in
          model.Extension.SetUserPreferenceInteger((int)swUserPreferenceIntegerValue_e.swUnitsDualLinearDecimalPlaces, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, secondaryDecPlcs);