This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
if sys.version_info >= (3, 0): | |
sys.stdout.write("Sorry, requires Python 2.x, not Python 3.x\n") | |
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash/zsh git prompt support | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# This script allows you to see repository status in your prompt. | |
# | |
# To enable: | |
# | |
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tree(): | |
return defaultdict(tree) | |
Adding a simple subclass allows attribute like selection: | |
class mydefaultdict(defaultdict): | |
def __getattr__(self, attr): | |
return self[attr] | |
def __setattr__(self, attr, val): | |
self[attr] = val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Crop Image | |
Crops an Image to a Filled Region Boundary | |
TESTED REVIT API: 2015 | |
Copyright (c) 2014-2016 Gui Talarico | |
github.com/gtalarico | |
This script is part of PyRevitPlus: Extensions for PyRevit | |
github.com/gtalarico/pyrevitplus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Autodesk.Revit.DB import Element, FilteredElementCollector | |
from Autodesk.Revit.DB import FilledRegionType, FilledRegion | |
def fregion_id_by_name(name=None): | |
"""Get Id of Filled Region Type by Name. | |
Loops through all types, tries to match name. | |
If name not supplied, first type is used. | |
If name supplied does not match any existing types, last type is used | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Autodesk.Revit.DB import Phase, FilteredElementCollector | |
def get_phase_by_name(phase_name): | |
phase_collector = FilteredElementCollector(doc).OfClass(Phase) | |
for phase in phase_collector: | |
if phase.Name.Equals(phase_name): | |
return phase | |
phase = get_phase_by_name('01 - Existing') | |
print phase.Name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Create a text annotation element. | |
Does not include start/commit transaction.''' | |
def create_text(view, text, point, align): | |
"""Creates a Revit Text. | |
create_test(view, text_string, point) | |
view: view object to insert text | |
text: text to be inserted | |
point: insertion point - XYZ() instance | |
align: 'left', 'right', or 'center' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import Image | |
# http://www.revitapidocs.com/2015/05c3dbe2-fe7e-c293-761d-b11f356a011b.htm | |
from clr import StrongBox | |
from Autodesk.Revit.DB import XYZ, ImageImportOptions, BoxPlacement, BuiltInParameter | |
# Import Options | |
import_options = ImageImportOptions() | |
import_options.Placement = BoxPlacement.Center | |
import_options.RefPoint = XYZ(0,0,0) |
OlderNewer