How do I access coordinates of a vertex?

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 831
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

How do I access coordinates of a vertex?

Tagged:

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 831
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    First, access the vertex through GeoData, for example through its Id like:

    geoData = ExtAPI.DataModel.Project.Model.Analyses[0].GeoData
    vertex = geoData.GeoEntityById(27)
    

    Then the coordinates can be accessed with:

    vertex.X
    vertex.Y
    vertex.Z
    

Answers

  • Akane Ito
    Akane Ito Member Posts: 25
    First Comment Name Dropper
    Options

    The coordinates are in meters, so how can I obtain them in millimeters?

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 165
    First Comment First Answer Name Dropper First Anniversary
    edited May 13
    Options

    Hi - from geodata the units are as far as I can see always in meters (m). So easiest is just to multiply the above script by 1000, if one wants it in mm.

  • Akane Ito
    Akane Ito Member Posts: 25
    First Comment Name Dropper
    edited May 22
    Options

    @Erik Kostson
    Dear Erik,Thank you!
    May I ask one more question?
    Can coordinates be obtained with reference to an arbitrary coordinate system?

  • TreeofWinter
    TreeofWinter Member Posts: 4
    Name Dropper First Comment
    Options

    vertex.X

    I got the following error:
    'NoneType' object has no attribute 'X'
    What could be wrong, please?