dm-script

How can I list all tag details in a TagGroup file using the Python API?


I'm working with a TagGroup file (with a .gtg extension) that contains multiple layers of information. For example, my file looks like this:

top_layer:mid_layer1,true
top_layer:mid_layer2,'abc'
top_layer:mid_layer3,123

In dm-script, I can retrieve all tag details by combining functions such as TagGroupCountTags(), TagGroupGetTagLabel(), TagGroupGetTagTypeLength(), TagGroupGetTagType(), and TagGroupGetTagAsTagGroup(). However, the Python API for dm-script appears to have far fewer commands related to TagGroup operations.

My question is: Is it possible to list all the tag information (including labels, types, and values) in a TagGroup file using the Python API? If so, what functions or approach should I use?

Any guidance or examples would be greatly appreciated.


Solution

  • In GMS 3.6.0 (latest released version) tagGroups map to Python dictionaries and can be used as such, which should make it easy to use. However, I'm personally not a Python expert and don't have example code at hand. :c)

    (Earlier versions of GMS handle TagGroups in Python differently.)