Super Ctrl-Q
Super Ctrl-Q
(OP)
CODE
Sub main()
Application.SldWorks.ActiveDoc.ForceRebuild3 (False)
End Sub
Application.SldWorks.ActiveDoc.ForceRebuild3 (False)
End Sub
I think this is the smallest macro I've ever written. Depending on the assembly, it can also take very long to run. Its function is that it does a Ctrl-Q type forced rebuild on the active document and all referenced documents, either subassemblies or parts. Ctrl-Q only force-rebuilds the top level current document. This code doesn't rebuild the parent of a derived/mirrored part, though, unless of course the parent is also in the assembly. Anyway, might come in handy sometime.






RE: Super Ctrl-Q
RE: Super Ctrl-Q
Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer
Searching Eng-Tips forums
RE: Super Ctrl-Q
RE: Super Ctrl-Q
CODE
Public Enum swUserPreferenceIntegerValue_e
swAutoSaveInterval = 3
End Enum
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim nStart As Single
Dim i As Long
Dim bRet As Boolean
Dim propRet As Boolean
Dim runTime As String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
' Turn off automatic save
bRet = swApp.SetUserPreferenceIntegerValue(swAutoSaveInterval, 0)
nStart = Timer
bRet = swModel.ForceRebuild3(False)
runTime = Timer - nStart & " seconds"
propRet = swModel.AddCustomInfo3("", "LastRebuildTime", swCustomInfoText, runTime)
End Sub
Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer
Searching Eng-Tips forums
RE: Super Ctrl-Q
It's different from Verification On Rebuild. I'm not really sure what exactly VOR does, though. The way I tested to see what this macro actually rebuilds was to put this equation in various parts:
"Test" = MsgBox("Rebuilt " & Part.GetPathName)
If you put this equation into a part, then Ctrl-Q the assembly containing that part (whether or not VOR is on), you will get no message box. However, using ForceRebuild3(False) on that same assembly will give you the message box.
FYI, using this macro will also increase the time required to save an assembly, since the forced rebuild of all the referenced docs marks them as dirty even if you didn't actually change them.
RE: Super Ctrl-Q
Chris
SolidWorks 08 0.0/PDMWorks 08
AutoCAD 06
ctopher's home (updated 10-07-07)
ctopher's blog
RE: Super Ctrl-Q
Thanks for the macros. Very handy.
Happy Thanksgiving,
Anna Wood
SW 2007 SP4.0, WinXP
Dell Precision 380, Pentium D940, 4 Gigs RAM, FX3450
http://designsmarter.typepad.com/solidmuse
http://www.phxswug.com
RE: Super Ctrl-Q
Regards,
Scott Baugh, CSWP![[pc2] pc2](https://www.tipmaster.com/images/pc2.gif)
FAQ731-376: Eng-Tips.com Forum Policieswww.scottjbaugh.com