Page 1 of 1
line with spindle load percentage
Posted:
Mon Jan 17, 2022 12:38 pm
by fixebr
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)
Re: line with spindle load percentage
Posted:
Wed Feb 02, 2022 9:10 pm
by Battwell
divide reading by max amps then multiply by 100
eg max amps 20. reading from vfd 10
10/20= 0.5
*100 = 50%
Re: line with spindle load percentage
Posted:
Thu Feb 03, 2022 12:26 am
by fixebr
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.
Re: line with spindle load percentage
Posted:
Thu Feb 03, 2022 5:52 pm
by Battwell
i dont make fancy graphics.
instantaneous load and maximum load is all i display.
Re: line with spindle load percentage
Posted:
Sun Apr 10, 2022 7:56 pm
by Luc
Did you get anywhere with this? Oddly something ive been looking into but completely new to UCCNC. Seems like a really useful feature
Re: line with spindle load percentage
Posted:
Wed Apr 27, 2022 3:33 pm
by Authority924
Sounds interesting for me! Do you have some update?
Re: line with spindle load percentage
Posted:
Wed Jul 03, 2024 7:13 pm
by Otatiaro
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.
Re: line with spindle load percentage
Posted:
Mon Jul 29, 2024 1:19 pm
by dezsoe
- dwellpbar.png (2.77 KiB) Viewed 5748 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:
Re: line with spindle load percentage
Posted:
Thu Aug 01, 2024 3:35 pm
by Algone
Thank you so much for sharing