Hi @GeorgK,
Sometimes, ModelGeometry of DrawingCurve could be kFaceObject. So, try the following modified VBA code.
Sub Holes_Test()
'open drawing document and
'select one hole. Then run this sample.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSSet As SelectSet
Set oSSet = oDrawDoc.SelectSet
If oSSet.Count <> 1 Then
MsgBox "Select one hole in a drawing"
Exit Sub
End If
Dim oDrawingCurveSegment As DrawingCurveSegment
Set oDrawingCurveSegment = oSSet.Item(1)
Dim oDrawingCurve As DrawingCurve
Set oDrawingCurve = oDrawingCurveSegment.Parent
Dim oFace As Face
Dim oHoleFeature As HoleFeature
If oDrawingCurve.ModelGeometry.Type = kFaceObject Then
Set oFace = oDrawingCurve.ModelGeometry
If oFace.CreatedByFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
Set oHoleFeature = oFace.CreatedByFeature
Debug.Print "Name = " & oHoleFeature.Name
Debug.Print "ExtendedName = " & oHoleFeature.ExtendedName
Debug.Print "ExtentType = " & oHoleFeature.ExtentType
End If
ElseIf oDrawingCurve.ModelGeometry.Type = kEdgeObject Then
Dim oEdge As Edge
Set oEdge = oDrawingCurve.ModelGeometry
For Each oFace In oEdge.Faces
If oFace.CreatedByFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
Set oHoleFeature = oFace.CreatedByFeature
Debug.Print "Name = " & oHoleFeature.Name
Debug.Print "ExtendedName = " & oHoleFeature.ExtendedName
Debug.Print "ExtentType = " & oHoleFeature.ExtentType
End If
Next
End If
End Sub
Please feel free to contact if there is any doubt.
If solves problem, click on "Accept as solution" / give a "Kudo".
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network