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

Pages: [1]
1
UPDATE: I had to uncheck the debugger to not break when this exception was thrown 😅 my bad... Thank y'all it works perfectly!!

2
I tried it with the NativeMethods you attached but I am still getting this error:
Quote
Managed Debugging Assistant 'PInvokeStackImbalance'
  Message=Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'AdvancedHMI!MfgControl.AdvancedHMI.NativeMethods::OpenPrinter' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'

Could this just be a formatting issue with the form I am using to create the string that will be placed on the label?

3
So I tried using the NativeMethods.VB from the link that was given which fixed the "Friend" issue. However now its throwing an exception saying:
Code: [Select]
MfgControl.AdvancedHMI.NativeMethods::OpenPrinter' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
Which I have no idea what that means...

4
I have plugged everything in, but I am getting an error for the NativeMethods portion.

It is showing that the method isn't accessible because it is a "Friend" though the whole sub is public and its namespace is being imported.

And is the .pDocName suppose to be the name of the format file?

5
Okay that seems fairly simple. The rawprinterhelper is a tad confusing for me.

Is the rawprinterhelper just placed in a separate module and called when needed? I am looking at the class and trying to understand some segments of the code. 
Would I just change this to what ever I name the ZPL file as, and the data type I assume would remain the same since its send a direct ZPL file?
Code: [Select]
        ' Set up the DOCINFO structure.
        With di
            .pDocName = "Mix Room Label Printer"
            .pDataType = "RAW"
        End With

And as far as the printer name goes, I figure it wouldn't really matter as long as it is the default.

6
I think I found a thread on plctalk refering to the project you mentioned. It said you used brackets [] as the container to look for in the zpl, but how did you get the bracket in to the file? Did you just prefill the text with [Variable] and then just replaced the inner string, or you just altered the actual zpl file?

I am very interested on seeing the code for this, I am not well versed on printer communications nor how I can link it to AHMI

7
Is there a way to add AdvancedHMI to a project or does it have to be started using the blank project? Reason being, I am trying to add a Zebra nugget package to a project and keep getting these errors:
Quote
  CACHE https://api.nuget.org/v3/registration5-gz-semver2/zebra.printer.sdk/index.json
Resolved actions to install package 'Zebra.Printer.SDK.3.0.3271'
Install failed. Rolling back...
Package 'Zebra.Printer.SDK.3.0.3271' does not exist in project 'AdvancedHMI'
Package 'Zebra.Printer.SDK.3.0.3271' does not exist in folder 'C:\Users\ashquinn\Desktop\PrintTest\packages'
Executing nuget actions took 1.18 sec
Could not install package 'Zebra.Printer.SDK 3.0.3271'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Time Elapsed: 00:00:01.8759248
========== Finished ==========

I am not sure how to get around this, or if there is even a way to. I am trying to print a tag element from my PLC to a Zebra zt410/411 without using the PLC. I was opting for VB to be in control. Has anyone one worked on something similiar to this?

*Edited title to be more accurate*

8
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: April 02, 2024, 12:58:56 PM »
Hey Archie, I know this is an old thread but I had to take a step back for other projects.

I don't think I fully understand the way the elements, plcaddressitems, and e.values would work. Does e.values report single values based on the elements?
So we have 85 carriers on our line that pass through a scanner to tell us which one it is (they are not in order)
So in my code it would be Carrier_Info[Stop_1.Carrier_Number] as the main tag and then the elements follow would be paint_color, name, oven_cycle and so on.

So would I need to just define 85 plcaddress items each with 8 elements and then still use the carrier number variable to define the e.value?

9
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 11:18:57 AM »
Awesome, for my situation with the array, it may be Paintpart[23] and the associated elements, or [65] depending on the carrier number at the station. With the data subscriber it looks like I can only call specific tags and not have a variablized tag. Would I need to just call the base name Paintpart then specific the actual tag location later in the code?

ps sorry for asking so many questions

10
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 10:02:39 AM »
Does the datasubscriber work for multiple PLC tags or is it for a single tag per subscriber? Currently the most important one I am trying to read is an array of tags with 8 elements to each tag.

Or would it be best to just setup the data subscriber to read the stop release bit and then run the full sequence of code?

Also does the datasubscriber read two way changes? Like if the bit changes from 0 to 1 it runs the sequence then when it changes back from 1 to 0 it reads again?

11
Support Questions / Re: How to Avoid PLC and PC timeouts
« on: February 29, 2024, 08:42:38 AM »
Are you using v3.99x or 3.99y ?

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

I am using 3.99y, as for reading the data im not utilizing either of those (im fairly new to vb in general). I am just using the mydriver.read/write to pull the information from the plc. So it just reads during each scan cycle. Would begin read be better?

Currently in the operation when it sees a release bit it goes through a few nested if loops then will write the data to a text file which is linked to a list view and it its a part number its never seen before itll write the information to the PLC array

12
Support Questions / How to Avoid PLC and PC timeouts
« on: February 28, 2024, 03:28:51 PM »
Hello,

I am using advancedhmi v35 and visual studio 2022, I wrote a VB.net script to continuously monitor data on the PLC (a GuardLogix 5380 Safety Controller). It works very well, but we run into an issue where the line will go on break for lunch etc and during that time the HMI says it has lost connection to the PLC. I am connected through an EhternetIPforCLXCom connection, I even setup a counter function that continuously runs to keep the EthernetIPforCLXCom1_DataReceived sub active; however, it still times out and when the line is started back the HMI never reconnects. Is there a better way to perform a handshake to allow the PC and PLC to not lose the connection between the two?
I though about creating a section on the PC that will reset the counter when it reaches a certain level. Any advice would be greatly appreciated.

Pages: [1]