Message 1 of 8
RemovePaint does not update view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wrote a script to let user select beams and columns, then I use doc.RemovePaint to remove painted materials on all of their faces. Script run successfully and material is deleted from schedule. But the view is not updated, until I run the script again. Please see the screencast.
Here is my code:
# -*- coding: utf-8 -*- import sys import clr clr.AddReference('RevitAPI') import Autodesk import rpw from rpw import doc, uidoc from System.Collections.Generic import List def get_faces(element): op = Autodesk.Revit.DB.Options() op.View = doc.ActiveView geometries = element.Geometry[op] for g in geometries: if type(g) == Autodesk.Revit.DB.Solid and g.Faces.Size > 0: return g.Faces class CategoriesFilter(Autodesk.Revit.UI.Selection.ISelectionFilter): def __init__(self, names): self.names = names def AllowElement(self, element): return element.Category.Name in self.names def select_by_category(prompt='Pick Objects', *names): references = uidoc.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element, CategoriesFilter(names), prompt) return [rpw.db.Element.from_id(reference.ElementId) for reference in references] selected_elements = rpw.ui.Selection().elements if not selected_elements: try: selected_elements = select_by_category('Pick Elements', 'Structural Framing', 'Structural Columns') except Autodesk.Revit.Exceptions.OperationCanceledException: sys.exit() with rpw.db.Transaction('Remove Paint on all faces'): for e in selected_elements: faces = get_faces(e) for face in faces: doc.RemovePaint(e.Id, face)
Am I missing any step?