1 Reply Latest reply on Apr 23, 2014 7:22 PM by Artem Taturevych

    Way to modify the raidus on a flex feature

    OSWALDO MEZA

      Can someone please help me with this issue...

       

      Radius-Angle.png

        • Re: Way to modify the raidus on a flex feature
          Artem Taturevych

          Please check this macro:

           

          Const PI As Double = 3.14

           

          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swSelMgr As SldWorks.SelectionMgr

           

          Sub main()

           

              Set swApp = Application.SldWorks

             

              Set swModel = swApp.ActiveDoc

             

              Set swSelMgr = swModel.SelectionManager

             

              Dim swFeat As SldWorks.Feature

             

              Set swFeat = swSelMgr.GetSealectedObject6(1, -1)

              Dim curRad As Double

              curRad = GetRadius(swFeat)

              MsgBox "Current Radius: " & curRad * 180 / PI

              SetRadius swFeat, curRad * 2

             

          End Sub

           

          Function GetRadius(swFlexFeat As SldWorks.Feature) As Double

             

              Dim swDispDim As SldWorks.DisplayDimension

              Set swDispDim = GetRadiusDimension(swFlexFeat)

              GetRadius = swDispDim.GetDimension2(0).GetSystemValue3(swSetValueInConfiguration_e.swSetValue_InThisConfiguration, "")(0)

             

          End Function

           

          Sub SetRadius(swFlexFeat As SldWorks.Feature, radius As Double)

             

              Dim swDispDim As SldWorks.DisplayDimension

              Set swDispDim = GetRadiusDimension(swFlexFeat)

              swDispDim.GetDimension2(0).SetSystemValue3 radius, swSetValueInConfiguration_e.swSetValue_InThisConfiguration, ""

              swModel.EditRebuild3

             

          End Sub

           

          Function GetRadiusDimension(swFlexFeat As SldWorks.Feature) As SldWorks.DisplayDimension

             

              Dim swDispDim As SldWorks.DisplayDimension

              Set swDispDim = swFlexFeat.GetFirstDisplayDimension

             

              Set GetRadiusDimension = swDispDim

             

          End Function

          ______________________________________________

          Regards, Artem Taturevych | Snr. Developer | IC3D ANZ

           

          IC3DSteel – New Steel Solution for SolidWorks

          translationXpert – SolidWorks files language translator

          LinkedIn - SolidWorks API Group