[VBA] Test if selected element is root feature or subfeature

I wanna know If there is root feature or subfeature in element enumerator.

    Dim ee As ElementEnumerator
    Set ee = ActiveModelReference.GetSelectedElements
    
    While ee.MoveNext
    
        Dim feat As New xft.feature
        Set feat = xft.CreateFeature(ee.Current)

In code above feat is always root feature even if ee.Current is subfeature.

Is there any way to know if ee.Current is root feature or subfeature?


       
   

Parents Reply
  • Hi,

    Unknown said:
    My files are corrupted

    I have no experience with such situation, but I in my opinion if the file is corrupted (I guess it relates to a problem you decribed here), you cannot rely on some (many?) methods (which probably rely on relations defined by uuids).

    I think the solution depends on specific condition of your project, but there is a possibility it cannot be solved using VBA only and MDL API has to be used. I found xfmElement_getFeatureUuids that returns both parent and subfeatures ID. I guess if there is no parent uuid returned, the feature is the root feature.

    Unknown said:
    I think that VBA command Set ModelReference = object.Copy (SourceModel, Name [, Description]) is the cause of our corrupted files

    For what purpose do you use this method? You maybe right as this is MicroStation VBA API, which is probably not aware of internal strcuture and rules like uuids.

    With regards,

      Jan

Children
No Data