Automating Surface and Edge guided Element Orientation in Mechanical

bhanujjain
bhanujjain Member, Employee Posts: 1 ✭✭✭

Hello,

I am working on a hydrogen diffusion project, wherein I have a microstructure with multiple grains and inflated grain boundaries that are the diffusion pathways within my structure.

Diffusion within these inflated grain boundaries are anisotropic. As such, I need to assign element orientations for each grain boundary. I do not want to assign these orientations to the other bodies in my structure. I have been doing this manually within Mechanical using the surface and edge guide:

My question is that if I can automate/script this element orientation process. I know the names of the bodies/geometries that need orientations. Is this possible to do? Enclosed is the CDB of the microstructure from the photo above. Please let me know if any extra information is needed :smile:

Thank you for your time,
Bhanuj

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 314
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    Hello! I'm not sure if I can help you but someone from @Structures-Scripting-Team might be able to!

  • Abel Ramos
    Abel Ramos Member, Employee Posts: 43
    Second Anniversary 5 Answers 10 Comments 5 Likes
    ✭✭✭✭

    Hello,

    I think you could investigate using Named Selections for automatically applying the Element Orientation

    In the example below, 3 NS have been created for body, face and edge:

    You can automatically create and setup the Details window following these lines:

    elemOrient=ExtAPI.DataModel.Project.Model.Geometry.AddElementOrientation()
    
    nsbody = ExtAPI.DataModel.GetObjectsByName("MYBODY")[0]
    nsface = ExtAPI.DataModel.GetObjectsByName("MYFACE")[0]
    nsedge = ExtAPI.DataModel.GetObjectsByName("MYEDGE")[0]
    
    elemOrient.BodyLocation=nsbody
    elemOrient.SurfaceLocation=nsface
    elemOrient.EdgeLocation=nsedge
    

    After executing those lines, you should see a new Element Orientation object created with its proper assigment

    Best Regards