Ejemplo n.º 1
0
def hex_string_to_color(hex_str):
    """Получения цвета из HEX"""
    hex_str = hex_str.lstrip('##')
    r, g, b = (int(hex_str[i:i + 2], 16) for i in (0, 2, 4))
    color = DB.Color(System.Byte(r), System.Byte(g), System.Byte(b))

    logger.debug('Color was created')
    return color
Ejemplo n.º 2
0
    def projection_fill(self, target, color=None, pattern=None, visible=None):
        """
        Sets ProjectionFill overrides

        Args:
            target (``Element``, ``ElementId``, ``Category``): Target Element(s) or Category(ies) to apply override. Can be list.
            color (``tuple``, ``list``): RGB Colors [ex. (255, 255, 0)]
            pattern (``DB.ElementId``): ElementId of Pattern
            visible (``bool``): Cut Fill Visibility
        """
        if color:
            Color = DB.Color(*color)
            self._revit_object.SetProjectionFillColor(Color)
        if pattern:
            fill_pattern = FillPatternElement.by_name_or_element_ref(pattern)
            self._revit_object.SetProjectionFillPatternId(fill_pattern.Id)
        if visible is not None:
            self._revit_object.SetProjectionFillPatternVisible(visible)

        self._set_overrides(target)
Ejemplo n.º 3
0
    def cut_line(self, target, color=None, pattern=None, weight=None):
        """
        Sets CutLine Overrides

        Args:
            target (``Element``, ``ElementId``, ``Category``): Target Element(s) or Category(ies) to apply override. Can be list.
            color (``tuple``, ``list``): RGB Colors [ex. (255, 255, 0)]
            pattern (``DB.ElementId``): ElementId of Pattern
            weight (``int``,``None``): Line weight must be a positive integer less than 17 or None(sets invalidPenNumber)
        """
        if color:
            Color = DB.Color(*color)
            self._revit_object.SetCutLineColor(Color)
        if pattern:
            line_pattern = LinePatternElement.by_name_or_element_ref(pattern)
            self._revit_object.SetCutLinePatternId(line_pattern.Id)
        if weight:
            self._revit_object.SetCutLineWeight(weight)

        self._set_overrides(target)
Ejemplo n.º 4
0
doc_active = revit.uidoc.ActiveView

# Collect CAD links
# Note: Because we import DB, we can call on ImportInstance

dwg_collector = db.Collector(of_class='ImportInstance', is_type=False)
dwg_elements = dwg_collector.get_elements()

# Collect views

view_collector = db.ViewPlan.collect()

# Set Color

color_gray = DB.Color(80, 80, 80)

# Create Class for Override

ogs = DB.OverrideGraphicSettings().SetProjectionLineColor(color_gray)

# Start transaction

t = db.Transaction('Set Linked CADs to Gray')
t.Start()

# The SetElementOverrides method requires element ID and override instance

for view in view_collector:
    for dwg in dwg_elements:
        dwg_id = dwg.Id
Ejemplo n.º 5
0
            data_out[i][0] = self.dico["label1" + str(i + 1)].Text
            data_out[i][1] = self.dico["label2" + str(i + 1)].Text
            data_out[i][2] = self.dico["label3" + str(i + 1)].Text
        self.Close()


# run form
Application.Run(MyListBox())
# END OF WINDOWS FORM ///////////////////////////////////////////////////
# ///////////////////////////////////////////////////////////////////////

# function for find in list of list
inL = lambda e, L: reduce(lambda b, l: b or e in l, L, False)
# dictionnary of color
dico_couleur = {
    "bleu": DB.Color(0, 0, 255),
    "rouge": DB.Color(255, 0, 0),
    "vert": DB.Color(0, 255, 0),
    "jaune": DB.Color(255, 255, 0),
    "orange": DB.Color(255, 127, 0),
    "marron": DB.Color(118, 71, 23),
    "rose": DB.Color(255, 0, 255),
    "violet": DB.Color(155, 0, 255),
    "bleu clair": DB.Color(0, 255, 255)
}

# CREATE WORKSET FILTER /////////////////////////////////////////////
okgo = True
if inL(0, data_out):
    okgo = False
    print "A+"  # if these is a 0 in listout, it means user clicked on Cancel button