Skip to content

Commit

Permalink
Initial upload to private rep
Browse files Browse the repository at this point in the history
After a week of cleaning up, decided to create a private rep and perform
an initial commit.
  • Loading branch information
eirannejad committed Aug 16, 2015
1 parent 925c91b commit bc8e6d7
Show file tree
Hide file tree
Showing 190 changed files with 3,117 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 0010_pyRevit_PulldownButton_Settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 0020_pyRevit_PulldownButton_Spy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 0030_pyRevit_PulldownButton_WIP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1000_Selection_Stack3_SelectionMemA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1010_Selection_PulldownButton_Select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1020_Selection_PulldownButton_Filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1030_Selection_PulldownButton_Inspect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2000_Analysis_PulldownButton_Analyse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3000_Modify_PulldownButton_Edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3010_Modify_PulldownButton_Text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3020_Modify_PulldownButton_Draft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3030_Modify_PulldownButton_Model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3040_Modify_PulldownButton_Groups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3050_Modify_PulldownButton_Rooms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3060_Modify_PulldownButton_Legends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3070_Modify_PulldownButton_Links.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3080_Modify_PulldownButton_Schedules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3090_Modify_PulldownButton_Sheets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3091_Modify_PulldownButton_Site.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 3092_Modify_PulldownButton_Organize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4000_BIM_PulldownButton_BIM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4010_BIM_PulldownButton_List.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 4020_BIM_PulldownButton_Wipe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 5000_Desktop_PulldownButton_Desktop.png
Binary file added 5010_Desktop_PulldownButton_Print.png
Binary file added 5020_Desktop_PulldownButton_User.png
10 changes: 10 additions & 0 deletions Analyse_listLineEndpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# from Autodesk.Revit.DB import *

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

for el in uidoc.Selection.Elements:
# print( el.GeometryCurve.EndPoint[0][2] )
# print( el.GeometryCurve.EndPoint[1][2] )
print( el.GeometryCurve.GetEndPoint(0) )
print( el.GeometryCurve.GetEndPoint(1) )
Binary file added Analyse_sumAllSelectedEntityAreas.png
13 changes: 13 additions & 0 deletions Analyse_sumAllSelectedEntityAreas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

total = 0.0
for i in selection:
total += i.Parameter['Area'].AsDouble()
print("TOTAL AREA OF ALL SELECTED ELEMENTS IS: {0}".format(total))
Binary file added Analyse_sumAllSelectedEntityLengths.png
36 changes: 36 additions & 0 deletions Analyse_sumAllSelectedEntityLengths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from Autodesk.Revit.DB import CurveElement
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

def isline( line ):
return isinstance( line, CurveElement )

total = 0.0
lines = []

print("PROCESSING TOTAL OF {0} OBJECTS:\n\n".format( len( selection )))

for i, el in enumerate(selection):
if isline( el ):
lines.append( el )
total += el.LookupParameter('Length').AsDouble()
print("TOTAL LENGTH OF ALL SELECTED ELEMENTS IS: {0}\n\n\n".format( total ))

#group lines per line style
linestyles = {}
for l in lines:
if l.LineStyle.Name in linestyles:
linestyles[ l.LineStyle.Name ].append( l )
else:
linestyles[ l.LineStyle.Name ] = [ l ]

for k in sorted( linestyles.keys() ):
linestyletotal = 0.0
for l in linestyles[k]:
linestyletotal += l.LookupParameter('Length').AsDouble()
print("- LINES OF STYLE {0} -\nTOTAL LENGTH : {1}\n\n".format( k, linestyletotal ))
Binary file added Analyse_sumAllSelectedEntityVolumes.png
13 changes: 13 additions & 0 deletions Analyse_sumAllSelectedEntityVolumes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

total = 0.0
for i in selection:
total += i.Parameter['Volume'].AsDouble()
print("TOTAL VOLUME OF ALL SELECTED ELEMENTS IS: {0}".format(total))
1 change: 1 addition & 0 deletions BIM_disableSiteDesignerAddin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print('WIP')
Binary file added BIM_getCentralPath.png
7 changes: 7 additions & 0 deletions BIM_getCentralPath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from Autodesk.Revit.DB import ModelPathUtils
doc = __revit__.ActiveUIDocument.Document

if doc.GetWorksharingCentralModelPath():
print(ModelPathUtils.ConvertModelPathToUserVisiblePath(doc.GetWorksharingCentralModelPath()))
else:
print("Model is not work-shared.")
Binary file added BIM_openBIMemail.png
3 changes: 3 additions & 0 deletions BIM_openBIMemail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__window__.Close()
import os
os.system('start mailto:[email protected]?subject=BIM - ')
Binary file added BIM_openLRSbimFamilyTools.png
3 changes: 3 additions & 0 deletions BIM_openLRSbimFamilyTools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__window__.Close()
import os
os.system('start http://intranet.lrsarchitects.com/wiki/index.php/BIM_Family_Tools')
3 changes: 3 additions & 0 deletions Desktop_RegExTool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__window__.Close()
import os
os.system('start http://regexr.com/')
31 changes: 31 additions & 0 deletions Desktop_cleanupFilenamesUnderDesktopCleanup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
''' Gets a subfolder name on user desktop and removes the ! in filenames.'''
import os, sys
import os.path as op

global globalVerbose
sheetcount = 0
filecount = 0

if verbose:
globalVerbose = True

desktop = op.expandvars('%userprofile%\\desktop')
basefolder = op.join(desktop, 'Cleanup')

def cleanupFileName( file ):
if '!' == file[0]:
return file[1:]
else:
return False

for dirname, dirnames, filenames in os.walk( basefolder ):
for file in filenames:
filecount += 1
newfile = cleanupFileName(file)
if newfile:
try:
os.rename(op.join(dirname, file), op.join(dirname, newfile))
sheetcount+=1
except:
print("Unexpected error:", sys.exc_info()[0])
print('{0} FILES PROCESSED - {1} FILES RENAMED.'.format( filecount, sheetcount))
19 changes: 19 additions & 0 deletions Desktop_flattenFolderOnDesktop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
''' Gets a subfolder name on user desktop and moves all the files in its subdirectories to the roof directory (flattening).'''
import os, sys, shutil
import os.path as op

sheetcount = 0
filecount = 0

desktop = op.expandvars('%userprofile%\\desktop')
basefolder = op.join(desktop, 'Flatten')

for dirname, dirnames, filenames in os.walk( basefolder ):
for file in filenames:
filecount += 1
try:
shutil.move( op.join(dirname, file), op.join(basefolder, file))
sheetcount+=1
except:
print("Unexpected error:", sys.exc_info()[0])
print('{0} FILES PROCESSED - {1} FILES RENAMED.'.format( filecount, sheetcount))
12 changes: 12 additions & 0 deletions Desktop_getSysPath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys, os
folder = os.path.dirname(__file__)
print('Home directory of this script:\n{0}\n'.format( folder ))

sys.path.append(folder)

import pyRevit
print('pyRevit import successful\n')

print('Printing sys.path addresses:')
for p in sys.path:
print(p)
Binary file added Desktop_makeBaseArchitecturalFoldersOnMyDesktop.png
29 changes: 29 additions & 0 deletions Desktop_makeBaseArchitecturalFoldersOnMyDesktop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
''' Creates all base architectural folders for sheets per LRS Standard'''
import os, sys
import os.path as op

basefolder = op.expandvars('%userprofile%\\desktop')

archFolders = [
'A000 - CODE',
'A100 - SITE',
'A200 - PLANS',
'A300 - ROOF',
'A400 - RCP',
'A500 - ELEVATIONS',
'A600 - SECTIONS',
'A700 - DOORS & WINDOWS',
'A800 - INTERIOR',
'A9000 - DET CODE',
'A9100 - DET SITE',
'A9200 - DET PLAN',
'A9300 - DET ROOF',
'A9400 - DET RCP',
'A9500 - DET EXTERIOR',
'A9600 - DET SECTIONS',
'A9700 - DET DOORS & WINDOWS',
'A9800 - DET INTERIOR',
]

for d in archFolders:
os.mkdir(op.join(basefolder, d))
Binary file added Desktop_openIconSource.png
3 changes: 3 additions & 0 deletions Desktop_openIconSource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__window__.Close()
import os
os.system('start https://icons8.com/web-app/new-icons/color')
28 changes: 28 additions & 0 deletions Desktop_renamePDFSheetsOnMyDesktop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
''' Rename Revit output PDFs on user desktop to remove the project name from file name.'''
import os, sys
import os.path as op

basefolder = op.expandvars('%userprofile%\\desktop')
sheetcount = 0

def renamePDF( file ):
import re
r = re.compile('(?<=Sheet - )(.+)')
fname = r.findall(file)[0]
r = re.compile('(.+)\s-\s(.+)')
fnameList= r.findall(fname)
return fnameList[0][0] + ' - ' + fnameList[0][1].upper()

# for dirname, dirnames, filenames in os.walk( basefolder ):
filenames = os.listdir( basefolder )
for file in filenames:
ext = op.splitext(file)[1].upper()
if ext == '.PDF' and ('Sheet' in file):
newfile = renamePDF(file)
try:
os.rename( op.join( basefolder, file ), op.join( basefolder, newfile ))
sheetcount+=1
except:
print("Unexpected error:", sys.exc_info()[0])

print('{0} FILES RENAMED.'.format(sheetcount))
7 changes: 7 additions & 0 deletions Draft_bringToFrontSelected.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from Autodesk.Revit.DB import DetailElementOrderUtils as eo

with Transaction(doc,"Bring Selected To Front") as t:
t.Start()
for el in selection:
eo.BringForward(doc, doc.ActiveView, el.Id)
t.Commit()
17 changes: 17 additions & 0 deletions Draft_changeLineToSolid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

# id = uidoc.Selection.PickObject(ObjectType.Element,"Select an element").ElementId
with Transaction(doc,"Set Element Override") as t:
t.Start()
for el in selection:
ogs = OverrideGraphicSettings()
ogs.SetProjectionLineStyleId()
doc.ActiveView.SetElementOverrides(el.Id, ogs);
t.Commit()
Binary file added Draft_exportViewAsImage.png
32 changes: 32 additions & 0 deletions Draft_exportViewAsImage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'''
exportImage.py
Export the currently visible view as a PNG image to a location specified by the user.
'''

import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *

doc = __revit__.ActiveUIDocument.Document

# collect file location from user
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import DialogResult, SaveFileDialog
dialog = SaveFileDialog()
dialog.Title = 'Export current view as PNG'
dialog.Filter = 'PNG files (*.PNG)|*.PNG'

if dialog.ShowDialog() == DialogResult.OK:
# set up the export options
options = ImageExportOptions()
options.ExportRange = ExportRange.VisibleRegionOfCurrentView
options.FilePath = dialog.FileName
options.HLRandWFViewsFileType = ImageFileType.PNG
options.ImageResolution = ImageResolution.DPI_72
options.ZoomType = ZoomFitType.Zoom
options.ShadowViewsFileType = ImageFileType.PNG

doc.ExportImage(options)

__window__.Close()
20 changes: 20 additions & 0 deletions Draft_halftoneSelectedElementsInActiveView.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from Autodesk.Revit.DB import Transaction
from Autodesk.Revit.DB import OverrideGraphicSettings
from Autodesk.Revit.DB import Group

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

__window__.Close()

with Transaction(doc,"Set Element Override") as t:
t.Start()
for el in selection:
if isinstance(el, Group):
for mem in el.GetMemberIds():
selection.append(doc.GetElement(mem))
ogs = OverrideGraphicSettings()
ogs.SetHalftone(True)
ogs.SetProjectionFillPatternVisible(False)
doc.ActiveView.SetElementOverrides(el.Id, ogs);
t.Commit()
16 changes: 16 additions & 0 deletions Draft_resetElementGraphicOverrides.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
__window__.Close()
from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

with Transaction(doc,"Set Element Override") as t:
t.Start()
for el in selection:
ogs = OverrideGraphicSettings()
doc.ActiveView.SetElementOverrides(el.Id, ogs)
t.Commit()
14 changes: 14 additions & 0 deletions Draft_setDimsToEQ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from Autodesk.Revit.DB import Transaction

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

__window__.Close()

t = Transaction(doc, 'EQ dimensions')
t.Start()

for el in uidoc.Selection.Elements:
el.ValueOverride = 'EQ'

t.Commit()
17 changes: 17 additions & 0 deletions Draft_solidLineSelectedElementsInActiveView.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from Autodesk.Revit.DB import Transaction
from Autodesk.Revit.DB import OverrideGraphicSettings
from Autodesk.Revit.DB import LinePatternElement

__window__.Close()

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

with Transaction(doc,"Set Element to Solid Projection Line Pattern") as t:
t.Start()
for el in selection:
if el.ViewSpecific:
ogs = OverrideGraphicSettings()
ogs.SetProjectionLinePatternId( LinePatternElement.GetSolidPatternId() )
doc.ActiveView.SetElementOverrides(el.Id, ogs);
t.Commit()
22 changes: 22 additions & 0 deletions Draft_whiteOutSelectedElementsInActiveView.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)

# id = uidoc.Selection.PickObject(ObjectType.Element,"Select an element").ElementId
with Transaction(doc,"Set Element Override") as t:
t.Start()
for el in selection:
if el.ViewSpecific:
continue
elif isinstance(el, Group):
for mem in el.GetMemberIds():
selection.append(doc.GetElement(mem))
ogs = OverrideGraphicSettings()
ogs.SetProjectionLineColor(Color(255,255,255))
doc.ActiveView.SetElementOverrides(el.Id, ogs);
t.Commit()
Binary file added Edit_flipFacingSelected.png
Loading

0 comments on commit bc8e6d7

Please sign in to comment.