Posts Tagged ‘Efficient Engineering’

Create a zenon Project template in Visual Studio

Thursday, May 21st, 2015

In reference to IU-17,.Net Windows Form Controls in zenon, Page 26 for extending interface functionality of zenon, developers can develop controls by performing a special configuration in Visual Studio .Net.
To simplify the development of a control by Visual Studio .Net a zenon project template can be created which is reusable. Furthermore, a zenon control template can also be created in the same way if necessary.
An eligible zenon project contains a control and can be integrated in zenon but must include several prerequisite settings mentioned in IU-17,.Net Windows Form Controls in zenon, Page 26.

STEP 1:
Create a project type: Windows Form Control Library

STEP 2:
Register the control as a dual control through registering for COM interop.

STEP 3:
Make the managed control visible for COM and set ClassInterface attributes.

STEP 4:
Add necessary entries and ActiveX attributes in the code designer.

STEP 5:
Take necessary steps to register control as an ActiveX in the Registry.

How to parametrize template

After configuring the project it must be customized with parameters for further use as a template. Each project must have a unique GUID for registering therefore this GUID must be generated automatically for each project creation. To implement this, the “$guid1$” parameter must be used instead of existing GUID in AssemblyInfo.cs file.

VisualStudio_zenonProjectTemplate_1_1

The second position which needs a unique GUID in the template is the class of control. It must be changed as follows and the GUID must be replaced with “$guid2$”.

VisualStudio_zenonProjectTemplate_1_2

How to create a template

After replacing the guids with parameters which are reserved template parameters, the template can be created.

  1. File menu > Export Template. The Export Template wizard opens.
  2. Project Template option must be selected.
  3. The current project must be selected in the list.
  4. Click Next.

VisualStudio_zenonProjectTemplate_1_3
Assign a name to the zenon project template.

  1. Assign a description.
  2. Assign an icon to the project template and all the assigned values will be shown in New Project dialog.
  3. Click Finish.
  4. The result of creating a template

VisualStudio_Screenshot_1_4

For further information Microsoft’s reference links can be used.

Using a predefined project template lessens the probability of errors during development. Because for developing a control for zenon environment are some settings necessary which can be forgotten and with lack of them, control cannot be created how it’s expected.

To remove the template from Visual studio .Net

It’s enough to delete the zip files from the following folders:

  • My Documents\Visual Studio Version\Templates\ItemTemplates
  • My Documents\Visual Studio Version\Templates\ProjectTemplates

References

 

(The COPA-DATA Blog Team would like to thank Parisa Moosavi from EDAG Production Solution for her zenon insights)

Substitution with Index Parameter

Friday, April 24th, 2015

Things can quickly become complex when it comes to creating a project. In order to keep the overview in your work process, ease of use is an important topic. That is why zenon supports the user with an object-oriented and central workflow concept.

You might already know substitution features like linking rules, index variables or manual index editing. By applying them, screens as well as functions can be created once and reused for different content. This will not only save you time but will also help you to keep your project sleek and clearly structured.

Nevertheless, there are situations where using such functionalities can slow down your workflow. Taking index variables as an example, you not only create the variable but also need “write set value” functions and scripts in order to make it work. The effort is not always worth the benefit. To bypass such a scenario, zenon now offers an additional possibility to substitute screens and functions: “Replace indices” with parameter.

Substitution dialog of a function

Substitution dialog of a function

Let’s say you have three tanks and need to have a detailed screen of every single tank with all its variables. You have already created a “screen switch” function and a detailed screen for the first tank.  In the substitution dialog of the function you can create an indexing rule by entering a source variable, e.g. “Tank1”, and add a target, instead of using an index variable, type {PARAM} at the position. From now on, you can also apply this edited function for the other two tank buttons.
As a last step, set the parameter for substitution directly at the element properties of the button. This new feature not only works with a button but with a combined element and Combo-/Listbox too.

Element properties (of a button) – Variable/function

Element properties (of a button) – Variable/function

Improved handling of scripts in zenon 7.20

Thursday, April 2nd, 2015

With the current zenon version, we continued to make working with scripts easier and more efficient. The first change you might notice regards the script-functions “Script: execute” and “Script: select online”. The previous dialog was replaced by a new selection dialog – which should be more familiar to you as it is used commonly throughout zenon. It offers you all the functionalities to search for a script, see what is inside the script, modify the script and even create a new script on the fly. This already saves a lot of time during engineering but as you know, there is always one more thing …

The new script selection dialog

Up until zenon 7.11 working with scripts was done the long way around: You had to go to the Scripts-node of the project, create a new script and configure it, switch to the Functions-node, create a “Script: Execute”-function; find your script again, etc. Then finally link the new function to e.g. a button to actually use it in the Runtime.
7.20 makes your life a lot easier now: On all places in zenon, where you can link a function (except at a script of course), you now have the possibility to directly select a script instead of searching the “Script: execute” function. The enhanced function selection dialog offers you the additional editing possibilities of our new script selection dialog. But it gets even better: instead of having to do the legwork and searching a matching “Script: execute” function (or create a new one) this is automatically done for you in the background.
Linking multiple functions at e.g. a button just got way easier.

The enhanced function selection dialog

The enhanced function selection dialog