Cognex SVG Issues

So after several days of troubleshooting with tech support, Ignition has determined there is an issue with the web browser module loading a svg file. Basically, the cache continues to build with each image and eventually the client freezes. Even with using a taskkill script for the chromium browser, eventually it completely freezes the client. With that being said, I’ve seen several topics on Cognex and I’m wondering if anyone has been able to load images from the camera continuously without having the client completely lockup. If not, any ideas on how to show a live feed from the camera using the svg? I can switch from using the svg to a bmp or jpg using the image viewer, but this will not be near as useful to the operators. I’m in a hard position right now as I’m trying to sell using this Ignition application as a template for multiple lines as we replace obsolete equipment. Any suggestions are welcome!
Thanks.
Rob

It is beyond my pay grade to implement but this looks like it would work.

https://xmlgraphics.apache.org/batik/using/swing.html

Would need someone with a bit more in-depth knowledge of swing to bring it to fruition.
@pturmel @PGriffith @Travis.Cox

This is something that a lot of people would be interested in as Cognex is spreading like wild fire through the industry.

1 Like

Hmmm. Not trivial, but not as difficult as I would have thought some months ago. I’ll poke at it a bit.

1 Like

Went round and round with a thorny class cast exception until I figured out that Ignition’s Vision module is already loading all the necessary classes. Had to reimplement some missing methods to keep the designer happy. Anyways, rough draft is here.

The Batik Canvas is opaque and doesn’t seem to be easily changed. Hope that isn’t a deal-breaker.

The wrapped component has a .setXMLText() method that takes a well-formed XML string (including a final line ending). The displayed XML can be extracted into a string with the .getAsText() method.

Edit: first draft taken down. See below.

Thanks! This looks promising. I don’t seem to have an issue loading it in designer, but when I run the staged project, I immediately get the following error:

Hmm. Ignition must not be deploying that jar to the client scope. I may have to include that one in my modl.

Edit: Had to include all of the Batik and XML Commons libs. The Vision module loads them all only in Designer scope. New beta here.

1 Like

Perfect. Thanks. With this being a trial version, is it time limited?

Yes. It ceases painting when the trial expires. I’ll make it more obvious before I make a formal release.

1 Like

Ok. How do I get the full version? I would like to implement this quickly.

Oh, I can generate licenses fairly quickly once I figure out how to price this. It was easy to throw together, but there’s a lot of complexity under the hood (in Batik) to support. And I’d like at least one beta tester to push it pretty hard (like your Cognex case) to make sure it performs.

That sounds good. The project I’m using it in is scanning about 60 bottles per minute so this should test it out. If it causes client freezing issues, we should see it within a few hours.

Working much better than the web browser. There is no refresh when loading. Can the below error be suppressed so it doesn’t popup on the screen?

There’s an event hook for exceptions. I’ll expose it for you to handle (suppress) as the application requires. I’m not sure what side effects there might be if you don’t script it.

Ok. I have a release candidate now. Paints a translatable “Trial Expired” in place of the SVG when appropriate. Tweaked the documentLoader events to have the correct event.source object. I’ll probably have to do the same to some of the other events. Also added extension functions that can intercept the component’s error message and exception dialog boxes.

Visit my module sales page for the latest while I set up the showcase data.

Note: you’ll have to accept the license again… I needed to add the third party Apache License callout since I’m now packaging batik for the client scope.

1 Like

Do you know what event handler I would use to handle this exception?

Use the filterException() extension method. If you don’t want to fight it for now, just return False from that method.

Should that be listed under Event Handlers? I don’t see it.

In the scripting popup for the component, extension functions are at the bottom of the list.

I downloaded the version from your website, but the extension functions are not there.

Hmmm. I’m stumped. Build number 1809241910 is the only version left in my webserver. Is there some caching going on somewhere? Is that the build installed in your gateway?