Announcement

Collapse
No announcement yet.

ProjColorOverrideByElement on Imported Category

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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
    what is happening? any error messages? try putting a debugging popup to make sure it is running
    http://krispcad.blogspot.com/

    Comment


      #3
      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.?

      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 21, 2011, 01:24 PM.

      Comment


        #4
        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).
        http://krispcad.blogspot.com/

        Comment


          #5
          Hey thanks guess this is not a high priority in the next API. Any idea when the APIs come out?

          Comment


            #6
            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.
            http://krispcad.blogspot.com/

            Comment

            Related Topics

            Collapse

            Working...
            X