I'm looking to use VB.NET to export a list of catchments and referenced structures, but I can't find any way to get the referenced structure using the api's Catchment object. Am I missing something?
The attached image shows the "data" I'm looking to access via .NET
Nope. The way I ended up getting information for the catchment is to add the information to the catchment label, explode it, read the resulting value. I do this in a transaction and then don't commit it.
You can also try to get the info through reflection and finding the correct dll to load the method from, but that is way over my head unless I have like 8+ hours to kill.
Ah, well I'm glad I'm not missing something. Thanks for the idea RE: exploding a label - that would definitely be the fastest workaround!
Hi,
You may find this tool - snoopdb- is helpful for your investigation:
http://adndevblog.typepad.com/infrastructure/2013/04/snoop-civil-3d-2014-database.html
Hi,
Well, I know you have already solved it, but follow the code to do that.
Private Sub GetStructureInCatchment () Dim DocCAD As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim DocCivil As Autodesk.Civil.ApplicationServices.CivilDocument = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument Dim DataCAD As Database = DocCAD.Database Dim EditorCAD As Editor = DocCAD.Editor Dim SelectionCat As New PromptEntityOptions("select your Catchment ") SelectionCat.SetRejectMessage("") SelectionCat.AddAllowedClass(GetType(Autodesk.Civil.DatabaseServices.Catchment), True) Dim TrechoSel As PromptEntityResult = EditorCAD.GetEntity(SelectionCat) If Not TrechoSel.Status = PromptStatus.OK Then Exit Sub End If Using docLock As Autodesk.AutoCAD.ApplicationServices.DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument() Using TransCAD As Transaction = DataCAD.TransactionManager.StartTransaction Dim Cat As Catchment = TransCAD.GetObject(TrechoSel.ObjectId, OpenMode.ForRead) Dim CatLB As CatchmentLabel = TransCAD.GetObject(Cat.GetAvailableCatchmentLabelIds(0), OpenMode.ForRead) Dim LB As LabelStyleTextComponent = TransCAD.GetObject(CatLB.GetTextComponentIds(0), OpenMode.ForWrite) LB.Text.Contents.Value = "<[Reference Pipe Network Structure]>" Dim ListOBJExploded = FullExplode(CatLB) For Each ent As Entity In ListOBJExploded If ent.GetType = GetType(DBText) Then Dim text As DBText = TryCast(ent, DBText) ' Alert with your structure :) MsgBox(text.TextString) End If Next End Using End Using End Sub Private Function FullExplode(ByVal ent As Entity) As List(Of DBObject) Dim fullList As List(Of DBObject) = New List(Of DBObject)() Dim explodedObjects As DBObjectCollection = New DBObjectCollection() ent.Explode(explodedObjects) For Each explodedObj As Entity In explodedObjects If explodedObj.[GetType]() = GetType(BlockReference) OrElse explodedObj.[GetType]() = GetType(MText) Then fullList.AddRange(FullExplode(explodedObj)) Else fullList.Add(explodedObj) End If Next Return fullList End Function