Addin Progress Bar not updating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
I'm still on the long journey trying to convert a simple Inventor macro to an Inventor Addin. Its been a painful learning experience and my code is now much, much longer than was in the original ivb. I'm beginning to wish I'd never started but I'm determined to get it working properly.
My latest problem is that my forms progress bar ("MyProgBar" does not update until all the work is completed. In my macro I used a shaded label, just changing the width to represent the progress, however I've been tempted to use the vb.net progress bar for my Addin but it does work as expected as it doesnt update until the Addin has finished running.
It's not stopping my Addin from working, but just a bit annoying...
So, here is my code:
For Each oOcc In oLeafOccs Dim oCompDef As ComponentDefinition Dim oDocument As Document oCompDef = oOcc.Definition oDocument = oCompDef.Document ' check the type of the document If oDocument.DocumentType = DocumentTypeEnum.kPartDocumentObject Then oPartDoc = oDocument 'set the part oSheet = oBook.Worksheets.Add() 'add a new sheet for this part oSheet.Name = oPartDoc.DisplayName 'rename the sheet to the Inventor part name If o3DSP = True Then Export3DSketchPoints(oPartDoc) 'extract the 3DSketch Points and write to the SHEET If o3DWP = True Then Export3DWorkPoints(oPartDoc) 'extract the 3DSketch Points and write to the SHEET End If MyProgBar.Value = MyProgBar.Value + 1 MyProgBar.Refresh() System.Windows.Forms.Application.DoEvents() Next oOcc
When the Addin runs the progress bar does not update until AFTER everything has completed. DoEvents() would be my usual .net rescue in such situations, but here it seems to have no effect. Neither does .Refresh().
Any suggestions?
TIA