×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ForceRebuild3 is not returning FALSE if there are rebuild errors.

ForceRebuild3 is not returning FALSE if there are rebuild errors.

ForceRebuild3 is not returning FALSE if there are rebuild errors.

(OP)
So I am trying to cycle through each configuration of an assembly document and check whether there are any rebuild errors. I intentionally added a mate to one configuration that causes errors, but the ForceRebuild3 method does not appear to catch it. My code is attached below. Any suggestions?

CODE

Sub main(myStr As String)
    
    Dim SW_APP          As SldWorks.SldWorks
    Dim SW_DOC          As SldWorks.ModelDoc2
    Dim boolstatus      As Boolean
    
    Debug.Print "**** START ****"
    Debug.Print myStr
    
    Set SW_APP = CreateObject("SldWorks.Application")
    Set SW_DOC = SW_APP.ActiveDoc
    
    SW_DOC.ShowConfiguration2 myStr
    boolstatus = SW_DOC.ForceRebuild3(True)
    
    Debug.Print "Succesful Rebuild?: " & boolstatus
    
    Set SW_DOC = Nothing
    Set SW_APP = Nothing
    
    Debug.Print "***** END *****"
    
End Sub

SW2009 x64 SP4.1, Vista Business x64, Intel Core i7 920 @4.2GHz, Quadro FX580, 2x 147GB 15K-rpm SAS HDs (RAID 0), 6GB DDR3 1600MHz RAM

RE: ForceRebuild3 is not returning FALSE if there are rebuild errors.

(OP)
Wow, haven't updated my signature in a while... it should read: "SW2011 x64 SP3.0, Windows 7 x64"

SW2011 x64 SP3.0, Windows 7 x64

RE: ForceRebuild3 is not returning FALSE if there are rebuild errors.

CODE

...
value = instance.ForceRebuild3(TopOnly)
...

Quote:

Parameters

TopOnly
True rebuilds the top-level assembly only; false rebuilds the top-level assembly and all subassemblies

Return Value

True if the rebuild is successful, false if not

Are you expecting the sub-assemblies to be rebuilding too? You have passed "True" in to the Parameters for ForceRebuild3.

Devon Murray, EIT [Mechanical]
Solidworks 2011 SP 2.0

RE: ForceRebuild3 is not returning FALSE if there are rebuild errors.

(OP)
No, I actually have "False" in there now. I was trying both cases. Not necessary to rebuild that deep.

ForceRebuild3 appears to be returning "True" (-1) no matter what... I have tried declaring boolstatus as Variant type, passing it to a variable of type Long, then checking the numeric value and it still returns "-1" when there are rebuild errors in the document.

SW2011 x64 SP3.0, Windows 7 x64

RE: ForceRebuild3 is not returning FALSE if there are rebuild errors.

(OP)
Sorry, let me clarify. I have mates in the top-level assembly that are conflicting, causing rebuild errors. Does SolidWorks' definition of the successful rebuild of an assembly document exclude the Mates Folder?

SW2011 x64 SP3.0, Windows 7 x64

RE: ForceRebuild3 is not returning FALSE if there are rebuild errors.

(OP)
Well, after contacting someone at SolidWorks, it turns out that IModelDoc2::ForceRebuild3 does in fact IGNORE the mates folder. A workaround in my case was to use IModelDocExtension::GetWhatsWrongCount. If this value = 0 (after a rebuild, of course) then the rebuild is completely successful.

SW2011 x64 SP3.0, Windows 7 x64

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources