Ansys Mechanical ACT, Access to the properties of a Child-Object

av
av Member Posts: 10
First Comment
**

Hello all!
I would like to know, whether it is possible and how to query the properties of a child-object with the use of an other child-objects reference.

Wha I want, is, to get access to the properties of the CH_2 object, using the reference of the CH_1 object (for example using the passed object reference in the ongenerate callback function of the CH_1 object).
(I have made several attempts with CH_1.Parent.Childen and CH_1.Parent.InternalObject.Children, however, I get back a ComObject as a refernece without access to the properties)
Thank you for your help!

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee, GitHub-issue-creator Posts: 327
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited December 2024 Answer ✓
    child2_tree_object = Tree.FirstActiveObject
    child2 = ExtAPI.DataModel.GetUserObjectById(child2_tree_object .ObjectId)
    parent = child2.Parent
    child1 = list(parent.Children)[0]
    for prop in child1.Properties:
        print prop.Value
    

Answers

  • av
    av Member Posts: 10
    First Comment
    **

    Dear Landon,
    Thank you for your quick response. I could also print the properties with the ongenerate function of my child-object. (The key was the second line of your code with the GetUserObjectByID function.)
    Best regards,
    av