Skip to content

Instantly share code, notes, and snippets.

View gtalarico's full-sized avatar
♥️
Python, Javascript, and Go

Gui Talarico gtalarico

♥️
Python, Javascript, and Go
View GitHub Profile
import sys
if sys.version_info >= (3, 0):
sys.stdout.write("Sorry, requires Python 2.x, not Python 3.x\n")
sys.exit(1)
def function1():
"""Description of Function 1."""
pass
def funciton2():
"""Description of Function 2."""
pass
def function3():
"""Description of Function 3."""
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# 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).
@gtalarico
gtalarico / .bashrc
Created June 22, 2016 04:42
Custom config added to bash.
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# 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).
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
@gtalarico
gtalarico / revitapidocs_SelectAllDoors.py
Last active September 30, 2016 13:45
RevitAPI::Code Snippets::Select All Doors
"""
SelectDoors
Selects All Door Instances
TESTED REVIT API: 2015 | 2016
Gui Talarico
"""
from Autodesk.Revit.UI import TaskDialog
from Autodesk.Revit.DB import FilteredElementCollector
from Autodesk.Revit.DB import BuiltInCategory, ElementId
@gtalarico
gtalarico / revitapidocs_CreateDraftingView.py
Last active February 2, 2024 21:24
RevitAPI::Code Snippets::Create Drafting View
''' Creates a Drafting View'''
from Autodesk.Revit.DB import Transaction, Element
from Autodesk.Revit.DB import FilteredElementCollector
# Drafting Views
from Autodesk.Revit.DB import ViewFamilyType, ViewDrafting, Element
from Autodesk.Revit.DB import ViewFamily
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
@gtalarico
gtalarico / revitapidocs_OpenScheduleInExcel.py
Last active November 12, 2023 22:43
RevitAPI::Working Tools::Open Schedule in Excel
"""
Copyright (c) 2016 Gui Talarico
Base script taken from pyRevit Respository.
pyRevit Notice
#################################################################
See this link for a copy of the GNU General Public License protecting this package.
https://github.com/eirannejad/pyRevit/blob/master/LICENSE
"""
@gtalarico
gtalarico / revitapidocs_RemoveUnderlay.py
Last active October 3, 2016 12:46
RevitAPI::Working Tools::Remove Underlay
"""
RemoveUnderlay
Removes Underlay From Selected Views.
TESTED REVIT API: 2015 | 2016
Copyright (c) 2014-2016 Gui Talarico
This script is part of PyRevitPlus: Extensions for PyRevit
github.com/gtalarico
@gtalarico
gtalarico / revitapidocs_RevitTransactionDecorator.py
Last active August 23, 2022 18:57
RevitAPI::Code Snippets::Revit Transaction Decorator
''' Example of a Transaction Decorator function.
This allows you to create functions that make changes to the revit document
without having to repeat the code to start/commit transactions.
Just add the revit_transaction decorator and a transaction will be started before
your function is called, and then commit after the call.'''
from functools import wraps
from Autodesk.Revit.Exceptions import InvalidOperationException
def revit_transaction(transaction_name):