Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I began to use the progress bar for a few rules and it seems to work OK on one hand, but then there seem to be other issues. For example, in this case I have a "lighting" update symbol on the assembly in the model tree, that I can't get rid of except for "Rebuild All". I have other bigger issues in the Drawing environment and I can give more info on that if needed.
I get the same issues with 2023 and 2024. Would be very grateful if someone would take a look at the code below and see if there is something clearly wrong.
Thank you!
Public Sub Main() Dim result = MessageBox.Show("You're running multiple rules which affect ALL parts in Assembly " & vbCr & fileName & vbCr & "Do you want to continue?", "Run GS and Other Rules", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) If result = vbOK Then RunExternalRules Else Return End If Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument oDoc.Update oDoc.Save End Sub Sub RunExternalRules Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim iDoc As Document 'Define iLogic folder location Dim location As String = "M:\Autodesk Inventor\Ilogic\" Dim OtherLocation As String = location & "Other\"
'Set counter for counting parts Dim iPartCount As Integer iPartCount = 0 'Start a transaction for progress bar Call ThisApplication.TransactionManager.StartTransaction(ThisDoc.Document, "Editing All Parts...") 'Progress bar oMessage = "Editing All Parts And Saving, Please Wait..." PartCount = oDoc.AllReferencedDocuments.Count Dim oProgressBar As Inventor.ProgressBar oProgressBar = ThisApplication.CreateProgressBar(False, PartCount, oMessage) 'Iterate through all of the occurrences in the assembly For Each iDoc In oDoc.AllReferencedDocuments iPartCount = iPartCount + 1 Dim fileName As String = IO.Path.GetFileNameWithoutExtension(iDoc.FullFileName) 'Update the progress bar oProgressBar.Message = ("Working on part " & iPartCount & " of " & PartCount & " | " & fileName) oProgressBar.UpdateProgress 'Sheet Metal Type and Part Type If iDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Or iDoc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Then auto = iLogicVb.Automation auto.RunExternalRule(iDoc, location & "GS") auto.RunExternalRule(iDoc, OtherLocation & "Delete User Parameter or iProperty") End If
Next oprogressbar.Close End Sub
Solved! Go to Solution.