Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2013JUN
5
By rbasniak / In PML II, PML Language, PML.NET / Comments(1)
Introduction
One of the most waited news from PDMS 12, at least for those who work with
code development, is the possibility to create new tools using the Microsoft
.NET technology. Despite the fact that PML is a powerful language inside PDMS,
it flaws in the lack of basic resources like a debug tool, a graphical
interface to create forms and the possibility of communicating with third
party software in practical way. The new .NET APIs fulfill these lacks from
PML and yet open a whole new world of possibilities for development of new
interfaces with other software or just software customization.
Microsoft began the development of the .NET framework in the early 90s, but
the first beta version was released only 10 years later. Nowadays its on
version 4.0, however PDMS supports only version 3.5.
Pros
The .NET has a premise like Java, where the code is developed for a platform
and not a specific hardware like most programming languages. Its possible
because the code is compiled twice. The first compilation occurs when the user
compiles its code, for the CLR language (Common Language Runtime). The next
compilation occurs when the software is executed and its compiled for the
hardware its running on. One great advantage of this is the fact that the
code can be written in many different languages. By the time when this article
was written, it supported more than 20 languages. In theory you can develop in
any of these languages, however Aveva only supports C#. Off course if you
want, you can code in VB.NET or any other .NET you feel comfortable.
Another pro of this framework is that it has a very large amount of ready to
use libraries. This speed up a lot the code development because the developer
doesnt have to bother coding solutions that are consolidated and well known
for years.
In my opinion, the two most critic PML issues were the lack of a graphical
user interface to create forms and a debug tool. These problems are solved if
you use an IDE (Integrated Development Environment) for .NET as Microsft Visual
Studio, developed by Microsoft and with all tools any developer may need. The
major drawback is its price, which begins around 700,00 USD. Thats why I
would like to tell you about this amazing open source software: SharpDevelop.
It has all features youll use for addin development and sometimes they are
even better than their Visual Studio counterparts.
Now that I already gave an overview of the .NET framework and its advantages,
lets talk more specifically about PDMS. The development with .NET is based on
DLLS, in other words, the code is compiled to a .dll file and not a .exe one.
This .dll file is called by PDMS when its opened (its very like the addins
system used over the years by other general CAD/CAE software). My greatest
disappoint here is that Aveva didnt make available APIs to access PDMS
through executable applications (.exe), like is done by Solidworks, AutoCAD
and even Microsoft Office. This way you would be able to develop an external
application that would connects to PDMS and interact. Not that it make the
APIs useless, but it would be a really nice feature to have.
Cons
Until now I only wrote about good things, but like everything else in life,
this also has some cons.
One I already told, which is the fact that Aveva didnt make available APIs to
access PDMS through external applications.
But in my opinion, the major bad thing about it is that the available APIs
basically allow us to navigate through the database, create, delete, change
attributes and collect elements. Features like clipping, view manipulations
and graphical interaction are completely inaccessible by .NET.
Lets make something clear here: its possvel to send commands that would be
normally used through the command line to PDMS. However the classes that allow
us to do this have a description telling that theyre for Aveva use only (in
the .NET, because they dont even appear on the manuals). This feature would
solve the above problem, but because of this Im not considering these classes
on serious aplications due the fact that they could be blocked from us at any
time on future releases. If you have discovered those classes and want to use
them, do this knowing that can be consequences in the near future.
Another thing I found really annoying is that when PDMS is opened, it locks
the addins .dll file and it cant be erased or modified. This costs a huge
amount of development time, especially if you are still learning it, because
every time you have to recompile the code, you must close PDMS and then open
it again once the code is compiled.
Final words
Ive been seeing people that want to learn PDMS development, and do not you
PML, asking if they should go and start learning with .NET. My personal answer
is no! PML knowledge will make you see clearer how PDMS and customization
works.
For those who already know PML and would like to begin learning .NET
development for PDMS, its essential to have a basic knowledge about C# (or
the .NET language of your choice), DLL programming and SharpDevelop (or Visual
Studio). So I recommend these links:
Visual Studio 2010, A Beginners Guide by C# Station
Creating and using C# DLLs by K. Balaji
Creating C# Class Library (DLL) Using Visual Studio .NET by Mahesh Chand
Next step is to study the PDMS APIs. By now the only resource about it is
the .NET Customization User Guide (wheres our Reference Manual Aveva?).
To conclude, the .NET development did not make PML obsolete and do not
substitute it since there are lots of things you can do with PML that you
cant still do with .NET. However, it opened a whole new world of
possibilities when we think about data exchange with third party software.
Introduction
Im back with a new article related to the new .NET framework. Todays article
is more of a tutorial explaining how to install and then configure a PDMS 12
addin made in .NET.
Well need an addin to use as example. I made a very simple addin for this
purpose. This addin can be used to model trasitions from rectangular sections
to circular ones for equipments. Well install this addin in PDMS and then
configure it to expose its interface to the end user. This will be done with a
menu and a commandbar.
To download the addin just scroll to the end of this page, its totally free.
1 set CAF_UIC_PATH=D:\pml.net\interface\config
2 set CAF_ADDINS_PATH=D\:pml.net\addins\config
The CAF_ADDINS_PATH variable informs PDMS where it should search for the addin
to load.
The CAF_UIC_PATH variable informs PDMS where it should search for saved
interface customization files.
Now were going to copy each modules addin and interface configuration files.
Unfortunately these environment variables arent like PMLLIB, where its
possible to put only the modified files on the new folder and PDMS will search
for the others on the installation folder. So we have to copy ALL files
called <modules name>Addins.xml (DesignAddins.xml, ParagonAddins.xml,
SchematicsAddins.xml, etc) to the \pml.net\addins\config folder and ALL files
called <modules name>Customization.xml (DesignCustomization.xml,
ParagonCustomization.xml, DraftCustomization.xml, etc) to
the \pml.net\interface\config folder.
Copy the DrawTransition_v????.dll file to the \pml.net\addins\dll folder.
Open the DesignAddins.xml on the Notepad and add one more line, like shown on
the Picture 3, pointing the folder where you put
the DrawTransition_v????.dll file. Note that you have to type exactly the same
name as the dll youre using (theres one dll for each PDMS version), and do
not type the file extension.
Picture 3 Edited DesignAddins.xml file
Now lets create a new .uic file to save our menus, buttons and commandbars.
Open Notepad and type the following:
Shell
1
<?xml version="1.0" encoding="utf-8"?>
2
<UserInterfaceCustomization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="www.aveva.com">
4
<Version>1.0</Version>
5
<Tools />
6
<InstanceTools />
7
<MenuBar />
8
<CommandBars />
9
<TaskPanes />
1
<ContextMenus />
0
<Namespace>3dMacro</Namespace>
1
</UserInterfaceCustomization>
1
Save the file as 3dMacro.uic on the \pml.net\interface\uic folder.
Se preferir pode baixar o arquivo diretamente clicando aqui.
Watch out if your Windows is set up to hide file extensions. If yes it will
add a .txt extension on your files name. It wont appear to you but the .uic
file wont work.
Now we only have to inform PDMS about this new .uic file. Open the
\pml.net\interface\config\DesignCustomization.xml file on the Notepad and
change it as show on Picture 4.
Figura 4 Edited DesignCustomization.xml file
Now the addin is installed and will be loaded in Design. Open PDMS and watch
the console window for any errors (the DOS window that starts with PDMS). If
you see any error or PDMS does not load, redo the previous steps to see if you
havent missed anything.
What we have to do now is expose the addin interface to the user. In PDMS 12
is possible to create menus and commandbars through the interface. Well
create a menu and a commandbar that will allow the user to open the addin
window.
Conclusion
In this article we could see the new system to addin access and user interface
customization. The creation of new menus is not tied to the use of new addins.
You can also run your old PML macros, because as you can see on the window
from Picture 7 theres a Macro option where you can call the macro you want to
execute for the new item.
Up to today there was always the need to know PML 1 or 2 to create new menus.
On this new version Aveva made this process a lot more user friendly and open
to nearly all users, not only administrators. And the best part: can be done
in a user basis, without change the companys customizations.
And dont forget: you can use the set up made here to install any addin from
now on. You only have to copy the .dll addin file into the
\pml.net\addins\dll and change the .xml file of the module you want the addin
to be used from.
Introduction
In case you cant run PDMS 12addins through your local network, chances are
that you need to change the .NET security configuration.
.NET introduced a new set of permissions called Code Access Security (CAS).
With CAS it doesnt matter that the user is allowed to do an operation, the
application itself must be allowed too.
To exemplify lets say you have full access to modify the Windows registry and
you will run an application that changes the registry. Usually that would be
ok, but how much you can trust this application? What if there are malicious
code? Its here that the .NET comes in.
Thats why its common to find applications that run perfectly on your PC, but
when you try to run them over your local network they dont work anymore. This
new security system works with zones, and each one has different access
restrictions. Your PC and your network are two different zones and because
this they have different permission levels.
On .NET 1 and 2 the CAS works, in a very simplified way, as described above.
But in .NET 3.5 SP1 its not necessary to change the security levels anymore.
So, if I compile my code targeting Framework 3.5 SP1 is it all solved?
Unfortunately its not how it works. Your addin will use Avevas DLLs, which I
suppose, may be compiled with version 2.0 and even 1.1 of .NET Framework. I
say that because even if I change my code to target Framework 3.5 SP1 I still
get the security error eventually. Then the only way out is the good old key
combination: Ctrl + Alt + Del.
Luckily theres a solution: change the trust level of your network zone
to Full Trust. The disadvantage is that you must do this to every client PC
which will run PDMS 12 addins through network and you must have administration
privileges. But the configuration itself is very simple and takes only a few
seconds.
Remember that you must setup both 1.1 and 2.0 versions of .NET Framework. If
you setup only one of them you will end up getting the security errors. In the
2.0 version there are two ways of doing this, feel free to pick the one you
feel more comfortable with.
Setting up CAS on .NET 1.1 through Control Panel
On Control Panel click on Administrative Tools and select Microsoft .NET Framework
1.1 Configuration. Select My Computer > Runtime Security Policy > Machine > Code
Groups > All_Code.
Conclusion
Despite the fact that .NET 3.5sp1 doesnt need to configure the security
levels to run code from network, some PDMS DLLs may be compiled with older
versions of .NET, and because of this when you run your addin you end up
getting security errors. To solve this its necessary to classify your local
intranet to a level of full trust to any code which runs from network. That
configuration must be done to each computer but this way you can put all your
addins in a central repository in you network and then when you need to add
more addins or update old ones, you do it in one place only.
For more information on PDMS 12 addins and how to install and configure one,
see How to install and configure a PDMS 12 addin.
Setting up your PMLLIB
Introduction
Ive seen that many people still get confused when setting up the PMLLIB to
add customizations to PDMS.
Theses files must be in some special place so PDMS can see them, and this
place is the PMLLIB.
Q EVAR PMLLIB
If you have more than one folder in your PMLLIB, PDMS will first look for the
file in the first folder in the PMLLIB. If it does not find it there, itll
try the second one and so on, until ir finds it or the folders in PMLLIB end.
Inside each of the PMLLIB folder theres one file called pml.index. This file
is a list of all files in that folder, so PDMS doesnt actually look for the
file in the folders, but in this index file. If the file is in the folder but
not listed in the pml.index, then it doesn not exist to PDMS.
Because of this, each time you add a new file to the PMLLIB you hate to type
the following command in PDMS:
This command should update all pml.index files in your PMLLIB. But what really
happens is that in some situations it does not do it and PDMS cant find the
new files.
In these situations what you have to do is erase the pml.index file from that
particular PMLLIB and only then use the rehash command in PDMS. When you do
this PDMS will not find the index file and will have to recreate it.
In this example well assume the original PDMS bat files. PMLLIB is set up in
the evars.bat file, that is located in the same folder where PDMS is
installed. You should look for the following line in the file:
set pmllib=%pdmsexe%pmllib\
Now change it, addin a new path at the end of this line:
Youre done. Now PDMS will look for PM II files in its installed folder and in
the folder MyPMLLIB. Dont forget to use the rehash command each time you add
a new file to one of the PMLLIB folder and erase the pml.index files if
needed.
Introduction
In case you cant run PDMS 12addins through your local network, chances are
that you need to change the .NET security configuration.
.NET introduced a new set of permissions called Code Access Security (CAS).
With CAS it doesnt matter that the user is allowed to do an operation, the
application itself must be allowed too.
To exemplify lets say you have full access to modify the Windows registry and
you will run an application that changes the registry. Usually that would be
ok, but how much you can trust this application? What if there are malicious
code? Its here that the .NET comes in.
Thats why its common to find applications that run perfectly on your PC, but
when you try to run them over your local network they dont work anymore. This
new security system works with zones, and each one has different access
restrictions. Your PC and your network are two different zones and because
this they have different permission levels.
On .NET 1 and 2 the CAS works, in a very simplified way, as described above.
But in .NET 3.5 SP1 its not necessary to change the security levels anymore.
So, if I compile my code targeting Framework 3.5 SP1 is it all solved?
Unfortunately its not how it works. Your addin will use Avevas DLLs, which I
suppose, may be compiled with version 2.0 and even 1.1 of .NET Framework. I
say that because even if I change my code to target Framework 3.5 SP1 I still
get the security error eventually. Then the only way out is the good old key
combination: Ctrl + Alt + Del.
Luckily theres a solution: change the trust level of your network zone
to Full Trust. The disadvantage is that you must do this to every client PC
which will run PDMS 12 addins through network and you must have administration
privileges. But the configuration itself is very simple and takes only a few
seconds.
Remember that you must setup both 1.1 and 2.0 versions of .NET Framework. If
you setup only one of them you will end up getting the security errors. In the
2.0 version there are two ways of doing this, feel free to pick the one you
feel more comfortable with.
Conclusion
Despite the fact that .NET 3.5sp1 doesnt need to configure the security
levels to run code from network, some PDMS DLLs may be compiled with older
versions of .NET, and because of this when you run your addin you end up
getting security errors. To solve this its necessary to classify your local
intranet to a level of full trust to any code which runs from network. That
configuration must be done to each computer but this way you can put all your
addins in a central repository in you network and then when you need to add
more addins or update old ones, you do it in one place only.
For more information on PDMS 12 addins and how to install and configure one,
see How to install and configure a PDMS 12 addin.
Introduction
In the last posts we saw how to setup PDMS to run addins created with .NET and
how to allow all users to access them through menus and toolbars. Now we will
create an addin from scratch, including all source code.
Before we start coding we need to check if our system meets the requirements.
System requirements
I think I dont have to tell you that the first item is PDMS. You dont
actually need PDMS to develop the addin, but if you need to test it, then
youll need PDMS. You can only develop addins for PDMS 12.x series. Everything
I do in these series of tutorials will be considering PDMS 12.1 SP2. Since
PML.NET is new, its changing a little between Service Packs and if you are
using older versions of PDMS there might be some changes youll have to make
for your own.
Another requirement is a development interface and the chosen one
is SharpDevelop because its free and have the same basic functionality as
Visual Studio.
You can download the 4.3 version clicking here.
Your machine must have .NET 4.0 Full Runtine, which you can download here,
and .NET 3.5 SP1 Runtime, which you can download here.
SharpDevelop will need administrator rights for installation, but after its
installed you can copy it to a pendrive and it will run as portable software
in any machine that has the runtime installed.
Conclusion
There are the basic requirements to develop for PDMS using .NET. If you have
Visual Studio you can use it instead of SharpDevelop, both are very alike and
you will not have any trouble in following the tutorials with any of them. The
main SharpDevelop advantage, besides the price, is that you can use it as
portable software.
Next week Ill be back with a new part of these series.
Introduction
Before we start coding and digging in details about PML.NET we need first to
learn some basics of SharpDevelop and .NET.
Creating a C# Project
Open SharpDevelop and click File > New > Solution.
In the New Project window select C# in Categories, Class Library in
Templates and in the Name field type TestProject. In the Location field select
a folder to save your new project.
In the upper right corner select .NET Framework 3.5 (only the 3.5 version, not
the Cliente Profile version). This is a very important step, because the addin
wont work if you select the .NET 4.0 or newer.
Your window should look like this:
1 using System;
2 using System.Collections.Generic;
3
4 namespace TestProject
5 {
6 /// <summary>
7 /// Description of MyClass
8 /// </summary>
9 public class MyClass
10 {
11
12 }
13 }
Conclusion
This ends this weeks material. Theyre very basic steps and most of you
probably already know it, but since we have readers of all knowledge levels I
decided to do this in bay steps so everyone can learn and keep following the
examples. If you have any question, thats why the comments session is at the
end of the page.
basniak / In PML Language, PML.NET / Comments(0)
Introduction
We already know how to compile a DLL library and now we start digging in the
steps needed to turn it in something that PDMS can understand.
Every time you create a new project youll have to follow todays steps. If
you have any doubt on how to create a new C# project, click here.
The classes we need to use when developing an addin do not exist in Windows,
so we need to add their library references to our projects. These libraries
are in the same folder where PDMS was installed.
Introduction
Im back with a new article related to the new .NET framework. Todays article
is more of a tutorial explaining how to install and then configure a PDMS 12
addin made in .NET.
Well need an addin to use as example. I made a very simple addin for this
purpose. This addin can be used to model trasitions from rectangular sections
to circular ones for equipments. Well install this addin in PDMS and then
configure it to expose its interface to the end user. This will be done with a
menu and a commandbar.
To download the addin just scroll to the end of this page, its totally free.
1 set CAF_UIC_PATH=D:\pml.net\interface\config
2 set CAF_ADDINS_PATH=D\:pml.net\addins\config
The CAF_ADDINS_PATH variable informs PDMS where it should search for the addin
to load.
The CAF_UIC_PATH variable informs PDMS where it should search for saved
interface customization files.
Now were going to copy each modules addin and interface configuration files.
Unfortunately these environment variables arent like PMLLIB, where its
possible to put only the modified files on the new folder and PDMS will search
for the others on the installation folder. So we have to copy ALL files
called <modules name>Addins.xml (DesignAddins.xml, ParagonAddins.xml,
SchematicsAddins.xml, etc) to the \pml.net\addins\config folder and ALL files
called <modules name>Customization.xml (DesignCustomization.xml,
ParagonCustomization.xml, DraftCustomization.xml, etc) to
the \pml.net\interface\config folder.
Copy the DrawTransition_v????.dll file to the \pml.net\addins\dll folder.
Open the DesignAddins.xml on the Notepad and add one more line, like shown on
the Picture 3, pointing the folder where you put
the DrawTransition_v????.dll file. Note that you have to type exactly the same
name as the dll youre using (theres one dll for each PDMS version), and do
not type the file extension.
Picture 8 Linking the button to the menu and to the command bar
Click OK to go back to PDMS.
If you followed all steps above, it will be possible to see a new command bar
and the new 3D Macro menu. The bar will appear anywhere around your already
existing bars, so youll have to look for it.
Conclusion
In this article we could see the new system to addin access and user interface
customization. The creation of new menus is not tied to the use of new addins.
You can also run your old PML macros, because as you can see on the window
from Picture 7 theres a Macro option where you can call the macro you want to
execute for the new item.
Up to today there was always the need to know PML 1 or 2 to create new menus.
On this new version Aveva made this process a lot more user friendly and open
to nearly all users, not only administrators. And the best part: can be done
in a user basis, without change the companys customizations.
And dont forget: you can use the set up made here to install any addin from
now on. You only have to copy the .dll addin file into the
\pml.net\addins\dll and change the .xml file of the module you want the addin
to be used from.
Introduction
I can guess that most of you are eager for typing some come, and all I can
tell if that this time finally arrived. The addin well create in this 4 parts
post will have only the essential code to work on PDMS and a very simple
feature that will inform the current element name in PDMS. Nevertheless youll
learn how to read PDMS attributes, which is very useful to know.
Creating the project
Create a new solution in SharpDevelop called SimpleAddin. Click here if you do
not know how to do this step.
Add the references to the Avevas libraries like I explained here.
On the Project panel right click the MyClass.cs file and choose rename. Type
SimpleAddin.cs as the new name and open it with double click.
Coding
Create some using statements for the libraries you added as reference:
Inside the SimpleAddin class create a property called Description, which will
return the addins description when asked.
Still in the SimpleAddin class create a property called Name that will return
the addin name. This name must be unique and you cant have two addins with
the same name running in PDMS.
Now create a method called Start which will be called when PDMS loads the
addin. When the user clicks on the button or menu that youll create in PDMS
for this addin, what will be called is the command associated with this addin.
The class responsible for managing these commands is called CommandManager, so
the Start method must do this:
Create a variable that poinst to CommandManager class
Create the commands you want to be accessible by the user
Inform CommandManger that these commands exist
public void Start(ServiceManager sm)
{
CommandManager cm = (CommandManager)sm.GetService(typeof(CommandManager));
5
6
Command c = new GetCurrentElementName();
7
cm.Commands.Add(c);
}
To finish the class, create a method called Stop. This method is called when
PDMS stops the addin, for instance, when its closed.
Final words
In the Start method the command is being created from a class
called GetCurrentElementName. This class does not exist yet and will be
responsible for reading the current element name and then sending a message to
the user. Since this class is not created yet you cant compile todays
example. Next week well finish it and then youll be able to compile the
addin and run it in PDMS. Save your project because next week well start from
this point.
y rbasniak / In PML Language, PML.NET / Comments(0)
Introduction
Last week we started a new addin from scratch. We created the class
responsible for exposing the commands the user will be able to call. Today
were going to create the last class we need so this addin can be compiled and
used. Its this class that will do the real work, which in our example, is
show a message to the user with the current element name.
Coding
Add the using statements to Avevas namespaces.
C#
1 using Aveva.ApplicationFramework;
2 using Aveva.ApplicationFramework.Presentation;
3 using Aveva.Pdms.Shared;
4 using Aveva.Pdms.Database;
5 using Aveva.Pdms.Geometry;
Define the namespace and create a class called GetCurrentElementName that
inherits from the Command class.
C#
1 namespace _3dMacro.Pdms.Addins.Tutorials.SimpleAddin
C#
1 using System;
2 using System.Collections.Generic;
3
4 using Aveva.ApplicationFramework;
5 using Aveva.ApplicationFramework.Presentation;
6 using Aveva.Pdms.Shared;
7 using Aveva.Pdms.Database;
8 using Aveva.Pdms.Geometry;
9
1 namespace _3dMacro.Pdms.Addins.Tutorials.SimpleAddin
0 {
1 public class GetCurrentElementName : Command
1 {
1
2
1
3
1
4
1
5
public GetCurrentElementName()
1
{
6
this.Key = "3dMacro.Tutorial.SimpleAddin.GetCurrentElementName";
1
}
7
1
public override void Execute()
8
{
1
string name =
9
CurrentElement.Element.GetAsString(DbAttributeInstance.NAME);
2
0
System.Windows.Forms.MessageBox.Show("The current selected element
2
name is: " + name);
1
}
2
}
2
}
2
3
2
4
2
5
2
6
Conclusion
Like I said in part 1 this addin is very simple in functionality, because this
series goal is to show you the basic code to create a PDMS addin.
You can download the compiled addin at the end of this page, but remember,
this will only work in PDMS 12.1 SP2. If youre using other PDMS version
youll have to download the source code, change Avevas libraries references
to your PDMS version and then compile it.
If youre having trouble to compile the source code, dont worry in the
following weeks Ill make a post about how to compile source code downloaded
from this site.
Introduction
This is the last part of a 3 part series. You can check part 1 here and part
2 here.
In this last part Ill explain to you how and what happens when our addin is
loaded in PDMS. I think its a very important thing to know if you plan to
develop your own addins and even to help you track whats wrong if your addins
arent being loaded by PDMS.
The image above tries to show how the addin we developed is loaded by PDMS.
The events that happens are listed below:
User opens PDMS in the Design module
PDMS looks for an environment variable called CAF_ADDINS_PATH. If it
exists it tries do read the DesignAddins.xml, otherwise it will use the file
that is in the installation folder
This file contains an entry with a DLL filename and path of each addin
that should be loaded. Its this way that PDMS knows where our addin file is
PDMS loads the DLL and search for a method called Start
PDMS runs the Start method, which points to a Command class
PDMS reads the Command class, which tells PDMS that there is a new
command available to the users. This is done through the Key property.
Now the addin is loaded and can be used by any user.
The user should have a button or menu do call the addin. The events that
happens when it happens is described below:
User clicks the button (which was created pointing to the same value as
our Key property in the class)
PDMS searches in its stored commands to see to which class that command
belongs to
PDMS finds that the command is from our GetCurrentElementName class
PDMS runs the Execute method from that class
Addin do its job
Now let us understand the Execute method, which is where the addin does what
he is supposed to do.
The CurrentElement class stores all information about the currently selected
element in PDMS (CE). From it we get an instance of the CE through the Element
property. To finish we call the method GetAsString, which reads an attribute
value and convert it to a string. This method takes as parameter the name of
the attribute we want to read. Whenever you need a reference to an attribute
you can use the DbAttributeInstance. It contains references to nearly all PDMS
attributes. In our example, we used the NAME attribute.
To finish we send a message to the user with the value we read from the
attribute.
Agora vamos entender o cdigo do mtodo Execute, que onde o addin realmente
faz o que se prope.
Conclusion
This is the end of this series. I hope you enjoyed and learned a little bit
about PDMS development. In the future, I will get deeper in how to read the
many types of PDMS attributes. I also plan to make another series expanding
this addin, adding a graphical interface to it. Keep reading and visiting me
every week.