cancel
Showing results for 
Search instead for 
Did you mean: 

NX Open Python - Get the FE Elements of a Boundary Condition

Creator
Creator

 

Dear All,

 

since it took me quite some time

  1.) I would like to share my solution and

  2.) I would like to ask if there is a more efficient solution to this.

Here is what I did so far: Thanks to this post: https://community.plm.automation.siemens.com/t5/NX-Programming-Customization/Selectionfilter-for-FE-... I have managed to get the Elements (NXOpen.CAE.FEElements) of a Boundary Condition (NXOpen.CAE.SimBc) as follows:

 

session = NXOpen.Session.GetSession()

for bc in session.Parts.BaseWork.Simulation.ActiveSolution.GetBcs():

    elems = []

    for i in range(bc.TargetSetManager.TargetSetCount):

        _, entry = bc.TargetSetManager.GetTargetSetMembers(i)
            for j in range(len(entry)):
                _type = type(entry[j].Obj)
                if _type in [NXOpen.CAE.CAEBody, NXOpen.CAE.CAEFace, NXOpen.CAE.CAEEdge]:

                    selectionMgr = session.Parts.BaseWork.SmartSelectionMgr
                    elems.extend( selectionMgr.CreateRelatedElemMethod(entry[j].Obj).GetElements() )

                    // do stuff with elems