Hello everyone in the community,
I have a question:
I have a project created with CDF and the assets are already contextualized with the P&IDs. I received new revisions of plans.
My question is, do I have to contextualize everything again and what has already been contextualized is lost? Is there a way to only upload the new plans in the new revisions and have it done automatically?
Solved
Update contextualization of plans with assets
Best answer by Que Tran
You can use list annotations for a file with List annotation Python SDK. Sample code:
# List all annotations for the file with id=123:
from cognite.client import CogniteClient
from cognite.client.data_classes import AnnotationFilter
client = CogniteClient()
flt = AnnotationFilter(annotated_resource_type="file", annotated_resource_ids=[{"id": 123}])
annotations = client.annotations.list(flt, limit=None)
and then add annotations to a new file with Create an annotation. Sample code:
new_file_id = 234
for ann in annotations:
ann.annotated_resource_id = new_file_id
client.annotations.create(annotations)
Best regards,
Que Tran
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.