[V8i SS3 C# VBA] How to identify Solid and Hole in Shapes within a Polygon element (elm no 106)

Element.AsShapeElement.IsSolid returning true always.

So I thougth the first subfeature shape always was the exterior and the rest of the subfeature shapes would be interiors --Wrong !!

So how do I find out which one is the outer perimeter and which are inner ??

TIA

Erik

Parents
  • Okay I have solved the problem by calculating the 2D area of each of the shapes. The one with the largest area must be the exterior :-)
    But it would have been nicer if I could get the information from the element itself :-)
  • Hi,
    the vba object model contains the property .IsHole, applicable to specific element types like shapes, ellipses, complex shapes and closed elements.

    To give you an idea how to scan the elements within the active model, here a small vba example:

    Sub HoleSolid()
    Dim ee As ElementEnumerator
    Set ee = ActiveModelReference.GraphicalElementCache.Scan
    Do While ee.MoveNext
        Debug.Print ee.Current.Type
        Call CheckSubElements(ee.Current)
    Loop
    End Sub
    
    Sub CheckSubElements(ele As element)
    Dim ee As ElementEnumerator
    If ele.IsComplexShapeElement Then
        If ele.AsComplexShapeElement.IsHole Then
            Debug.Print ele.FilePosition & " is hole"
        Else
            Debug.Print ele.FilePosition & " is solid"
        End If
    Else
        If ele.IsComplexElement Then
            Set ee = ele.AsComplexElement.GetSubElements
            Do While ee.MoveNext
                Call CheckSubElements(ee.Current)
            Loop
        End If
    End If
    End Sub

    This example works fine for complex structures represented as type 2 groups.
    Please post an example drawing file, if this doesn´t help in your case.
    Best regards,
    Artur

  • Hi

    Artur,

    Thanks for your answer. Yes it is correct that in for instance in a GroupHole Cell-element, one can read the Solid flag.

    But withthe new Polygon_Collection element this is not helping, because here all the shapes (simpel shapes or complex shapes) have the solid flag set to Solid , see the included illustation below. Note that the inner shape in the building has solid set to solid

    The Polygon_collection element (elementType 106) is attached to the root feature and contains no geometry, since all the shapes in the Pollygon_collection are attached as subfeatures to the root feature containing the polygon element.

    I have attached a small bit of technical map with some building on, so you can test. You need to open it in Bentley Map I Guess :-Exampel_Polygon_Collections.dgn

Reply
  • Hi

    Artur,

    Thanks for your answer. Yes it is correct that in for instance in a GroupHole Cell-element, one can read the Solid flag.

    But withthe new Polygon_Collection element this is not helping, because here all the shapes (simpel shapes or complex shapes) have the solid flag set to Solid , see the included illustation below. Note that the inner shape in the building has solid set to solid

    The Polygon_collection element (elementType 106) is attached to the root feature and contains no geometry, since all the shapes in the Pollygon_collection are attached as subfeatures to the root feature containing the polygon element.

    I have attached a small bit of technical map with some building on, so you can test. You need to open it in Bentley Map I Guess :-Exampel_Polygon_Collections.dgn

Children
No Data