Donate Now Goal amount for this year: 2500 USD, Received: 1627 USD (65%)

Results 1 to 6 of 6

Thread: ProjColorOverrideByElement on Imported Category

  1. #1
    Member
    Join Date
    April 21, 2011
    Posts
    63
    Current Local Time
    02:46 PM

    ProjColorOverrideByElement on Imported Category

    Trying to change color overrides for Imported Category.

    Any idea why the following code does not work?


    Code:
     
                UIApplication uiapp = commandData.Application;
                UIDocument uidoc = uiapp.ActiveUIDocument;
                Application app = uiapp.Application;
                Document doc = uidoc.Document;
    
                Element SelectedElement = null;
    
                 try
                {
                    Reference eRef = uidoc.Selection.PickObject(ObjectType.Element, "Please pick an element.");
                    if (eRef != null && eRef.ElementId != ElementId.InvalidElementId)
                    {
                        SelectedElement = doc.GetElement(eRef);
                    }
                }
                catch (Exceptions.OperationCanceledException)
                {
                    return Result.Failed;
                }
    
                Category category = SelectedElement.Category;
                var ids = new List<ElementId>();
    
                Color color = app.Create.NewColor();
                color.Blue = 150;
                color.Red = 200;
                color.Green = 200;  
    
                foreach (Category cat in category.SubCategories)
                {
                    ids.Add(cat.Id);
                }
    
    
                var trans = new Transaction(doc);
                trans.Start("set_ProjColorOverrideByElement");
                doc.ActiveView.set_ProjColorOverrideByElement(ids, color);
                trans.Commit();
    
                return Result.Succeeded;

  2. #2
    Member krispy5's Avatar
    Join Date
    December 21, 2010
    Posts
    68
    Current Local Time
    01:46 AM
    what is happening? any error messages? try putting a debugging popup to make sure it is running

  3. #3
    Member
    Join Date
    April 21, 2011
    Posts
    63
    Current Local Time
    02:46 PM
    Yeah i did that ran the getter method before and after the commit and the color value changes but no visual changes to linked elements, the ids seem correct even added the main category id to the collection. It doesn't change the color values in VG overrides, if I change the line color of the elements the changes are made in object styles tried doc.regen... didn't help. No error messages. Not sure what else to try.?

    Quote Originally Posted by krispy5 View Post
    what is happening? any error messages? try putting a debugging popup to make sure it is running
    Last edited by n8wex; June 21st, 2011 at 12:24 PM.

  4. #4
    Member krispy5's Avatar
    Join Date
    December 21, 2010
    Posts
    68
    Current Local Time
    01:46 AM
    This method seems to be only for overriding the colour of "Elements" and not "Categories" (similar to if you were to select an element in a model, right-click and choose "Override Graphics in View -> By Element...".

    you could override the default colours for each subcategory by assigning the colour to the "Category.LineColor" property, but this may not be what you want (i.e. this is a global setting, not per view).

  5. #5
    Member
    Join Date
    April 21, 2011
    Posts
    63
    Current Local Time
    02:46 PM
    Hey thanks guess this is not a high priority in the next API. Any idea when the APIs come out?

  6. #6
    Member krispy5's Avatar
    Join Date
    December 21, 2010
    Posts
    68
    Current Local Time
    01:46 AM
    API is usually updated at the same time as the main product, so when there is a service pack or new release. Usually, the service pack updates are mostly bug fixes though.

Similar Threads

  1. Model Category Meltdown
    By jsnyder in forum Architecture and General Revit Questions
    Replies: 41
    Last Post: September 14th, 2011, 03:47 AM
  2. Red lights; what category?
    By Gordon Price in forum MEP - General
    Replies: 8
    Last Post: June 13th, 2011, 01:29 PM
  3. Which category does it belong to?
    By bangobeat in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: June 1st, 2011, 11:24 AM
  4. Imported Objects
    By dzatto in forum Architecture and General Revit Questions
    Replies: 9
    Last Post: April 15th, 2011, 03:28 PM
  5. Name category of views
    By Severnik in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: March 12th, 2011, 12:13 AM

Posting Permissions

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