6 Replies Latest reply on May 5, 2018 11:04 AM by Sanket Pundge

    How to relocate Hole position ?

    Sanket Pundge

      i wrote method for creating hole on top surface of body.

      dblNo_ofHole  = 12 ;

      pcd = 12.5 ;

      dblBodyH = 6 ;

        public bool swHoleCreate(double dblNo_ofHole ,double pcd, double dblBodyH)

              {

                

                      SldWorks swApp = default(SldWorks);

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

                      ModelDoc2 swModel = swApp.ActiveDoc;

                    //  Feature swFeat = default(Feature);

                      FeatureManager swFeatMg = swModel.FeatureManager;

                      swModel.ShowNamedView2("*TOP",(int)swStandardViews_e.swTopView);

                    //  swModel.ShowNamedView2("", (int)swStandardViews_e.swIsometricView);

                      swModel.ViewZoomtofit2();

                      double Angle = (360 / (2 * dblNo_ofHole));

                      double Xco = Math.Cos(Angle * (Math.PI) / 180);

                      double Zco = Math.Sin(Angle * (Math.PI) / 180);

                      swModel.ClearSelection2(true);

                      swModel.Extension.SelectByID2("", "FACE", -(pcd * Xco*0.5*0.0254), (dblBodyH * 0.5*0.0254), -(pcd*Zco*0.5*0.0254), false, 1, null, (int)swSelectOption_e.swSelectOptionDefault);

       

       

                      swFeatMg.HoleWizard4((int)swWzdGeneralHoleTypes_e.swWzdTap, (int)swWzdHoleStandards_e.swStandardAnsiInch, (int)swWzdHoleStandardFastenerTypes_e.swStandardAnsiInchBottomingTappedHole, "3/4-10", (int)swEndConditions_e.swEndCondBlind, 0.01666748, 0.04572, 0.0381, 0, 0, 0, 0, 2.0594885173533091, 1, 0, 0, 0, -1, -1, "", false, true, true, true, true, false);

                      swModel.ClearSelection2(true);

                      swModel.ShowNamedView2("", (int)swStandardViews_e.swIsometricView);

      }

      its work fine but Hole position is not correct .

      Untitled.png

      for that reason i want to relocate this hole point position .

      So any one please Help me .

      if i am wrong so please correct me .

       

      Thanks you .