Skip to content

Access PI Point from AF Attribute #612

Answered by Hugovdberg
Hugovdberg asked this question in Q&A
Discussion options

You must be logged in to vote

This is linked to issue #528. Currently it isn't implemented in PIconnect yet, so in the meantime it is probably best to use something like this:

import PIconnect as PI

with PI.PIAFDatabase() as db:
    elem = db.descendant(r"Some\Path\To\An\Element")
    attr = elem.attributes["Interesting attribute"]
    # Here it gets a little dirty:
    data_ref =attr.attribute.DataReference # returns the data reference for the underlying .NET AFAttribute
    if data_ref.Name == "PI Point":
        pi_point = PI.PI.PIPoint(data_ref.PIPoint) # construct a python PIPoint object from the returned .NET object
        print(pi_point.description)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Hugovdberg
Comment options

Hugovdberg Dec 22, 2022
Maintainer Author

Answer selected by Hugovdberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant