예제 #1
0
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See this link for a copy of the GNU General Public License protecting this package.
https://github.com/eirannejad/pyRevit/blob/master/LICENSE
"""

__doc__ = 'Sets element graphic override to halftone on the selected elements. If any of the elements is a group, the script will apply the override to all its members.'

__window__.Close()
from Autodesk.Revit.DB import Transaction, OverrideGraphicSettings, Group

doc = __revit__.ActiveUIDocument.Document
selection = [
    doc.GetElement(elId)
    for elId in __revit__.ActiveUIDocument.Selection.GetElementIds()
]

with Transaction(doc, 'Halftone Elements in View') as t:
    t.Start()
    for el in selection:
        if isinstance(el, Group):
            for mem in el.GetMemberIds():
                selection.append(doc.GetElement(mem))
        ogs = OverrideGraphicSettings()
        ogs.SetHalftone(True)
        # ogs.SetProjectionFillPatternVisible(False)
        doc.ActiveView.SetElementOverrides(el.Id, ogs)
    t.Commit()
예제 #2
0
                cfg.SetProjectionFillColor(col(pro_fill_color)) if col(
                    pro_fill_color) else None  # noqa
                cfg.SetSurfaceTransparency(int(transparency))  # noqa
                cfg.SetCutLineWeight(int(cut_line_weight)) if int(
                    cut_line_weight) > 0 else None  # noqa
                cfg.SetCutLineColor(col(cut_line_color)) if col(
                    cut_line_color) else None  # noqa
                cfg.SetCutLinePatternId(line(cut_line_pattern_id)) if line(
                    cut_line_pattern_id) else None  # noqa
                cfg.SetCutFillPatternVisible(
                    bool(int(cut_fill_pattern_visible)))  # noqa
                cfg.SetCutFillPatternId(fill(cut_fill_pattern_id)) if fill(
                    cut_fill_pattern_id) else None  # noqa
                cfg.SetCutFillColor(col(cut_fill_color)) if col(
                    cut_fill_color) else None  # noqa
                cfg.SetHalftone(bool(int(halftone)))  # noqa

                view.SetFilterOverrides(ElementId(int(filter_id)), cfg)
            status = 'New'
            data.append([
                view_id, view_symbol, view_name, filter_id, filter_name,
                visibility, pro_line_weight, pro_line_color,
                pro_line_pattern_id, pro_fill_pattern_visible,
                pro_fill_pattern_id, pro_fill_color, transparency,
                cut_line_weight, cut_line_color, cut_line_pattern_id,
                cut_fill_pattern_visible, cut_fill_pattern_id, cut_fill_color,
                halftone, status
            ])

#     # doc.ActiveView.Duplicate(name).SetFilterVisibility([i.Id for i in all_filters if i.Name == name + ' не'][0], False)
#     new_view = doc.GetElement(doc.ActiveView.Duplicate(ViewDuplicateOption.Duplicate))