How can I get the node/vertex coordinates for defined springs in ANSYS Mechanical using scripting?

Options
TreeofWinter
TreeofWinter Member Posts: 2
First Comment
edited June 3 in Structures

[{"insert":"Please include the following if applicable:\nCopy\/paste of piece of code in question"},{"attributes":{"list":{"depth":0,"type":"bullet"}},"insert":"\n"},{"insert":"Screenshot of error message"},{"attributes":{"list":{"depth":0,"type":"bullet"}},"insert":"\n"},{"insert":"What you've tried so far to debug"},{"attributes":{"list":{"depth":0,"type":"bullet"}},"insert":"\n"}]

Best Answers

  • Abel Ramos
    Abel Ramos Member, Employee Posts: 35
    5 Likes First Answer First Comment First Anniversary
    edited June 6 Answer ✓
    Options

    Hello, I think you could take the Location coordinates from reference and mobile attachments

    Something like this should help you to start:

    AllSprings = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Spring)
    
    for spring in AllSprings:
        print("X Ref = ",spring.ReferenceXCoordinate)
        print("Y Ref = ",spring.ReferenceYCoordinate)
        print("Z Ref = ",spring.ReferenceZCoordinate)
        print("X Mob = ",spring.MobileXCoordinate)
        print("Y Mob = ",spring.MobileZCoordinate)
        print("Z Mob = ",spring.MobileYCoordinate)
    

    Best Regards

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 130
    First Answer Name Dropper First Anniversary Ansys Employee
    edited June 6 Answer ✓
    Options

    Just to add that the above script also works for direct attachments on nodes or vertices.

    Hope this helps.

    Erik