• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 67
    Registered: ‎09-12-2006

    GetSelection from user with some entities already selected

    393 Views, 5 Replies
    05-06-2010 12:17 PM
    Hallo,
    I need to get a selection of entities from the user, as with the editor.GetSelection() method, but I want some entities to be already selected when the user starts selecting, so he/she can de-select them. I managed to do this with ActiveX, but I can't find a way to achieve this using the managed wrappers. I don't know if Utils.SelectObjects() can be of any use, cause I can't find any documentation on it.
    Could anyone help, please?

    Thanks

    using AutoCAD 2007 (or earlier if possible)
    Please use plain text.
    *Tony Tanzillo

    Re: GetSelection from user with some entities already selected

    05-06-2010 03:11 PM in reply to: pavlos.katsonis
    How did you do it with ActiveX?

    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD
    Supporting AutoCAD 2000 through 2011

    http://www.acadxtabs.com

    Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

    wrote in message news:6387136@discussion.autodesk.com...
    Hallo,
    I need to get a selection of entities from the user, as with the
    editor.GetSelection() method, but I want some entities to be already selected
    when the user starts selecting, so he/she can de-select them. I managed to do
    this with ActiveX, but I can't find a way to achieve this using the managed
    wrappers. I don't know if Utils.SelectObjects() can be of any use, cause I can't
    find any documentation on it.
    Could anyone help, please?

    Thanks

    using AutoCAD 2007 (or earlier if possible)
    Please use plain text.
    Valued Contributor
    Posts: 67
    Registered: ‎09-12-2006

    Re: GetSelection from user with some entities already selected

    05-06-2010 11:46 PM in reply to: pavlos.katsonis
    Using
    SelectionSet sSet = .... // create a new selection set
    sSet.AddItems(oldEntities); // where oldEntities is AcadEntity[] with the entities to be pre-selected.
    sSet.SelectOnScreen(...); // get user input
    Please use plain text.
    *Tony Tanzillo

    Re: GetSelection from user with some entities already selected

    05-07-2010 03:53 PM in reply to: pavlos.katsonis
    I don't see any obvious way to do that in ObjectARX.

    If the Editor's SelectionAdded event fires before the
    first selection is made by the user, that would be the
    only way it could be done.

    In any case, if you can't get that to work, then I would
    just use the ActiveX API to get the selection, and then
    use the Editor's SelectPrevious() method to get the
    resulting selection as a managed SelectionSEt.


    --
    http://www.caddzone.com

    AcadXTabs: MDI Document Tabs for AutoCAD
    Supporting AutoCAD 2000 through 2011

    http://www.acadxtabs.com

    Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

    wrote in message news:6387416@discussion.autodesk.com...
    Using
    SelectionSet sSet = .... // create a new selection set
    sSet.AddItems(oldEntities); // where oldEntities is AcadEntity[] with the
    entities to be pre-selected.
    sSet.SelectOnScreen(...); // get user input
    Please use plain text.
    Valued Contributor
    Posts: 67
    Registered: ‎09-12-2006

    Re: GetSelection from user with some entities already selected

    05-07-2010 11:57 PM in reply to: pavlos.katsonis
    Thanks for the advice. I'll use the ActiveX API for the selection.

    In fact, I may port the whole project to using ActiveX, since I need my main program to run outside AutoCAD's process and the method described in "Interfacing an external COM application with a .NET module in-process to AutoCAD (redux)" by K. Walmsley gives me a hell of problems.
    Please use plain text.
    Valued Contributor
    Posts: 67
    Registered: ‎09-12-2006

    Re: GetSelection from user with some entities already selected

    05-15-2010 03:48 AM in reply to: pavlos.katsonis
    I'm sorry, but I was wrong. The AddItems method adds the supplied entities to the selection set, but the user can not de-select them.
    And I thought I had tested it. It seems I have to make my tests more thorough.
    Please use plain text.