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
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)

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

3
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.

4
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

5
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

6
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.

7
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.

8
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.

9
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.

10
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


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

12
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 02:14:26 PM »
You should be able to do a PLCAddress of PaintPart[0] and NumberOfElements of 65 (or greater). Then use e.Values(x) to access each array element,

13
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 10:36:16 AM »
The DataSubscriber2 allows you to setup multiple tags in a single DataSubscriber2. It will fire on changes in both directions.

14
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 09:19:33 AM »
BeginRead is an asynchronous command which takes a lot more overhead to use. I would only use it if you need non-blocking code.

If you are just monitoring values for change, I would use the DataSubscriber


15
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 28, 2024, 04:08:32 PM »
Are you using v3.99x or 3.99y ?

How are you reading data in the code? Read or BeginRead? How frequently are you reading?

Pages: [1] 2 3 ... 343