forcibly rebuild

I need to acquire knowledge for the Rebuild

E.G.

'Forcibly Rebuild All Configurations Example (VB)

'This example shows how to forcibly rebuild all of the configurations in a SolidWorks document.

'--------------------------------------

Option Explicit

Sub main()

    Dim swApp                   As SldWorks.SldWorks

    Dim swModel                 As SldWorks.ModelDoc2

    Dim vConfNameArr            As Variant

    Dim sConfigName             As String

    Dim nStart                  As Single

    Dim i                       As Long

    Dim bShowConfig             As Boolean

    Dim bRebuild                As Boolean

    Dim bRet                    As Boolean

   

    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

   

    Debug.Print "File = " + swModel.GetPathName

   

    vConfNameArr = swModel.GetConfigurationNames

    For i = 0 To UBound(vConfNameArr)

        sConfigName = vConfNameArr(i)

       

        bShowConfig = swModel.ShowConfiguration2(sConfigName)

       

        nStart = Timer

        bRebuild = swModel.ForceRebuild3(False)

       

        Debug.Print "  Config       = " & sConfigName

        Debug.Print "    ShowConfig = " & bShowConfig

        Debug.Print "    Rebuild    = " & bRebuild

        Debug.Print "    Time       = " & Timer - nStart & " s"

    Next i

End Sub

'--------------------------------------

Result

File = F:\\BE(J)S\\HG20592Pn10\\法兰 WN10-1.0 RF.SldPrt

  Config       = 默认

    ShowConfig = False

    Rebuild    = True

    Time       = 4.425781 s

SolidworksApi macros
Answers 1
FV
FV 2012-02-20 Best Answer

Yong, what are you asking? The best place to aquire knowledge is to read the API Help documentation....

The ModelDoc2 Interface has 3 main Rebuild Methods

ForceRebuild3 Method (IModelDoc2)

Forces a rebuild of all of the features in the model whether they need a rebuild.

EditRebuild3 Method (IModelDoc2)

Rebuilds only those features in the model that need to be rebuilt.

Rebuild Method (IModelDoc2)

Rebuilds the model, in assembly and drawing documents only, with some additional controls.

Hope this helps,

Filipe