Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Archie

Pages: [1] 2 3 ... 343
1
Support Questions / Re: Making form size independent using MainMenu
« on: May 22, 2024, 11:26:11 AM »
If you are using 3.99y, in the MainMenuButton.vb code at line 264 is where it sets the form size to fill the screen less the main menu
Code: [Select]
               If MenuPosition = AdvancedHMI.Controls.MenuPos.LeftOrTop Then
                   If pf.width < pf.height Then
                       '* Menu is on left
                       f1.Size = New Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - pf.Width, pf.Height)
                       f1.Location = New Point(pf.width, 0)
                   Else
                       '* Menu on Top
                       f1.Size = New Size(pf.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - pf.Height)
                       f1.Location = New Point(0, pf.height)
                   End If
               Else
                   '* Menu on Right
                   If pf.width < pf.height Then
                       f1.Size = New Size(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - pf.Width, pf.Height)
                       f1.Location = New Point(pf.location.x - f1.Width, 0)
                   Else
                       '* Menu on Bottom
                       f1.Size = New Size(pf.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - pf.Height)
                       f1.Location = New Point(0, pf.location.y - f1.Height)
                   End If
               End If

2
Support Questions / Re: Display a float value in DigtalPanelMeter
« on: May 18, 2024, 06:12:32 PM »
Test with a BasicLabel first to see if it is getting the correct value.

To show a floating point on the DigitalPanelMeter, Set the ScaleFactor property to 1000 and the DecimalPosition to 3

3
I did not realize I left off the NativeMethods.vb

I edited the post above to add the file. Try to use that one because it came from a working project

4
The RawPrinterHelper.vb file is added to the project by right clicking the AdancedHMI project and selecting Add->Existing Item.

You are correct, the printer name does not matter as long as it is default.

5
After creating the file using the Zebra designer software, I manually edited with Notepad. Attached is the file.

The first thing my code does is to read data from the PLC and put it in a local variable:
Code: [Select]
        Dim RecipeName As String = ""
        Try
            RecipeName = EthernetIPforCLXCom1.Read("Batch1RecipeName")
        Catch ex As Exception
            MsgBox("Failed to read Batch1RecipeName from PLC. " & ex.Message)
            Exit Sub
        End Try

It then reads the file and stores it in a string:
Code: [Select]
        Dim s As String
        Using sw As New System.IO.StreamReader("BatchTicketLabelFormat.prn")
            s = sw.ReadToEnd()
        End Using

Using Regular Expression, the string is parsed looking for the brackets
Code: [Select]
        Dim x As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(s, "\[(.*?)\]")
        Dim Substitue As String
        While Not String.IsNullOrEmpty(x.Value)
            If x.Value.IndexOf("Batch1RecipeName") >= 0 Then
                Substitue = RecipeName
             Else
                Substitue = "ZZZZZZ"
            End If
            s = s.Substring(0, x.Index) & Substitue & s.Substring(x.Index + x.Length)
            x = System.Text.RegularExpressions.Regex.Match(s, "\[(.*?)\]")
        End While

And finally send the string directly to the printr:
Code: [Select]
        RawPrinterHelper.SendStringToPrinter(RawPrinterHelper.DefaultPrinterName(), s)

6
Support Questions / Re: Graphic indicator
« on: May 08, 2024, 05:36:24 PM »
This should work. What version of AdvancedHMI are you using?

7
Support Questions / Re: Exit Button on MainMenu
« on: May 08, 2024, 05:35:32 PM »
You are correct, the MainMenu does need to use MainMenuButtons instead of form change buttons.

The MainMenu form has a property of MenuPosition. Depending on whether the form is taller than wide or vice versa is what determines the edge it will dock to.

8
Support Questions / Re: Second monitor
« on: May 08, 2024, 05:32:14 PM »
It has been a long time since I have done this, but you need to create another form, show it, then dock it onto the second monitor. I would have to search for the code to remember how to dock the form onto the second monitor

9
Several years ago I did a project that needed to print to a Zebra label printer. I installed the printer driver into Windows and set the zebra as the default printer. From there I send a raw string of data directly to the printer that was in the ZPL format.

Attached is a helper class I used for sending the data to the printer.

The code to send a string to the printer using the helper class:
Code: [Select]
        RawPrinterHelper.SendStringToPrinter(RawPrinterHelper.DefaultPrinterName(), s)

I created a label using the Zebra software and saved it to be used as a template file. I then edited the label file to insert markers where I wanted to substitute data from the PLC. For example, [BatchNumber]

I wrote code to read that template, searched for the markers, then substituted the real data. And finally sending the string directly to the printer.

I can share more of the code, if you are interested

10
Open Discussion / Re: Documentation, Visual Studio, GitHub and more...
« on: April 17, 2024, 12:32:46 PM »
AdvancedHMI does lack public documentation because years ago this was done by intention in order to give an advantage for attending the training classes. There was an attempt to create a user driven documentation wiki, but thanks to spammers, that had to be locked down:

https://advancedhmi.com/documentation/index.php/Main_Page

There was also a repository for samples, which is now fairly old:

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/SampleProjects/

Any suggestions along with offers of help to improve the documentation is always welcome.

11
Support Questions / Re: Change colors on Chart with logging
« on: March 28, 2024, 06:31:40 PM »
It does not appear there is a way to change the default colors.

12
Are you using the XAEShell or full Visual Studio? If full VS, what version?

I have been using the XAEShell to work with TwinCAT projects and VS 2022 without TC integration for AdvancedHMI.

13
Support Questions / Re: Float Register with Modbus
« on: March 20, 2024, 08:31:20 AM »
In the Modbus driver, try to set SwapWords to True to see if that does what you want.

14
Support Questions / Re: Basic Indicator On wiith decimal value
« on: March 14, 2024, 08:53:31 AM »
The PLCAddressSelectColor2 works on a boolean value, so you can program the comparison in your PLC to set a boolean value.

The other option is to use some code:

- Add a DataSubscriber to the form
- Set PLCAddressValue to the register you want to use
- Double click the DataSubscriber to get back to code
- Enter this code:
Code: [Select]
if e.Values(0)=101 then
  BasicIndicator1.ForColor=Color.Red
else
  BasicIndicator1.ForColor=Color.White
end if


15
Send it to the sales at advancedhmi.com email.

Pages: [1] 2 3 ... 343