You're right about nested in current space, I just meant thats where my prog stops.
I lets you change the layer props at any level, because many times you want to freeze or change color of the layer a block is on, asopposed to the entity within the block, which is commonly on layer 0.
I think I have a pattern that will work, this is fun indeed! Here is what I will do:
1) save the array of containier id's from the GetNestedEntity return
2) obtain properties for a given "level", when needed to fill in dialog box, by first getting an object based like this:
Dim obj As Object = CType(tm.GetObject(globalIDArray(level), OpenMode.ForRead), Object)
then finding type with this:
Dim aType As Type = obj.GetType()
Dim ent As Entity = Nothing
Dim blkRef As AcDb.BlockReference = Nothing
Dim btr As AcDb.BlockTableRecord = Nothing
' Time to see if we can process this entity type
Select Case aType.FullName
'Autodesk.AutoCAD.DatabaseServices.BlockTableRecord
Case "Autodesk.AutoCAD.DatabaseServices.BlockReference"
blkRef = CType(tm.GetObject(resCont(0), OpenMode.ForRead, True), AcDb.BlockReference)
Case "Autodesk.AutoCAD.DatabaseServices.BlockTableRecord"
btr = CType(tm.GetObject(resCont(0), OpenMode.ForRead, True), AcDb.BlockTableRecord)
Case Else
ent = CType(tm.GetObject(resCont(0), OpenMode.ForRead, True), AcDb.Entity)
End Select
3) then get props from the objects. (the case else is likely assuming too much, but its not done yet)
So this teaches me a lesson, if you just start with an objectID, you can run down any object in the database, then cast it to the specific type you want. That is the equivalent of the entget in lisp.
I figured out the type detection from an example in the arx sdk, but its obvious once I see the approach (hindsight...20/20...)
Only thing I did not like is that I cannot encapsulate the whole process, and get the specific object back.
I would perfer to do a function like:
public function EntGetNet(byval objID as objectID) as object
but have it return a specific object already cast to the right type.
Is there a way to do that? The return type above is too general I think, but here is where inheritance rules come into play, and the thinking is not yet automatic.
Could I make it so it returns a collection of different object types? I thought there was a way to do that with .net.
That "variant" collection would serve the same purpose as a lisp list, which is powerful in that it stores different data types.
The other thing I'd like to know is how to track back up the nesting tree, if I only start with the bottom level objectID. The data has to be there
so I wonder if the net API gives it to us.
thanks again.