AdvancedHMI Software
General Category => Support Questions => Topic started by: sds5150 on March 31, 2020, 11:28:03 AM
-
I have a user defined data type that has a large number of members. Is it possible to get a list of the members names?
I would like to be able to export this list to a spreadsheet.
I have found that I can list tags using the following, but that doesn't give me a way to list the members within a UDT tag.
Dim CLXTag() As MfgControl.AdvancedHMI.Drivers.CLXTag
CLXTag = _EthernetCommsMain.GetTagList()
Thanks!!
-
1. Is there a way to get member tag names of a UDT?
2. With the current version, will it do read/write to sub UDTs [I have not tried it yet]
-
It looks like you would need to know the members of UDT, see these topics and also search the forum:
https://www.advancedhmi.com/forum/index.php?topic=2545.0
https://www.advancedhmi.com/forum/index.php?topic=2112.msg14373#msg14373
Also see the wiki:
https://advancedhmi.com/documentation/index.php?title=WriteUDT
-
1. Is there a way to get member tag names of a UDT?
2. With the current version, will it do read/write to sub UDTs [I have not tried it yet]
Read/Write to UDT within a UDT does work
Public Class DateTimeUDT
Public Year As Integer
Public Month As Integer
Public Day As Integer
Public Hour As Integer
Public Minute As Integer
Public Second As Integer
Public mSec As Integer
Public StrArr(1) As String
Public Limits As New Limits
End Class
Public Class Limits
Public LowLimit As Single 'Double, Decimal
Public Hi_Limit As Single
End Class
...
Dim DTCurrent As New DateTimeUDT
DTCurrent.Year = 2021
DTCurrent.Month = 12
DTCurrent.Day = 12
DTCurrent.Hour = 12
DTCurrent.Minute = 12
DTCurrent.Second = 12
DTCurrent.mSec = 12
DTCurrent.StrArr(0) = "Haha"
DTCurrent.StrArr(1) = "Haha22"
DTCurrent.Limits.LowLimit = 2.2
DTCurrent.Limits.Hi_Limit = 4.4
PLC.WriteUDT("DTCurrent", DTCurrent)
-
Added a string with custom length, it still read good!
Now, if only Archie can take one step further like Ingear. NET.LOGIX can browse all Controller & Program Scope PLC tags including UDT's, nested UDT's, arrays of UDT's and arrays of nested UDT's. See our TagBrowse example.
http://ehelp.ingeardrivers.com/netlogix7/WebHelp/Tag_Browse_Project.htm
-
Another thought, maybe someone can quickly develop this:
read in the xml file from Logix program.L5X.
Next, generate a PLC file contains all classes from the <DataTypes>
Then, enumerate a PLCtag file consists of all tags from <Tags>
All tags are now avail. for use.
-
He wants it all in a spreadsheet and RSLogix 5000 does allow all the tags be exported as CSV file:
https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1756-rm084_-en-p.pdf
Then he can open either L5X or L5K file in a Notepad and manually type in all UDT members into the spreadsheet.
-
not sure if that's any better.
-
It's a procedure that anybody can perform.
Other suggestions for listing UDT members are currently wishful thinking.
-
Now, if only Archie can take one step further like Ingear. NET.LOGIX can browse all Controller & Program Scope PLC tags including UDT's, nested UDT's, arrays of UDT's and arrays of nested UDT's. See our TagBrowse example.
http://ehelp.ingeardrivers.com/netlogix7/WebHelp/Tag_Browse_Project.htm
Coming soon. I posted a demo application showing capabilties:
https://www.advancedhmi.com/forum/index.php?topic=2835.0
-
Archie,
Besides for the IP, how do you specify a path in the browser (does it assume any specific path)?
Can you post the whole solution?
-
For the record, this is the code that populates the tree. It uses a recursive subroutine so it can drill into inifinte layers
Private Sub Button1_Click_8(sender As Object, e As EventArgs) Handles Button1.Click
Dim y() As AdvancedHMI.Drivers.CLXTag = EthernetIPforCLXCom1.GetTagList
For i = 0 To y.Length - 1
Dim Node As New TreeNode(y(i).TagName)
TreeView1.Nodes.Add(Node)
AddSubNode(Node, y(i).UDTStructure)
Next
End Sub
Private Sub AddSubNode(node As TreeNode, UDTstructure As AdvancedHMI.Drivers.CIP.CLXTemplateObject)
If UDTstructure IsNot Nothing Then
For i = 0 To UDTstructure.Members.Count - 1
Dim SubNode As New TreeNode(UDTstructure.Members(i).Name)
node.Nodes.Add(SubNode)
AddSubNode(SubNode, UDTstructure.Members(i).SubTemplate)
If UDTstructure.Members(i).SubTemplate IsNot Nothing Then
SubNode.Text &= " (" & UDTstructure.Members(i).SubTemplate.Name & ")"
End If
Next
End If
End Sub
-
Neat.
-
Now, if only Archie can take one step further like Ingear. NET.LOGIX can browse all Controller & Program Scope PLC tags including UDT's, nested UDT's, arrays of UDT's and arrays of nested UDT's. See our TagBrowse example.
http://ehelp.ingeardrivers.com/netlogix7/WebHelp/Tag_Browse_Project.htm
Coming soon. I posted a demo application showing capabilties:
https://www.advancedhmi.com/forum/index.php?topic=2835.0
Thank you for adding the feature. AAHMI could now be #1 contender!