line with spindle load percentage

If you created a new screenset and want to share it with others then please post it here. You can talk about screens here.

line with spindle load percentage

Postby fixebr » Mon Jan 17, 2022 12:38 pm

Greetings!
I connected my VFD via modbus, and get the spindle consumption in amps from it. This value is now simply displayed as a number on the screen.
How can you make the load output as a line with a percentage of maximum as on HAAS machines (for example, here - https://www.haascnc.com/content/dam/haa ... 20Mode.gif on the bottom left corner)
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

Re: line with spindle load percentage

Postby Battwell » Wed Feb 02, 2022 9:10 pm

divide reading by max amps then multiply by 100

eg max amps 20. reading from vfd 10

10/20= 0.5
*100 = 50%
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 870
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: line with spindle load percentage

Postby fixebr » Thu Feb 03, 2022 12:26 am

Battwell wrote:divide reading by max amps then multiply by 100

eg max amps 20. reading from vfd 10

10/20= 0.5
*100 = 50%


The persent I have long displaced on my screenset, it just does not constitute any problems. And how to make a pointer on the line? Look at the picture on the link in the first post of the topic.
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

Re: line with spindle load percentage

Postby Battwell » Thu Feb 03, 2022 5:52 pm

i dont make fancy graphics. :-)
instantaneous load and maximum load is all i display.
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 870
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: line with spindle load percentage

Postby Luc » Sun Apr 10, 2022 7:56 pm

Did you get anywhere with this? Oddly something ive been looking into but completely new to UCCNC. Seems like a really useful feature
Luc
 
Posts: 2
Joined: Sun Apr 10, 2022 7:53 pm

Re: line with spindle load percentage

Postby Authority924 » Wed Apr 27, 2022 3:33 pm

Sounds interesting for me! Do you have some update?
Authority924
 
Posts: 7
Joined: Tue Apr 26, 2022 12:59 pm

Re: line with spindle load percentage

Postby Otatiaro » Wed Jul 03, 2024 7:13 pm

Hello,

I'm also in the same case ... I get the spindle power in watt and would really like to display as something visual (much faster to analyze than reading a number).
I tried using a slider but they work only as input, you cannot refresh their position by setting the field value, which is a shame (or I did miss something).

It would be really super helpful ...
By the way I'm an experienced C# developer.

Thomas.
Otatiaro
 
Posts: 1
Joined: Wed Jul 03, 2024 7:10 pm

Re: line with spindle load percentage

Postby dezsoe » Mon Jul 29, 2024 1:19 pm

dwellpbar.png
dwellpbar.png (2.77 KiB) Viewed 3238 times

Here is my macroloop to show dwell progress:

Code: Select all
// ================================================================================================
// Macroloop - Show dwell state
// ================================================================================================

if (firstRun)
{
  firstRun = false;
  // BMP/Default2019_add/_dwell_progress.png 118x5
  pBar = new AS3PBar(AS3, 1157, 793, 118, 5, 10, 1, "BMP/Default2019_add/_dwell_progress.png");
}

bool dwell = exec.GetLED(21); // Dwell

if (dwell != lastDwell)
{
  if (dwell)
  {
    // Dwell started
    // Thread.Sleep(50);
    // double d = AS3.Getfielddouble(896); // Dwell_time
    double d = exec.dwelltime;
    if (AS3.Getcheckboxstate(212)) // Dwelltimeinseconds
      d *= 1000.0;
    dwellTime = (int)Math.Round(d / 50.0, 0, MidpointRounding.AwayFromZero) - 1;
    dwellCount = 0;
    showDwell = (dwellTime > 0);
  }
  else
  {
    // Dwell stopped
    showDwell = false;
  }
  pBar.Update(0.0);
  lastDwell = dwell;
}

if (showDwell)
{
  // Dwell in progress
  ++dwellCount;
  pBar.Update((double)dwellCount / (double)dwellTime);
}

// ================================================================================================

#Events

// ================================================================================================

bool lastDwell = false;
bool showDwell = false;

int dwellTime = 0;
int dwellCount = 0;

bool firstRun = true;

AS3PBar pBar;

// ================================================================================================

private class AS3PBar
{

  private AS3interfaceClass AS3;
  private int ImgViewNumber;
  private int Width;
  private int Height;

  private Image myImage;
  private Bitmap pbarBitmap;
  private SolidBrush sbrTransparent;
  private int lastWidth = -1;

  public AS3PBar(AS3interfaceClass as3, int w, int h, int imgviewnumber, string imgpath)
  {
    Setup(as3, w, h, imgviewnumber, imgpath);
  }

  public AS3PBar(AS3interfaceClass as3, int x, int y, int w, int h, int imgviewnumber, int layer, string imgpath)
  {
    as3.Addimageview(x, y, w, h, imgviewnumber, layer);
    as3.selectlayer(layer);
    Setup(as3, w, h, imgviewnumber, imgpath);
  }

  private void Setup(AS3interfaceClass as3, int w, int h, int imgviewnumber, string imgpath)
  {
    AS3 = as3;
    Width = w;
    Height = h;
    ImgViewNumber = imgviewnumber;

    myImage = Image.FromFile(Application.StartupPath + "/Flashscreen/" + imgpath);
    pbarBitmap = new Bitmap(myImage);
    sbrTransparent = new SolidBrush(Color.FromArgb(0, Color.Transparent));

    Update(0.0);
  }

  public void Update(double percent)
  {
    if (percent < 0.0) percent = 0.0;
    if (percent > 1.0) percent = 1.0;
    int w = (int)Math.Round((double)Width * percent, 0, MidpointRounding.AwayFromZero);
    if (w != lastWidth)
    {
      lastWidth = w;
      if (w == 0)
      {
        Image imgDraw = (Image)myImage.Clone();
        using (Graphics g = Graphics.FromImage(imgDraw))
        {
          g.Clear(Color.Transparent);
          g.FillRectangle(sbrTransparent, 0, 0, Width, Height);
        }
        AS3.Sendimageview(imgDraw, ImgViewNumber);
        imgDraw.Dispose();
      }
      else
      {
        Rectangle cloneRect = new Rectangle(0, 0, w, Height);
        Bitmap cloneBitmap = pbarBitmap.Clone(cloneRect, pbarBitmap.PixelFormat);
        Image imgDraw = (Image)myImage.Clone();
        using (Graphics g = Graphics.FromImage(imgDraw))
        {
          g.Clear(Color.Transparent);
          g.FillRectangle(sbrTransparent, 0, 0, Width, Height);
          g.DrawImage(cloneBitmap, 0, 0);
        }
        AS3.Sendimageview(imgDraw, ImgViewNumber);
        imgDraw.Dispose();
      }
    }
  }

}

// ================================================================================================

You can display any progress bar using the class AS3PBar. If you have the ImageView in your screenset then use the constructor with less parameters: that will not place the ImageView on the screen. I also attach the progress bar image as a sample:
Attachments
_dwell_progress.png
_dwell_progress.png (158 Bytes) Viewed 3238 times
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: line with spindle load percentage

Postby Algone » Thu Aug 01, 2024 3:35 pm

Thank you so much for sharing
Algone
 
Posts: 11
Joined: Thu Jun 20, 2024 10:23 pm


Return to Custom Screensets

Who is online

Users browsing this forum: Bing [Bot] and 1 guest