Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
' Recursively grabs ObjectIDs of xrefs ' used by HandleToOID Private Shared Function ChildrenGet(i_root As GraphNode, i_Tx As Transaction, myHNDL As Handle, myOwnerHNDL As Handle) As ObjectId For o As Integer = 0 To i_root.NumOut - 1 Dim child As XrefGraphNode = TryCast(i_root.Out(o), XrefGraphNode) If child.XrefStatus = XrefStatus.Resolved Then Dim bl As BlockTableRecord = TryCast(i_Tx.GetObject(child.BlockTableRecordId, OpenMode.ForRead), BlockTableRecord) If bl.Handle = myOwnerHNDL Then 'we found the parent object, now find myHandle Dim myXrefDB As Database = bl.GetXrefDatabase(False) ' check for example on what the number means Using XTrans As Transaction = myXrefDB.TransactionManager.StartTransaction Try Dim myEntOID As ObjectId = myXrefDB.GetObjectId(False, myHNDL, 0) MsgBox(myEntOID.ObjectClass.Name & vbCr & bl.Handle.ToString & vbCr & myEntOID.ToString) Return myEntOID Catch myex As System.Exception MsgBox(myex.Message) End Try End Using Exit For Else ChildrenGet(child, i_Tx, myHNDL, myOwnerHNDL) End If End If Next End Function
Im a bit stuck on the code above.
Depending on how deep the xref nesting goes, it appears that .net will step back out of the code one level at a time.
I can hit this line with a valid ObjectId: Return myEntOID
But when I hit that point, it steps through to End Function, Like I would think it would.
Then goes back to:
Else
ChildrenGet(child, i_Tx, myHNDL, myOwnerHNDL)
Is this normal .net behaviour, How do I exit the function with my value?
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Solved! Go to Solution.