Ejemplo n.º 1
0
def ensure_text_type(name,
                     font_name=None,
                     font_size=0.01042,
                     tab_size=0.02084,
                     bold=False,
                     italic=False,
                     underline=False,
                     with_factor=1.0,
                     doc=None):
    doc = doc or HOST_APP.doc
    # check if type exists
    for ttype in query.get_types_by_class(DB.TextNoteType, doc=doc):
        if query.get_name(ttype) == name:
            return ttype
    # otherwise create it
    return create.create_text_type(
        name,
        font_name=font_name,
        font_size=font_size,
        tab_size=tab_size,
        bold=bold,
        italic=italic,
        underline=underline,
        with_factor=with_factor,
        doc=doc)
Ejemplo n.º 2
0
def create_filledregion(filledregion_name, fillpattern_element, doc=None):
    doc = doc or DOCS.doc
    filledregion_types = DB.FilteredElementCollector(doc) \
                           .OfClass(DB.FilledRegionType)
    for filledregion_type in filledregion_types:
        if query.get_name(filledregion_type) == filledregion_name:
            raise PyRevitException('Filled Region matching \"{}\" already '
                                   'exists.'.format(filledregion_name))
    source_filledregion = filledregion_types.FirstElement()
    new_filledregion = source_filledregion.Duplicate(filledregion_name)
    new_filledregion.FillPatternId = fillpattern_element.Id
    return new_filledregion