Greetings! I have some sdf-file with objects(lines) and every line has attributes(e.g featId and Name). I have a code resolving my issue but only with selection all objects. I wanna get the names of lines without selecting objects(e.g when I run my custom pallete which has a combobox filled with list of names of these lines). Is it possible to get attribute data of object on map without selecting objest?
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Dim listOfNames as List(Of String) = New List(Of String) Dim ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor Dim currentMap As AcMapMap = AcMapMap.GetCurrentMap() Dim layers As MgLayerCollection = currentMap.GetLayers() Dim selResult As PromptSelectionResult = ed.GetSelection() If selResult.Status = PromptStatus.OK Then Dim selSet As SelectionSet = selResult.Value Dim selectionBase As MgSelectionBase = AcMapFeatureEntityService.GetSelection(selSet) Dim myLayer As MgLayerBase = Nothing For Each layer As MgLayerBase In selectionBase.GetLayers() If layer.Name = "MapOfRoad" Then myLayer = layer Exit For End If Next If myLayer Is Nothing Then ed.WriteMessage("No Feature is selected from the designated Layer ! ") Return End If Dim reader As MgFeatureReader = selectionBase.GetSelectedFeatures(myLayer, myLayer.FeatureClassName, False) Try While reader.ReadNext() Dim featureName As String = reader.GetString("NameRoad") listOfNames.Add(featureName) End While Finally reader.Close() End Try End If End Sub
You can retrieve any attribute present in the sdf. The issue is what do you want to do with it after you retrieve, isolate, identify, highlight, stylized, colorized, or manipulate the geometry related to that value? You must provide the 'big picture' of what you want to accomplish because that will determine how to get values from objects on your Map.
Can't find what you're looking for? Ask the community or share your knowledge.