See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: How t o highlight an element while the command is running

  1. #1
    Member
    Join Date
    2010-05
    Posts
    13
    Login to Give a bone
    0

    Default How t o highlight an element while the command is running

    My plugin will show a Window Form with different room properties listed on it. What I want is to highlight an room when I select this room from GUI. Is there any simple way to do it?

    The method mentioned in this blog (http://thebuildingcoder.typepad.com/...-elements.html) can highlight an element only after the Execute() function is finished. However, I want the element to be highlighted in between (i.e., Window Form GUI is still running and a room can be hilghlighted by selecting this room from this GUI)

    Thanks,

  2. #2
    Member
    Join Date
    2012-09
    Posts
    34
    Login to Give a bone
    1

    Default Re: How t o highlight an element while the command is running

    You should be able to do something like this:
    Code:
    Element elementToSelect;
    UIDocument uidoc;
    
    SelElementSet selElementSet = uidoc.Selection.Elements;
    
    //If you want to deselect all previously selected elements
    selElementSet.Clear();
    
    selElementSet.Insert(elementToSelect);
    
    uidoc.Selection.Elements = selElementSet;
    
    //If you want to show the element as well
    uidoc.ShowElements(elementToSelect);
    In 2015, it's done a little differently:

    Code:
    ElementId idOfElementToSelect;
    UIDocument uidoc;
    
    uidoc.Selection.SetElementIds(new[] {idOfElementToSelect});
    
    //If you want to show the element as well
    uidoc.ShowElements(idOfElementToSelect);
    As far as I know, there is no restriction on highlighting the element while a command is running. The link you referenced is very old so the restriction must have been removed since then.

  3. #3
    Member
    Join Date
    2010-05
    Posts
    13
    Login to Give a bone
    0

    Default Re: How t o highlight an element while the command is running

    Thanks! I find ShowElements seems very slow. So I use boundingBoxXYZ and UIView class to show element in a specified range..

Similar Threads

  1. 2014: how to select an element while Window form is running
    By kukuzry in forum Revit - API
    Replies: 1
    Last Post: 2014-07-16, 06:37 PM
  2. New Command - Highlight Overridden Labels
    By Wish List System in forum Civil 3D Wish List
    Replies: 0
    Last Post: 2013-04-23, 02:15 PM
  3. 2011: HIGHLIGHT reverts to 0 after burst command?
    By stimmo520 in forum AutoCAD General
    Replies: 9
    Last Post: 2011-05-09, 01:07 PM
  4. Highlight Text From the Find and Replace Command
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-05-02, 05:12 PM
  5. Replies: 8
    Last Post: 2005-06-30, 02:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •