Example #1
0
            if filter_name:
                filter_id = str(
                    [i.Id for i in all_filters if i.Name == filter_name][0])
                view.SetFilterVisibility(ElementId(int(filter_id)),
                                         bool(int(visibility)))
                cfg = OverrideGraphicSettings()

                cfg.SetProjectionLineWeight(int(pro_line_weight)) if int(
                    pro_line_weight) > 0 else None  # noqa
                cfg.SetProjectionLineColor(col(pro_line_color)) if col(
                    pro_line_color) else None  # noqa
                cfg.SetProjectionLinePatternId(
                    line(pro_line_pattern_id)) if line(
                        pro_line_pattern_id) else None  # noqa
                cfg.SetProjectionFillPatternVisible(
                    bool(int(pro_fill_pattern_visible)))  # noqa
                cfg.SetProjectionFillPatternId(
                    fill(pro_fill_pattern_id)) if fill(
                        pro_fill_pattern_id) else None  # noqa
                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(
Example #2
0
This program is distributed in the hope that it will be useful,
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()