1 Reply Latest reply on Aug 10, 2014 4:56 AM by Deepak Gupta

    Part is not rebuilding

    Sanya Shmidt

      Hello guys!

       

      Can someone look at this simple code below an tell me what am I missing. It changes the dimension, but it is not rebuilding the part. (But message says Rebuild process took place.)

       

      I have to manually hit rebuild button to rebuild the part.

       

      Dim swApp As Object

      Dim boolstatus As Boolean

       

      Set swApp = Application.SldWorks

      Set swmodel = swApp.ActiveDoc

       

      swmodel.Parameter("WL@Sketch1").SystemValue = WL * 0.0254

       

      If swmodel.EditRebuild3() Then

              MsgBox "Rebuild successful"

          Else

              MsgBox "This model has rebuild errors"

      End If

       

      Video is here

      https://dl.dropboxusercontent.com/u/23443066/Rebuild.wmv

        • Re: Part is not rebuilding
          Deepak Gupta

          Try:

           

          Sub Main()

          Dim swApp       As SldWorks.SldWorks

          Dim swModel     As SldWorks.ModelDoc2

          Dim bRet        As Boolean

           

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

           

          swModel.Parameter("WL@Sketch1").SystemValue = WL * 0.0254

          bRet = swModel.EditRebuild3

           

          If bRet Then

                  MsgBox "Rebuild successful"

              Else

                  MsgBox "This model has rebuild errors"

          End If

          End Sub