# Cognex SVG Issues

**URL:** <https://forum.inductiveautomation.com/t/cognex-svg-issues/19778>\
**Category:** Ignition\
**Created:** [September 22, 2018, 1:52am UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778 "2018-09-22T01:52:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 22, 2018, 1:52am UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/1 "2018-09-22T01:52:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 22, 2018, 3:36pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/2 "2018-09-22T15:36:00Z")

</div>

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

[https://xmlgraphics.apache.org/batik/using/swing.html](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 @paul-griffith @Travis.Cox

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 22, 2018, 8:38pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/3 "2018-09-22T20:38:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 23, 2018, 11:20pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/4 "2018-09-23T23:20:34Z")

</div>

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](https://www.automation-pros.com/ignition/Batik%20SVG-0.1.1.1809232313.modl).

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.

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 24, 2018, 2:45am UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/5 "2018-09-24T02:45:33Z")

</div>

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:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/36eb3e5ebb5b984c3c85961e9109305e358ec2b3.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2018, 12:13pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/6 "2018-09-24T12:13:28Z")

</div>

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](https://www.automation-pros.com/ignition/Batik%20SVG-0.1.1.1809241244.modl).

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 24, 2018, 1:12pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/7 "2018-09-24T13:12:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2018, 1:14pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/8 "2018-09-24T13:14:44Z")

</div>

> [@rgarcher](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 24, 2018, 1:15pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/9 "2018-09-24T13:15:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2018, 1:46pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/10 "2018-09-24T13:46:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 24, 2018, 1:53pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/11 "2018-09-24T13:53:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 24, 2018, 3:34pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/12 "2018-09-24T15:34:40Z")

</div>

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?  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0d4503a3d7b4ff7ba33a8c8d5fca151c36823b43.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2018, 3:38pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/13 "2018-09-24T15:38:37Z")

</div>

> [@rgarcher](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 24, 2018, 7:40pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/14 "2018-09-24T19:40:43Z")

</div>

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](https://www.automation-pros.com/modulesales.html) 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.

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 25, 2018, 3:17pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/15 "2018-09-25T15:17:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 25, 2018, 3:35pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/16 "2018-09-25T15:35:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 25, 2018, 4:38pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/17 "2018-09-25T16:38:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 25, 2018, 5:53pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/18 "2018-09-25T17:53:45Z")

</div>

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

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a1f3d3c2baaa8a654115f21652b2a726a67a6121.png)

---

<div class="post-metadata">

**Author:** ![rgarcher](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rgarcher](https://forum.inductiveautomation.com/u/rgarcher)\
**Post date:** [September 25, 2018, 6:27pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/19 "2018-09-25T18:27:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 25, 2018, 6:33pm UTC](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778/20 "2018-09-25T18:33:15Z")

</div>

Hmmm. I’m stumped. [Build number 1809241910](https://www.automation-pros.com/ignition/Batik%20SVG-0.1.1.1809241910.modl) is the only version left in my webserver. Is there some caching going on somewhere? Is that the build installed in your gateway?

[Next page](https://forum.inductiveautomation.com/t/cognex-svg-issues/19778.md?page=2)
