Author Topic: Progress Bar/Meter  (Read 4104 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
Progress Bar/Meter
« on: December 03, 2006, 11:23:14 PM »
I wanted one so here it is...some may find this useful also:

Code: [Select]
namespace ClassLibrary
{
public class tcgsClass
{

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
   EntryPoint = "?acedSetStatusBarProgressMeter@@YAHPBDHH@Z")]
private static extern int acedSetStatusBarProgressMeter(string label, int minPos, int maxPos);

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
  EntryPoint = "?acedSetStatusBarProgressMeterPos@@YAHH@Z")]
private static extern int acedSetStatusBarProgressMeterPos(int pos);

[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "?acedRestoreStatusBar@@YAXXZ")]
private static extern int acedRestoreStatusBar();

public tcgsClass( ) { }

// Our one and only command
[CommandMethod("PBAR")]
static public void PBARCommand( )
{
acedSetStatusBarProgressMeter("Testing:", 0, 1000000);

for (int i = 0; i < 1000000; i++)
acedSetStatusBarProgressMeterPos(i);

acedRestoreStatusBar();
}

}
}

Cheers,
Glenn.

LE

  • Guest
Re: Progress Bar/Meter
« Reply #1 on: December 04, 2006, 10:56:25 AM »
Hi Glenn;

What is your AutoCAD version? (just curios because of the P/invoke stuff usage)

I have A2007 and this is what I did, it might help, too.

Code: [Select]
using AcRx = Autodesk.AutoCAD.Runtime;

[CommandMethod("PBAR")]
static public void progressbar()
{
    ProgressMeter pro = new ProgressMeter();
    pro.Start("Testing...");
    for (int i = 0; i < 1000000; i++)
        pro.MeterProgress();
    pro.Stop();
}

Have fun.
« Last Edit: December 04, 2006, 10:58:04 AM by LE »

Glenn R

  • Guest
Re: Progress Bar/Meter
« Reply #2 on: December 04, 2006, 06:08:47 PM »
Heh...you're right Luis. I just checked the docs for 7 and it does indeed have a ProgressMeter.
This is for 2006, which unfortunately does not have a progress meter.

Thanks for letting me know about the one in 2007.

Cheers,
Glenn.
« Last Edit: December 04, 2006, 06:10:56 PM by Glenn R »

LE

  • Guest
Re: Progress Bar/Meter
« Reply #3 on: December 04, 2006, 06:53:20 PM »
Heh...you're right Luis. I just checked the docs for 7 and it does indeed have a ProgressMeter.
This is for 2006, which unfortunately does not have a progress meter.

Thanks for letting me know about the one in 2007.

Cheers,
Glenn.

I see... glad I wait for A2007 - then... :)