I find that I have to open and rebuild each configurationafter a part modification.
I get the "It has not been rebuilt successfully since the lastfeature change or an external referenced model has changed. Rebuildnow?" message.
Does anyone have a macro or technique that will help avoid theforce rebuild?SolidworksParts And Features







I get the "It has not been rebuilt successfully since the lastfeature change or an external referenced model has changed. Rebuildnow?" message.
Does anyone have a macro or technique that will help avoid theforce rebuild?SolidworksParts And Features

'******************************************************************************
' Macro to activate ans rebuild all part configurations by John H11/21/06
' SW 2006 X64 SP5.0
' MS Windows XP64 Professional
'
' Conditions (1) Solidworks is open and running
' (2) change path and filename below to point to yout part file
' (3) no error handling, provided as is
'******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swConfig As SldWorks.Configuration
Dim swModel As SldWorks.ModelDoc2
Dim vConfigName As Variant
Dim sConfigName As String
Dim sFileName As String
Dim sFilePath As String
Dim sFilePathName As String
Dim i As Long
Sub main()
Set swApp = Application.SldWorks
'change filename and path as required
sFileName = "part1.SLDPRT"
sFilePath = "C:\yourpath\"
sFilePathName = sFilePath + sFileName
Set Part = swApp.OpenDoc6(sFilePathName, 1, 0, "", longstatus,longwarnings)
Set Part = swApp.ActivateDoc2(sFileName, False, longstatus)
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
swApp.ActiveDoc.ActiveView.FrameState = 1
boolstatus = Part.Extension.SelectByID2(sFileName, "COMPONENT", 0,0, 0, False, 0, Nothing, 0)
boolstatus = Part.EditRebuild3
Part.ClearSelection2 True
'Part.ForceRebuild
Set swModel = swApp.ActiveDoc
vConfigName = swModel.GetConfigurationNames
For i = 0 To UBound(vConfigName)
sConfigName = vConfigName(i)
Set swConfig = swModel.GetConfigurationByName(sConfigName)
boolstatus = Part.Extension.SelectByID2(sConfigName,"CONFIGURATIONS", 0, 0, 0, False, 0, Nothing, 0)
Part.ShowConfiguration sConfigName
boolstatus = Part.EditRebuild3
swModel.ShowNamedView2 "*Isometric", -1
swModel.ViewZoomtofit2
Next i
Part.Save2 False
Set Part = Nothing
swApp.CloseDoc swModel.GetTitle
End Sub