.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selecting objects on screen from Handle or ObjectID

6 REPLIES 6
Reply
Message 1 of 7
greg
985 Views, 6 Replies

Selecting objects on screen from Handle or ObjectID

If I have a list of handles for Autocad Entities, how would I go about selecting these entities on screen so that the user could add to this selection or remove objects from the selection?  I could go with objectids as well if needed.

 

I have been searching and searching and coming up empty handed or at least coming up with information that doesnt seem to dowhat I want.

 

Thanks,

 

6 REPLIES 6
Message 2 of 7
Alexander.Rivilis
in reply to: greg

Method Editor.SelectImplied can help you. Command must be registered with CommandFlags.Redraw | CommandFlags.UsePickSet attributes

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 7
greg
in reply to: Alexander.Rivilis

Hi Alexander,

 

I am not sure where to head with this.  I attempted but just not sure what to do.  Do I need to build a selection set within code?  Can you do that without prompting a user for selections?  I guess I am a bit lost now.

 

Thanks for your help!  Greatly appreciated!

Message 4 of 7
greg
in reply to: Alexander.Rivilis

In addition, I have tried using:

 

Autodesk.AutoCAD.Internal.Utils.SelectObjects(anobjectid)

 

but when I use an objectId in that line I get a message that :

 

Value of type 'System.Collections.Generic.List(Of Autodesk.AutoCAD.DatabaseServices.ObjectId)' cannot be converted to '1-dimensional array of Autodesk.AutoCAD.DatabaseServices.ObjectId'

 

thanks,

Message 5 of 7
greg
in reply to: Alexander.Rivilis

Nevermind.  I finally got the code to work I think.  it is as follows:

 

Dim ids(0) As ObjectId
ids(0) = ObjectIdFromHandle(myDocDB, "1D6")
Autodesk.AutoCAD.Internal.Utils.SelectObjects(ids)

 

Thanks for your help!

Message 6 of 7
greg
in reply to: greg

I guess this may not work because you not already in a command?

Message 7 of 7
greg
in reply to: greg

Okay, I think I got some of this to work.  My only issue is that how do I stop and allow the user to add or remove from the current on screen selection.  This is what I have so far but i never get prompted to revise the selection.

 

                Dim ids(1) As ObjectId
                ids(0) = ObjectIdFromHandle(myDocDB, "1D6")
                ids(1) = ObjectIdFromHandle(myDocDB, "1DE")

                Autodesk.AutoCAD.Internal.Utils.SelectObjects(ids)

                Dim prObjectSelectionOptions As PromptSelectionOptions = New PromptSelectionOptions()

                prObjectSelectionOptions.MessageForAdding = vbCrLf & "Please revise polyline selection:"

                '  Prompt for selections
                Dim prObjectSelectionRes As PromptSelectionResult = ed.SelectImplied()
                '  I am then trying to allow the user to add additional selections, or remove here
                prObjectSelectionRes = ed.GetSelection(prObjectSelectionOptions)

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost