cancel
Showing results for 
Search instead for 
Did you mean: 

Check if an FE.Element is group-orphan?

Phenom
Phenom

to all

 

Is there an easy way of checking if some FE elements are group-orphan ie if an element does not belong to a group?

 

Thinking about a few line of codes to create a group containing all the elements (in a fem or afm) that are not already in a group ie orphan

 

any ideas?

 

Thanks

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
25 REPLIES

Re: Check if an FE.Element is group-orphan?

Genius
Genius

Hi selex,

 

you could use a List (Of T).

 

Dim MyList As New List(Of Integer)

'Put your grouped Element IDs into that List: MyList.Add(EID1) MyList.AddRange(Some_EIDs) 'afterwards check this: if( Not MyList.Contains(EID_to_check)) then 'do sth End

regards,

MGeyer

Re: Check if an FE.Element is group-orphan?

Phenom
Phenom

Thanks

 

Thought that maybe there was an option somewhere (like a property) similar to layer. I think the work flow could be something like that

 

loop through each group in the .fem/afm
 loop through each object in the group
   if obj  = CAE.FEElement then add to ListElmInGroup(of Integer)
 next obj
next group

 

create TheElementLabelMap
for each label in TheElementLabelMap
 if Not (ListElmInGroup.Contains(label) Then add the label to ListElmNotInGroup(of Integer)
 

create group "OrphanFEM" with ListElmNotInGroup

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Check if an FE.Element is group-orphan?

Siemens Phenom Siemens Phenom
Siemens Phenom

This may be a bit more complicated depending on how you define an element being in a group. If the group contains a mesh object, do you consider all of the elements in the mesh to be in the group or not? If so, you need to remove all of the elements related to the mesh from your list of elements.

Re: Check if an FE.Element is group-orphan?

Phenom
Phenom

Haven't tought about that!

just managed code the back bone of a programm. Will test later

At the moment I am working at the element level

if I do something like that

 

For Each obj As TaggedObject In theCAEGroup.GetEntities()		 
  If TypeOf (obj) Is CAE.FEElement Then add to list

then it should deal with all the elements

 

I do get your point however about the mesh object. I believe that if an mesh object belongs to a group then all the associated elements will automatlically belon to the group

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Check if an FE.Element is group-orphan?

Siemens Phenom Siemens Phenom
Siemens Phenom

"I believe that if an mesh object belongs to a group then all the associated elements will automatlically belon to the group"

 

This statement is not accurate. Groups are designed to be as lightweight as possible. Ideally, meshes are added to groups where possible, rather than individual elements. Group operations on a group that contains 5 meshes, each having 100k elements will be much faster than operations on a group that contains 500k elements.

 

If you query a group containing a mesh, the only object returned is the mesh, not the individual elements. Display wise, a group containing a mesh appears to contain all of the elements in the mesh, because displaying the mesh displays all of the elements.

Re: Check if an FE.Element is group-orphan?

Phenom
Phenom

Ok. Didn't know that but I think it kind of make sense

So indeed one would need a check if the object is a mesh. Working assumption would that all the elements belonging to a Mesh "belong" to the group and then add all the elements label to the ListElementInGroup()

 

is there a simple way of getting all the elements belonging to a Mesh?

 

Thanks

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Check if an FE.Element is group-orphan?

Siemens Phenom Siemens Phenom
Siemens Phenom

NXOpen.CAE.SmartSelectionManager.CreateRelatedElemMethod()

Re: Check if an FE.Element is group-orphan?

Phenom
Phenom

Thanks JimB

 

May have to think about dealing with Mesh then...

 

Looks like the .CreateRelatedElemMethod() returns a variable of type 'As RelatedElemMethod'

Does one then needs to use the .GetElements() and then loop through each CAE.FEElement to get the label or is there a more direct way of getting the labels?

 

Thanks

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Check if an FE.Element is group-orphan?

Siemens Phenom Siemens Phenom
Siemens Phenom

Correct. Use .GetElements() and loop through the elements to get their labels.

 

Note that if the intent is to build a group of elements not in other groups, you'll ultimately need the element objects anyway. Your list should be of type CAE.FEElement, not integer. You can compare CAE.FEElement objects in the list to CAE.FEElement objects in existing groups or CAE.FEElement objects related to meshes. Then you can directly use that list to add objects to a new group. That removes the need for getting an ElementLabelMap and looping through it.