How to find the ID of the parent objects that define an edge path Construction geometry?

Options
Kev
Kev Member Posts: 41
First Anniversary 5 Likes First Comment Name Dropper
edited March 2023 in General Language Questions

Hi guys

First time using this forum. Could someone tell me if it is possible to find the part that was used to create a path? i notices that the path can retain reference to the edge that it was created form but when going through all the properties associated with the path for the life of me I could not find a clue to he ID of the edge or part. any help on this regard will be so appreciated :)

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
    edited March 2023 Answer ✓
    Options

    Hi @Kev , I believe this is not something that can be obtained in a straightforward way. The solution I could think of is to:

    • Extract the Start and End locations in the path, and the number of sampling points
    • Compute the set of expected coordinates from this info
    • Use MeshData (Model.Analyses[0].MeshData) to find the nodes closest to these coordinates
    • Use GeoData and MeshData.MeshRegionById to find to which bodies these nodes belong to.

    The above is for a path created by two points. If your path is created by scoping an edge, then my_path.Location returns the ID of the edge. Then you will have to loop on all edges in GeoData to find to which body this edge belongs to. This post should help with GeoData: https://discuss.ansys.com/discussion/comment/591#Comment_591

Answers

  • Kev
    Kev Member Posts: 41
    First Anniversary 5 Likes First Comment Name Dropper
    Options

    Thanks a million @Pernelle Marone-Hitz :) luckily the paths are created by scoping edges. The '.Location' method did the trick :)I'm having a look at the GeoData as well and it is very useful for what I may need to do next. I hope it's ok if I posted here again if needed more help on this.

    Cheers

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

    Glad I could help you @Kev ! Sure, feel free to follow-up here if needed.

    One important thing to understand with geometry in Mechanical : there are two sorts of "geometry" with different sets of IDs:

    • The bodies in the Mechanical tree have their own ID, as objects of the Mechanical tree, pretty much like a fixed support boundary condition, or any other object in the tree, will have an ID. These objects are grabbed by ExtAPI.DataModel.Project.Model.Geometry.Children
    • The "real" geometry (the one that is plotted, which you can zoom, rotate, pan, select bodies, faces, edges on etc) also have their sets of ids (there are IDs for bodies, faces, edges, vertices, etc). These objects are grabbed by ExtAPI.DataModel.GeoData

    There are ways to get the IDs of the geodata geometry from the tree geometry and the other way around:

    my_tree_body = ExtAPI.DataModel.Project.Model.Geometry.GetBody(my_geobody)
    my_geo_body = my_tree_body.GetGeoBody()
    


  • Kev
    Kev Member Posts: 41
    First Anniversary 5 Likes First Comment Name Dropper
    Options

    Thanks Again Prenelle for your very helpful replies. I did have a go at utilizing the geodata method but to no avail.

    Was hoping to seek your guidance on how to provide multiple bodies in a named selection for a User Defined Result for the geometry input. the result plot is set up in the following setting: Expression=SX , Scoping method (path)

    the result plot requires an additional input called Geometery. I believe it is needed for the application to know what coordinate system to align the tensor stress results to. At the moment I am having difficulties providing this filed with the predefined body geometries in the name selections.

    the plot has only one .Location field and it is occupied by the ID of the Path (there is also an IDs field) which seems to be occupied with the .Location values of the path!!

    It is hard for me to explain but maybe the image attached can explain a bit better:

    It is probably worth saying that the ID of the bodies i have provided for the plot are [10, 15]. I first thought the .Ids value would correspond to the geometry field but even after changing the bodies manually i did not withness a change in the .Ids value.

    So basically I don't know where to look for the Geometery proprty.

    Have I confused you too much? any chance you know where I'm going wrong?

    I appreciate any help.

  • Kev
    Kev Member Posts: 41
    First Anniversary 5 Likes First Comment Name Dropper
    Options

    Hey I managed to do it cheating from macro recording :) . Just wanted to let you know before you put too much on it :)

    Cheers Pernelle

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

    Hi @Kev , thanks a lot for letting me know you were able to resolve the issue. Recording is an awesome functionality :-) Indeed when defining a result on a path you'll indeed have to provide both the path and the bodies that this path intersects. I had created a post about this but realized it's not that easy to find it: https://discuss.ansys.com/discussion/157/using-act-how-can-i-create-a-result-plot-scoped-to-a-path-and-a-specific-body