Cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the method GetEntities for mass region in API

Pioneer
Pioneer

Hi,

 

I'm requesting a list of elements associated with a mass region in my model using the GetEntities method (Chapter 5.17.2.3 in Help).  

However the method doesn't seem to do its job. Following the exact example in the manual i get an Object (that cannot be declared Set object by the way) that is simply a list from 1 to N. Instead of referencing massregion elements the list always starts from 1. Am I missing something or is this possbily a bug?

 

BR,

Kris

2 REPLIES

Re: Problem with the method GetEntities for mass region in API

Siemens Phenom Siemens Phenom
Siemens Phenom
Unfortunately, the documentation example is incorrect. The GetEntities() method does not return a Set object but instead returns a Sort object. In this way, this allows the method to provide information about the order entities are selected into the object, their IDs, associated faces and expansion status. It does however make retrieval a bit more complex. If you refer to the documentation on the Sort object (4.7) you will see it has a number of properties. In this case,
nInt1 = the Element ID
nInt2 = the Element Face (if any)
nInt3 = the expansion status (not really used for elements)

So, by walking thru the Sort object, you can retrieve the element IDs thru the nInt1 property. Here is some sample code that does that and stores the IDs into a Set object.

We will correct the docs for the next release, and possibly add a new method to just get a Set of the entity IDs directly from the Connection Region.


Sub Main
Dim App As femap.model
Set App = feFemap()

Dim regn As femap.ConnectionRegion
Set regn = App.feConnectionRegion

Dim sorts As femap.SortSet
regn.Get(1)
Set sorts = regn.GetEntities( FT_ELEM, True )

Dim s As femap.Set
Set s = App.feSet
While sorts.Next() <> FE_FAIL
s.Add( sorts.nInt1 )
Wend

End Sub

Re: Problem with the method GetEntities for mass region in API

Pioneer
Pioneer

Thanks for the help!

 

-Kris