Hi Guys !
I would like to learn how to cast an object into another object of a different type, if it's possible...
In my case, I want to cast an ObjectId in a AecWall and get length of the current wall...
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AEC.Interop.ArchBase
Public Class Class1
<CommandMethod("Class1")> _
Public Sub Class1()
'' Get the current document and database, and start a transaction
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Block table record for read
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
'' Open the Block table record Model space for read
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForRead)
Dim myWall As New AecWall
'' Step through each object in Model space and
'' display the type of object found
For Each acObjId As ObjectId In acBlkTblRec
If acObjId.ObjectClass().DxfName = "AEC_WALL" Then
'Get wall length here
End If
Next
'' Dispose of the transaction
End Using
End Sub
End Class
Thanks in advance !