Skip to content

Instantly share code, notes, and snippets.

View johnpierson's full-sized avatar
🤡
clowning around

john pierson johnpierson

🤡
clowning around
View GitHub Profile
blueprint:
name: Awtrix-light custom application
description: Custom Awtrix-light application
domain: automation
input:
awtrix_entity:
name: Awtrix-light mqtt device
description: The device to be controlled
selector:
device:
@johnpierson
johnpierson / DynamoAPI_FreezeNodes.py
Created November 7, 2023 20:29
FreezeNodesByName
# Importing Reference Modules
# CLR ( Common Language Runtime Module )
import clr
# Adding the DynamoRevitDS.dll module to work with the Dynamo API
clr.AddReference('DynamoRevitDS')
import Dynamo
# access to the current Dynamo instance and workspace
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace
@johnpierson
johnpierson / DeleteAllWalls-Complete.py
Created January 12, 2023 15:01
The fixed graph for deleting all wall instances.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
@johnpierson
johnpierson / DeleteAllWalls-Original.py
Last active January 12, 2023 14:57
This script was generated by chat GPT to delete all walls in a model.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).ToElements()
@johnpierson
johnpierson / myFirstPythonNode.py
Created September 17, 2022 23:08
This is your first python node in Dynamo.
# import the common language runtime to communicate with the Revit API
import clr
# import the revit api
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# import dynamo's revit nodes
clr.AddReference('RevitNodes')
import Revit
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('PresentationCore')
from System.Windows.Media import FontFamily
clr.AddReference('AdWindows')
from Autodesk.Windows import *
@johnpierson
johnpierson / pythonTemplate.py
Created July 13, 2022 14:46
This is an all-in-one boilerplate template for making a python node in Dynamo
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
@johnpierson
johnpierson / AlignViewTitle.cs
Last active April 11, 2024 03:02
Proof of concept of aligning view title on older versions of Revit with Dynamo
public static void AlignViewTitle(global::Revit.Elements.Element viewport)
{
//get the current document (built in Dynamo method)
Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument;
//cast the viewport to the internal Revit DB Type
Autodesk.Revit.DB.Viewport internalViewport = viewport.InternalElement as Autodesk.Revit.DB.Viewport;
//get the original box center (for when we re-place the viewport)
var originalBoxCenter = internalViewport.GetBoxCenter();
@johnpierson
johnpierson / adornerSample.cs
Created June 2, 2021 20:43
sample adorner for dynamo
var workspaceView = MonocleViewExtension.view.FindVisualChildren<WorkspaceView>().First();
var canvasAdorner = AdornerLayer.GetAdornerLayer(workspaceView);
canvasAdorner.Add(new CustomAdorner(workspaceView));