Skip to content

Commit

Permalink
Version 1
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Aug 27, 2015
1 parent 9b3358d commit a761a8f
Show file tree
Hide file tree
Showing 113 changed files with 765 additions and 1,078 deletions.
Binary file added pyRevit/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.
File renamed without changes
Binary file added pyRevit/5020_Desktop_PulldownButton_User.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion pyRevit/Analyse_listLineEndpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

for el in uidoc.Selection.Elements:
for elId in uidoc.Selection.GetElementIds():
el = doc.GetElement( elId )
# print( el.GeometryCurve.EndPoint[0][2] )
# print( el.GeometryCurve.EndPoint[1][2] )
print( el.GeometryCurve.GetEndPoint(0) )
Expand Down
9 changes: 2 additions & 7 deletions pyRevit/Analyse_sumAllSelectedEntityAreas.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# 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)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

total = 0.0
for i in selection:
total += i.Parameter['Area'].AsDouble()
total += i.LookupParameter('Area').AsDouble()
print("TOTAL AREA OF ALL SELECTED ELEMENTS IS: {0}".format(total))
7 changes: 2 additions & 5 deletions pyRevit/Analyse_sumAllSelectedEntityLengths.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
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)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

def isline( line ):
return isinstance( line, CurveElement )
Expand Down Expand Up @@ -33,4 +30,4 @@ def isline( line ):
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 ))
print("- LINES OF STYLE: {0} -\nTOTAL LENGTH : {1}\n\n".format( k, linestyletotal ))
9 changes: 2 additions & 7 deletions pyRevit/Analyse_sumAllSelectedEntityVolumes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# 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)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

total = 0.0
for i in selection:
total += i.Parameter['Volume'].AsDouble()
total += i.LookupParameter('Volume').AsDouble()
print("TOTAL VOLUME OF ALL SELECTED ELEMENTS IS: {0}".format(total))
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]


cl = FilteredElementCollector(doc)
Expand Down
7 changes: 7 additions & 0 deletions pyRevit/DB_listAllLinePatterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from Autodesk.Revit.DB import FilteredElementCollector, LinePatternElement

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
cl = FilteredElementCollector(doc).OfClass( LinePatternElement )
for i in cl:
print( i.Name )
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Autodesk.Revit.UI

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

if len(selection) > 0:
el = selection[0]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion pyRevit/List_listFamilies.py → pyRevit/DB_listFamilies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from Autodesk.Revit.DB import FilteredElementCollector, Family
doc = __revit__.ActiveUIDocument.Document

cl = FilteredElementCollector(doc)
list = [i for i in cl.OfClass(Family).ToElements() if i.FamilyCategory.Name == 'Doors']
list = [i for i in cl.OfClass(Family).ToElements()]

for family in list:
print('NAME: {0} CATEGORY: {1}'.format( family.Name.ljust(50),
Expand Down
8 changes: 8 additions & 0 deletions pyRevit/DB_listFamilySymbols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from Autodesk.Revit.DB import FilteredElementCollector, FamilySymbol, Element, ElementType
doc = __revit__.ActiveUIDocument.Document

cl = FilteredElementCollector( doc )
list = cl.OfClass( ElementType )

for f in list:
print( Element.Name.GetValue( f ), ElementType.FamilyName.GetValue( f ))
13 changes: 13 additions & 0 deletions pyRevit/DB_listLevels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]


cl = FilteredElementCollector(doc)
list = cl.OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType()

for i in list:
print('Level ID:\t{1}\t\t\tName:\t{0}'.format(i.Name, i.Id.IntegerValue))

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]


cl = FilteredElementCollector(doc)
Expand Down
34 changes: 0 additions & 34 deletions pyRevit/Desktop_renamePDFSheetsOnMyDesktop.py

This file was deleted.

14 changes: 11 additions & 3 deletions pyRevit/Draft_bringToFrontSelected.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
__window__.Close()
from Autodesk.Revit.DB import Transaction
from Autodesk.Revit.DB import DetailElementOrderUtils as eo

with Transaction(doc,"Bring Selected To Front") as t:
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

with Transaction( doc, 'Bring Selected To Front' ) as t:
t.Start()
for el in selection:
eo.BringForward(doc, doc.ActiveView, el.Id)
for elId in uidoc.Selection.GetElementIds():
try:
eo.BringForward( doc, doc.ActiveView, elId )
except:
continue
t.Commit()
17 changes: 0 additions & 17 deletions pyRevit/Draft_changeLineToSolid.py

This file was deleted.

18 changes: 5 additions & 13 deletions pyRevit/Draft_exportViewAsImage.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
'''
exportImage.py
Export the currently visible view as a PNG image to a location specified by the user.
'''

__window__.Close()
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import DialogResult, SaveFileDialog
from Autodesk.Revit.DB import ImageExportOptions, ExportRange, ImageFileType, ImageResolution, ZoomFitType

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'
Expand All @@ -23,10 +17,8 @@
options.ExportRange = ExportRange.VisibleRegionOfCurrentView
options.FilePath = dialog.FileName
options.HLRandWFViewsFileType = ImageFileType.PNG
options.ImageResolution = ImageResolution.DPI_72
options.ImageResolution = ImageResolution.DPI_600
options.ZoomType = ZoomFitType.Zoom
options.ShadowViewsFileType = ImageFileType.PNG

doc.ExportImage(options)

__window__.Close()
10 changes: 4 additions & 6 deletions pyRevit/Draft_halftoneSelectedElementsInActiveView.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from Autodesk.Revit.DB import Transaction
from Autodesk.Revit.DB import OverrideGraphicSettings
from Autodesk.Revit.DB import Group
__window__.Close()
from Autodesk.Revit.DB import Transaction, OverrideGraphicSettings, Group

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

__window__.Close()

with Transaction(doc,"Set Element Override") as t:
with Transaction(doc, 'Halftone Elements in View' ) as t:
t.Start()
for el in selection:
if isinstance(el, Group):
Expand Down
13 changes: 5 additions & 8 deletions pyRevit/Draft_resetElementGraphicOverrides.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
__window__.Close()
from Autodesk.Revit.DB import *
# from Autodesk.Revit.DB.Architecture import *
# from Autodesk.Revit.DB.Analysis import *
# import Autodesk.Revit.UI
from Autodesk.Revit.DB import Transaction, OverrideGraphicSettings

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

with Transaction(doc,"Set Element Override") as t:
with Transaction(doc, 'Reset Element Override') as t:
t.Start()
for el in selection:
for elId in selection:
ogs = OverrideGraphicSettings()
doc.ActiveView.SetElementOverrides(el.Id, ogs)
doc.ActiveView.SetElementOverrides( elId, ogs )
t.Commit()
6 changes: 3 additions & 3 deletions pyRevit/Draft_setDimsToEQ.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
__window__.Close()
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:
for elId in uidoc.Selection.GetElementIds():
el = doc.GetElement( elId )
el.ValueOverride = 'EQ'

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

__window__.Close()
from Autodesk.Revit.DB import Transaction, OverrideGraphicSettings, LinePatternElement

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

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);
doc.ActiveView.SetElementOverrides( el.Id, ogs );
t.Commit()
22 changes: 0 additions & 22 deletions pyRevit/Draft_whiteOutSelectedElementsInActiveView.py

This file was deleted.

19 changes: 19 additions & 0 deletions pyRevit/Draft_whiteOutSelectedModelElementsInActiveView.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
__window__.Close()
from Autodesk.Revit.DB import Transaction, OverrideGraphicSettings, LinePatternElement

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

with Transaction(doc, 'Whiteout Selected Elements' ) 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()
2 changes: 1 addition & 1 deletion pyRevit/Edit_flipFacingSelected.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from Autodesk.Revit.DB import Transaction

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

t = Transaction( doc, 'Flip Facing Selected Doors')
t.Start()
Expand Down
2 changes: 1 addition & 1 deletion pyRevit/Edit_flipHandSelected.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from Autodesk.Revit.DB import Transaction

doc = __revit__.ActiveUIDocument.Document
selection = list(__revit__.ActiveUIDocument.Selection.Elements)
selection = [ doc.GetElement( elId ) for elId in __revit__.ActiveUIDocument.Selection.GetElementIds() ]

t = Transaction( doc, 'Flip Hand Selected Doors')
t.Start()
Expand Down
Loading

0 comments on commit a761a8f

Please sign in to comment.