Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Ansys Scripting: How to probe the what the edge IDs of a given face ID are

TAGGED: 

    • cbarlow
      Subscriber

      I'm very new to ansys scripting, so this may be a trivial question, but I couldn't find it asked anywhere else and have hit a roadblock.

      Background: I would like to create individual named selections for coplanar holes in a solid body, with the context of the holes being a bolt pattern. I would like the user to only have to specify a radii range and a coordinate range (pick all coplanar holes of a given size).

      Currently I have a script (attached) that creates a named selection for all holes (faces) on the body that meet the criteria. I envisioned the following next steps:

      • Generate a list of all the face IDs in the named selection I created
      • Search for which face IDs share edge IDs (which cylindrical faces are part of the same hole)
      • Create a named selection for those two faces that share an edge
        • Do this for all face IDs in the list without repeating 
      • Once a named selection has been generated for each hole I would delete the original named selection that included all the holes

      I am currently stuck on the second bullet. I can't figure out a way to investigate the edge IDs of a given face ID, and compare those to the edge ID of all other face IDs. Any guidance or feedback on a different approach would be appreciated.

    • ErKo
      Ansys Employee

       

       

       

       

       

       

      Hi

      Faces have a property called Edges – see the workbench and the extension examples ACTExtensionExamples.zip\TraverseExtension.

      Before that from the ids in the ns shown, one needs to get the geobody data using those Ids (https://discuss.ansys.com/discussion/435/what-are-the-methods-to-retrieve-geo-bodies-and-tree-bodies),

      and then one can use the Edges property to get all edges belonging to that face.

      So below is an example on how to get the first face in the list of faces from ns and then the edges belonging to that face (medg called):

      mf=ExtAPI.DataModel.GeoData.GeoEntityById(ns.Location.Ids[0])
      medg=mf.Edges

      For more help I would suggest to post script questions in the dedicated for scripting forum (discuss/ansys)

      All the best

      Erik

       

       

       

       

       

       

    • cbarlow
      Subscriber

      Thank you for the prompt reply and clear answer Erik! This is exactly what I was looking for.

      I'll be sure to move future script questions to the location you recommended. Would you be able to clarify where I can find that ACTExtensionExamples.zip folder you recommended referencing? I'm not sure how to access this, but would appreciate more examples.

    • ErKo
      Ansys Employee

      Hi

      Great to hear that it helped.

      The dedicated for scripting forum (discuss/ansys) is great, and we can post questions there, but it also has many many script examples (we can search in there) that might be of help.

      As for the ACTExtensionExamples.zip, we can download it via Workbench, and in the project schematic, below the main menus, there are some toolbar buttons.

      Click on the one called ACT Start Page. A new Page will load onto the project schematic. There click under Download Examples on Extension Examples (see here for an image: ACT extension image). 

      All the best

      Erik

    • cbarlow
      Subscriber

      Thank you again for the help Erik.

      I have another follow up question. I tried to ask a question over on the developer forum like you suggested, but I cannot find any way to either ask a question on that forum or even engage with other questions via comments. Im not sure if there's some basic functionality im just ignorant of, or if theres a type of profile you need to interact on that forum. Ive attached screenshots of what I see on my end when logged into the forums:

      I would like to use the forums like you suggested, but I can't find anyway to interact/engage on the platform at the moment.

      • ErKo
        Ansys Employee

        Hi

        Please read this post in order to activate your account and so to be able to submit a question (it is all explained here):

        https://discuss.ansys.com/discussion/4341/attention-new-users-read-this-post-before-doing-anything

        All the best

        Erik

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]