Monday, June 2, 2008

ed.SetImpliedSelection(Nothing) doesn't work in AutoCAD 2009

"I upgraded a project to VS 2008 (VB.NET) and AutoCAD 2009 and got this error on the following row:
ed.SetImpliedSelection(Nothing)

Error 1 Overload resolution failed because no accessible 'SetImpliedSelection' is most specific for these arguments:
'Public Sub SetImpliedSelection(selectedObjects() As Autodesk.AutoCAD.DatabaseServices.ObjectId)': Not most specific.
'Public Sub SetImpliedSelection(selectionSet As Autodesk.AutoCAD.EditorInput.SelectionSet)': Not most specific.

Another thing is that SetImpliedSelection is missing in the AutoCAD 2009 .Net API documentation. Not sure if it is on purpose. It was there and worked in AutoCAD 2008.

The object browser still shows it.
Public Sub SetImpliedSelection(ByVal selectedObjects() As Autodesk.AutoCAD.DatabaseServices.ObjectId)
Member of Autodesk.AutoCAD.EditorInput.Editor

The code to replicate this:

Imports Autodesk.AutoCAD Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput Namespace SelectionTest Public Class PickfirstTestCmds <CommandMethod("PFT", (CommandFlags.UsePickSet Or CommandFlags.Redraw Or CommandFlags.Modal))> Public Shared Sub PickFirstTest() Dim doc As Document = Application.DocumentManager.MdiActiveDocument() Dim ed As Editor = doc.Editor ed.SetImpliedSelection(Nothing) End Sub End Class End Namespace

I also find that this still works

Dim objs(0) As AcObjectId ed.SetImpliedSelection(objs)

I'm wondering if it is so that ed.SetImpliedSelection(Nothing) is no longer or not really needed to clear the pickfirst set.

1 comment:

  1. Note for myself and others on the SetImpliedSelection function used to clear the current PickFirst selection set but seems to not be needed in AutoCAD 2010.

    '' Clear the PickFirst selection set
    Dim idarrayEmpty() As ObjectId
    acDocEd.SetImpliedSelection(idarrayEmpty)

    // Clear the PickFirst selection set
    acDocEd.SetImpliedSelection(new ObjectId[0]);

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner