1 Reply Latest reply on Nov 28, 2017 2:37 AM by Manikandan Babu

    How to set Dual Dimension for manually drawn dimensions in drawing using solid works API c#

    Girish Kumar

      Hi,

      I have following scenario,the below shown Sketch dimension to set as Dual dimension using the code

      boolstatus = partDoc.Extension.SetUserPreferenceToggle((int)swUserPreferenceToggle_e.swDetailingDualDimensions, (int)swUserPreferenceOption_e.swDetailingDimension, true);

      The above code works for Drawing view, but the below scenario is a sketch.

      I want to set all the manually drawn dimensions in drawing file to be also set to dual dimension using SolidWorks API c#

       

      Thanks,

      Girish

       

        • Re: How to set Dual Dimension for manually drawn dimensions in drawing using solid works API c#
          Manikandan Babu

          Hi Girish

           

          Select the dimension and debug it.

           

          static void Main(string[] args)

                  {

                      SldWorks SwApp = (SldWorks)System.Runtime.InteropServices.Marshal.GetActiveObject("sldworks.Application");

                      ModelDoc2 SwModel = (ModelDoc2)SwApp.ActiveDoc;

                      DrawingDoc SwDraw = (DrawingDoc)SwModel;

                      //Select the dimension manually

                      SelectionMgr swSelMgr = (SelectionMgr)SwModel.SelectionManager;

                      DisplayDimension swDispDim = (DisplayDimension)swSelMgr.GetSelectedObject6(1, 0);

                      int longstatus = swDispDim.SetUnits2(false, (int)swLengthUnit_e.swMM, (int)swFractionDisplay_e.swDECIMAL, 0, false, (int)swUnitsDecimalRounding_e.swUnitsDecimalRounding_Truncate);

                      swDispDim.SetDual2(false, true);

                      SwModel.ForceRebuild3(true);

                  }

           

          Thanks

          Manikandan