Message 1 of 3
SelectionSet Error
Not applicable
11-18-2011
04:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the below code to get all the selected objects in a selection, Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput _ Public Sub SelectObjectsOnscreen() '' Get the current document and database Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database '' Start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() '' Request for objects to be selected in the drawing area Dim acSSPrompt As PromptSelectionResult = acDoc.Editor.GetSelection() '' If the prompt status is OK, objects were selected If acSSPrompt.Status = PromptStatus.OK Then Dim acSSet As SelectionSet = acSSPrompt.Value '' Step through the objects in the selection set For Each acSSObj As SelectedObject In acSSet '' Check to make sure a valid SelectedObject object was returned If Not IsDBNull(acSSObj) Then '' Open the selected object for write Dim acEnt As Entity = acTrans.GetObject(acSSObj.ObjectId, _ OpenMode.ForWrite) If Not IsDBNull(acEnt) Then '' Change the object's color to Green acEnt.ColorIndex = 3 End If End If Next '' Save the new object to the database acTrans.Commit() End If '' Dispose of the transaction End Using End Sub But i am getting an error that selection is an invalid method . I am using .net framework 3.5 and dll is used in autocad 2007