Sub models without entities

Hi,

I need identify sub models without entities.

I am not sure if this is the simplest solution but I am trying to get the result of Submodel.EntityNames, however the EntityNames method has 2 parameters and I don't know how to pass the parameters to the method in order to get a result.

Are you able to advise on this matter?

Regards,

Silvana

  • Hi,

    I think the best way to do this would be to take a look at the count of the submodel.EntityDisplays and if it equals 0 then there are no entities in that submodel.  Here's a sample code:

     

        For Each submdl In mdl.SubModels
            If submdl.EntityDisplays.Count = 0 Then
                Debug.Print submdl.Name
            End If
    
        Next


    In regards to your question with submodel.EntityNames, the first parameter is an array of entity names and the second parameter is the number of entities.  The EntityNames will populate these variables and then you can use them to get the entity names and the number of entities.  So if you were going to use this method you would only need to check the second parameter and if it equals 0. Here's an example of using this method:

        Dim EntNames As Variant
        Dim EntNum As Variant
    
        For Each submdl In mdl.SubModels
            submdl.EntityNames(EntNames, EntNum)
            If EntNum = 0 Then
                Debug.Print submdl.Name
            End If
    
        Next

     
    Regards,
    Stan

  • In reply to Stanley Chan:

    Thank you !
    Silvana