ILOGIC REBUILD ALL

ILOGIC REBUILD ALL

Anonymous
Not applicable
1,680 Views
3 Replies
Message 1 of 4

ILOGIC REBUILD ALL

Anonymous
Not applicable

I have an iPart and iAssembly table that I am trying to get it to rebuild all.     Need to rebuild as other ilogic changed dimensions that are universal to all the rows in the iPart and iAssembly.

 

I tried the following: 

 

ThisDoc.Document.Rebuild()

 

but that did not work for me unless I applied it in wrong syntax.

0 Likes
1,681 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Maybe you should set Standard paprameters for it to update to before each close, even 0's if you have your model set up for that.  I have an example showing how to reset the parameters then close without saving.  This causes a Windows error but runs clean.  Maybe you can help me with finishing the code out to avoid the "close" error... 

SyntaxEditor Code Snippet

'resets parameters to default values
Parameter("ASSEMBLED COMPONENTS", "LUG_WELD") = 0.25 in
Parameter("ASSEMBLED COMPONENTS", "HEAD_ID") = 60 in
Parameter("ASSEMBLED COMPONENTS", "LUG_HOLE") = 1.25 in
Parameter("ASSEMBLED COMPONENTS", "HEAD_THK") = .25 in
Parameter("ASSEMBLED COMPONENTS", "PAD_WD") = 4 in
Parameter("ASSEMBLED COMPONENTS", "PAD_LG") = 8 in
Parameter("ASSEMBLED COMPONENTS", "PAD_THK") = 0 in
Parameter("ASSEMBLED COMPONENTS", "LUG_OFF") = 1.6250 in
Parameter("ASSEMBLED COMPONENTS", "LUG_LG") = 6 in
Parameter("ASSEMBLED COMPONENTS", "LUG_RAD") = 2 in
Parameter("ASSEMBLED COMPONENTS", "LUG_THK") = 0.5 in
Parameter("ASSEMBLED COMPONENTS", "HEAD_SF") = 1 in
Parameter("ASSEMBLED COMPONENTS", "HEAD_IKR") = 4 in
Parameter("ASSEMBLED COMPONENTS", "HEAD_IDR") = 60 in
Parameter("ASSEMBLED COMPONENTS", "PAD_WELD") = 0.25 in

ThisApplication.ActiveView.Update()
InventorVb.DocumentUpdate()
ThisDoc.Document.Close()

 

0 Likes
Message 3 of 4

Anonymous
Not applicable
I have tried the line:

ThisDoc
.Document.Close() 

This worked great when I just had a single file open, but when multiple files
open -- example, an .ipt file and the associated .idw -- I couldn't get them to both close.

Scenario #1 -- close .ipt file after it rebuilt.
If I closed the .ipt at the end of the code ilogic it had, then the .idw didn't seem to reference it properly as
assuming it was no longer in memory.

Scenario #2 -- close .idw file after it rebuilt.
If I let .ipt file open and rebuild, then let the .idw file rebuild, then tried closing the .idw file.
What happened here is I couldn't figure out how to tell the .ipt file to wait to close itself until after
the .idw file had rebuilt and close itself. In other words I couldn't get the trigger to close the .ipt
file to take place after the .idw file had closed.

Thanks for the input. I wrote my ilogic to default back to initial paremeter settings when necessary,
although most just overwrite themselves on the file open trigger in ilogic which works just fine.

 

0 Likes
Message 4 of 4

Owner2229
Advisor
Advisor

Hi, you can use this code below to close both IDW and IPT files (assuming they have the same name, just diferent extension).

It will ofc throw an error at the end of the code (the same as it did for LTK7802as you're telling the file to close itself and it doesnt like it.

Workaround for this would be using VBA macro or runing the code from another document (you will then have to specify the file you want to close).

 

On Error Resume Next
Dim Docs As Documents
Docs = ThisApplication.Documents
Dim DocName As String
DocName = ThisDoc.PathAndFileName(False)
Dim oDoc As Document
For Each oDoc in Docs
   If oDoc.FullDocumentName = DocName & ".idw" Then
      oDoc.Close()
   End If
Next
For Each oDoc in Docs
   If oDoc.FullDocumentName = DocName & ".ipt" Then
      oDoc.Close()
   End If
Next
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods