Example #1
0
if el:
    el = el[0]
    par = el.GetParameters("Рзм.Диаметр")
    if el.GetParameters("Рзм.Диаметр"):
        par = el.GetParameters("Рзм.Диаметр")[0]
    elif doc.GetElement(el.GetTypeId()).GetParameters("Рзм.Диаметр"):
        par = doc.GetElement(el.GetTypeId()).GetParameters("Рзм.Диаметр")[0]
    if par:
        diam = to_mm(par.AsDouble())
        sel_color = ColorSelectionDialog()
        if sel_color.Show() == ItemSelectionDialogResult.Confirmed:
            color = sel_color.SelectedColor
            filter = create_filter(diam, par)
            active_view = doc.ActiveView
            if active_view.IsFilterApplied(filter.Id):
                active_view.RemoveFilter(filter.Id)
            over = OverrideGraphicSettings()
            over.SetProjectionLineColor(color)
            over.SetCutLineColor(color)
            active_view.AddFilter(filter.Id)
            active_view.SetFilterOverrides(filter.Id, over)
            if active_view.ViewTemplateId != ElementId.InvalidElementId and active_view.ViewTemplateId:
                template = active_view.ViewTemplateId
                if template.IsFilterApplied(filter.Id):
                    template.RemoveFilter(filter.Id)
                doc.GetElement(active_view.ViewTemplateId).AddFilter(filter.Id)
                doc.GetElement(active_view.ViewTemplateId).SetFilterOverrides(
                    filter.Id, over)

t.Commit()
Example #2
0
                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(
                    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,