Skip to content

Commit

Permalink
Override VG: fix w. non-english Revit
Browse files Browse the repository at this point in the history
  • Loading branch information
melnikovalex committed May 30, 2019
1 parent e2830f0 commit cbf469c
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Provides options for overriding Visibility/Graphics on selected elements."""
"""Provides options for overriding Visibility/Graphics on selected elements.
Shift-Click: Override Cut pattern also"""
#pylint: disable=E0401,C0103
import re
from collections import OrderedDict
Expand All @@ -19,14 +21,12 @@


def find_solid_fillpat():
solid_fill_regex = re.compile('[<]?solid fill[>]?')
existing_pats = DB.FilteredElementCollector(revit.doc)\
.OfClass(DB.FillPatternElement)\
.ToElements()
for pat in existing_pats:
fpat = pat.GetFillPattern()
if solid_fill_regex.match(fpat.Name.lower()) \
and fpat.Target == DB.FillPatternTarget.Drafting:
if fpat.IsSolidFill and fpat.Target == DB.FillPatternTarget.Drafting:

This comment has been minimized.

Copy link
@melnikovalex

melnikovalex May 31, 2019

Author Contributor

In translated Revit it coulnd't find Solid pattern. Now it takes the first one with IsSolidFill==True

return pat


Expand All @@ -39,14 +39,20 @@ def colorvg(r, g, b, projline_only=False, xacn_name=None):
selection.append(revit.doc.GetElement(mem))
ogs = DB.OverrideGraphicSettings()
ogs.SetProjectionLineColor(color)
if __shiftclick__:
ogs.SetCutLineColor(color)
if not projline_only:
ogs.SetProjectionFillColor(color)
if __shiftclick__:
ogs.SetCutFillColor(color)
solid_fpattern = find_solid_fillpat()
if solid_fpattern:
ogs.SetProjectionFillPatternId(solid_fpattern.Id)
if __shiftclick__:
ogs.SetCutFillPatternId(solid_fpattern.Id)
else:
logger.warning('Can not find solid fill pattern in model'
'to assign as projection pattern.')
'to assign as projection/cut pattern.')
revit.doc.ActiveView.SetElementOverrides(el.Id, ogs)


Expand Down

1 comment on commit cbf469c

@melnikovalex
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it wasn't able to override cut-sections. I've added this option on Shift-click

Please sign in to comment.