Showing results 1 to 5 of 5

Thread: SystemModelGroup for variable

  1. #1

    Default SystemModelGroup for variable

    Hi All

    I'm using zenon v 7.11.
    Is it possible to get a property of variable "SystemModelGroup" in Runtime with VSTA?
    This property is existing in DynProperties of variable but I can't get its value or text.

    Best regards,

    Dmitry

  2. #2
    Join Date
    20.08.2009
    Posts
    293

    Default AW: SystemModelGroup for variable

    Hi,

    what you should get from the DynProperty SystemModelGroup is a string of semicolon separated Guids.
    These Guids you can also find in the Equipment Model structure of the project.

    See attached *.txt file (rename it to *.cs or copy the content)/helper classes which parses the equipment model structure of the project and returns a dictionary of Guids and the readable values.
    EquipmentModelHelper.txt

    The only thing left you need to do is then to resolve the Guid from your variable with the Guid from the dictionary, with a function like below:
    private String GetEquipmentGroupStringByGuids(String pEquipmentGroupGuids)
        {
          if (String.IsNullOrEmpty(pEquipmentGroupGuids))
            return String.Empty;
    
          //Separate the Guids, store in array
          String[] equipmentGroupGuidArray = pEquipmentGroupGuids.Split(';');
          String equipmentGroupString = String.Empty;
    
          //Iterate through the array
          int index = 0;
          foreach (string guid in equipmentGroupGuidArray)
          {
            //Get the equipment group string for the given guid
            String currentEquipmentGroupString;
            equipmentGroups.TryGetValue(new Guid(guid), out currentEquipmentGroupString);
    
            //If the equipment group can be found (not deleted in zenon)
            if (currentEquipmentGroupString != null)
            {
              //Add ";" before each substring (exclude first one)
              if (index > 0)
              {
                equipmentGroupString += ";";
              }
              equipmentGroupString += currentEquipmentGroupString;
              index++;
            }
          }
          return equipmentGroupString;
        }




    Regards,
    Bernhard
    Last edited by bernhardf : 31st March 2015 at 07:21

  3. #3

    Default Re: SystemModelGroup for variable

    Bernhard,

    Thank you for this example.
    I am in ecstasy of this code

    I will try it.
    Why is it so difficulty? I only want to get a string

    Best regards,

    Dmitry
    Attached Thumbnails Attached Thumbnails equo_mod.png  

  4. #4

    Daumen hoch Re: SystemModelGroup for variable

    Hello Bernhard,

    Your code works fine. Thank you very much.

    Best regards,

    Dmitry

  5. #5
    Join Date
    20.08.2009
    Posts
    293

    Default AW: SystemModelGroup for variable

    You are welcome

Similar Threads

  1. Replies: 4
    Last Post: 11th March 2019, 16:26
  2. Replies: 1
    Last Post: 2nd August 2011, 10:21
  3. Replies: 1
    Last Post: 23rd July 2011, 08:51

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •