Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Question

Status
Not open for further replies.

aamoroso

Mechanical
Joined
Mar 5, 2003
Messages
432
Location
US
I am using the following macro to rebuild all configs of a model and return me any false values in a desktop file. I thought this would give me any configurations with rebuild errors, but apparently that is not the case. I have found on several instances that I have features with errors but have been retruned a true value for the rebuild. Does anyone have any ideas:

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

Open "C:\Documents and Settings\user\Desktop\Config RB.txt"

For Output As #1 ' Open file for output.
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"

'This example uses the Print # statement to write data to a file.

If bRebuild = False Then Print #1, sConfigName; bRebuild, 'Else Print #1, " Rebuild Successful = " & bRebuild


Next i
Close #1 ' Close file.
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top