In some cases I found I need to schedule length for something not modelled as 3d. The best way is to schedule detail component. So it won't interference with other schedules. And can stay in the file for later references. But by default, in revit, you can not direct schedule detail component. There is a way around it by suing annotation symbols to pass the parameters from detail component into Note Block schedule. Refer to below for simple instructions.
1. create a line based detail component.
2. create a fill region to represent the length
3. create an annotation symbol family, make it shared for appering in schedule. create a instance parameter inside it called symLength.
4. load the annotation symbo into detail component family.
5. link length parameter to the symbol symLength parameter.
6. load detail component family into a test project
7. draw several instance of detail family
8. create a note block schedule pick the annotation family crated before. pick symLength to schedule.
9. Now you can have the length from detail component scheduled.
You can do the similar thing for scheduling rectangular area. It may be useful to calculate things in a hurry. Just need to do a formula inside detail component to calculate it first. Then passes it to symbol family for scheduling in note block schedule.
It is always difficult to clean reference planes in a file that has been touched by many people. They are everywhere. One rule is to name the one you want to keep. and the unnamed ones can be removed to decease file size or visual discomfort. See script below:
#this revit 2013 python is to delete all useless sections and
#unnamed reference planes
import clr
import math
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
from Autodesk.Revit.DB.Analysis import *
from Autodesk.Revit.UI.Selection import *
from Autodesk.Revit.UI import *
from System import *
#methods
def cleanReferencePlane():
# grab all reference planes
rpInstancesFilter = ElementClassFilter(clr.GetClrType(ReferencePlane))
collector = FilteredElementCollector(doc)
rPlaneId = collector.WherePasses(rpInstancesFilter).ToElementIds()
# go through ids delete unnamed ones.
for id in rPlaneId:
s = doc.get_Element(id).Name
if s.Equals("Reference Plane", StringComparison.Ordinal):
doc.Delete(id)
def cleanSection():
print ("to be done...")
#define a transaction variable and describe the transaction
t = Transaction(doc,'Clean Section ReferencePlane')
#start a transaction in the Revit database
t.Start()
#************ ADD YOUR OWN CODES HERE.******************
#get all filled regions
y=int(raw_input("clean sections and reference planes: 1.clean both 2.clean sections 3. clean reference planes: "))
if y==1:
print "clean sections and reference planes..."
cleanReferencePlane()
cleanSection()
elif y==2:
print "clean sections only..."
cleanSection()
elif y==3:
print "clean reference plane only..."
cleanReferencePlane()
#print "end"
#commit the transaction to the Revit database
t.Commit()
#close the script window
raw_input("Enter to Quit.....")
#__window__.Hide()
__window__.Close()
#__window__.Show()
hi, I rewrote the code in python script for revit 2012/2013, see how it works in video
the code is below, copy and save the code in a file named "sortSheetViews.py" or whatever. then follow the video to add this script to revit ribbon
import clr
import math
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
from Autodesk.Revit.DB.Analysis import *
from Autodesk.Revit.UI.Selection import *
from Autodesk.Revit.UI import *
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
#selection = list(__revit__.ActiveUIDocument.Selection.Elements)
uidoc = __revit__.ActiveUIDocument
#selection = __revit__.ActiveUIDocument.Selection.Elements
selelementsid=[]
#############################method###################################
#get views in a list
def viewSelectInList():
sel = uidoc.Selection
sel.Elements.Clear()
loopSwitch = 1
while loopSwitch==1:
pickedOne = sel.PickObject(ObjectType.Element,"Pick view one by one, pick title block to finish")
if pickedOne!= None : #revit 2013 use the statement below
e = doc.GetElement(pickedOne.ElementId) #revit 2012 use the statement below
#e = doc.GetElement(pickedOne)
# TaskDialog.Show("Revit", e.Category.Name)
if e.Category.Name.Equals("Title Blocks"):
# TaskDialog.Show("Revit", e.Category.Name)
loopSwitch = 0
else:
selelementsid.append(e.Id)
# TaskDialog.Show("Revit", e.Category.Name)
else:
break
def reNumber (startInt):
currentNo = startInt
for eId in selelementsid:
setViewPortNumber(eId,currentNo)
currentNo += 1
def getViewByDetailNumber (vs,i):
for v in vs.Views:
if v.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).AsString() != None:
if i == int(v.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).AsString()):
return v
def setViewPortNumber (id, number):
vs = doc.ActiveView
stringOldNumber=doc.get_Element(id).get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).AsString()
# print "viewport detail number: ",stringOldNumber
if int(stringOldNumber) != number:
if getViewByDetailNumber(vs, number) != None:
#*****************to be finished here *****************
getViewByDetailNumber(vs, number).get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).Set("999")
doc.get_Element(id).get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).Set(str(number))
getViewByDetailNumber(vs, 999).get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).Set(stringOldNumber)
else:
doc.get_Element(id).get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).Set(str(number))
#define a transaction variable and describe the transaction
t = Transaction(doc,'Sort Views in Sheet')
#start a transaction in the Revit database
t.Start()
#************ ADD YOUR OWN CODES HERE.******************
x = int(raw_input ("number start from: "))
viewSelectInList()
reNumber ( x )
#print "finished"
#************** END OF YOUR MAJOR CODES HERE.*********************
#commit the transaction to the Revit database
t.Commit()
#close the script window
__window__.Close()
the above video teachs how to add such scripts to revit ribbon
This free add-in is for batch exporting dwg files from revit drawing sheets. It is similar as the previous free add-in print pdf with sheet number and revision. Close all hidden windows before start exporting. If crashes during exporting try the one by one button. Or just export current active sheet view.
For Windows XP - C:\Documents and Settings\All Users\Application Data\Autodesk\Revit\Addins\2012\
For Vista/Windows 7 - C:\ProgramData\Autodesk\Revit\Addins\2012\
-- OR --
In a user specific location
For Windows XP - C:\Documents and Settings\<user>\Application Data\Autodesk\Revit\Addins\2012\
For Vista/Windows 7 - C:\Users\<user>\AppData\Roaming\Autodesk\Revit\Addins\2012\
in windows 7 you may need to unblock the dll by right clicking and select security -> unblock
How to use.
1. click inject default parameters to add default sheet parameters
2. create a sheet schedule and customize your pdf names
3. create a sheetset to put the sheets for printing there
4. change pdf setting as you want
5. save the setting so you can load it later
6. click print After changing any printer settings, you need to restart revit.
This addin \ plug-in is free. If you like it please donate by click the link below.
Revit application macro modules usually saved in:
C:\ProgramData\Autodesk\Revit\Macros\2012\Architecture\VstaMacros\AppHookup\
to install application macros, you just need to copy your application macro module folder under it. You can also duplicate macro modules from this folder and copy onto different machines. The only disadvantage is macro contains source code. if you don't want to share source code with others. try to build add on or plug-ins.
Revit application macro is easy to develop using vsta. And easy to debug. If you are not aiming to sell your program, and not care about sharing the source code, it is a good and time saving tool. To deploy it is as easy as copying you module file under your revit.
The main tricks for setting up revit application Macro is reference passing. In ThisApplication.cs , the module class, you need to pass 'this',which is the running application itself to your macro class.
In your macro class, you need to define 3 variables,
1. m_app point to running application
2. m_uidoc point to active uidocument , you can use it to get user selection, etc.
3. m_doc point to current active document, the opening revit file you want to modify.
now is the form class, the user interface to take user input if necessary. it is created as an object inside your macro class. just make the controls (elements) public for easy access from macro class. for example:
mainFrame.Textbox1.Text will return you the text input from textbox1(a text field)
also when create this form in macro class, you need to pass macro class itself to it using 'this' key word. the corresponding variable in form class is m_dataBuffer. if you want to access macro class, you can call m_dataBuffer.methodYouWant().
overall, you need 3 files, ThisApplication.cs is created for you by macro manager. ClassMacro.cs for put your business logic(thing to do, to interactive with revit file), Form.cs to interactive with user. put classmacro and form file in a folder for easy management in future.
hi, it is tedious to rename revit pdfs and add revisions as a suffix to company requirement. I just discovered automation tools called, Sikuli, jython(a script language), and itext java package for reading pdfs. It only took me half day to create the program to fetch drawing numbers and revision info then rename the correspongding pdfs. the language is close to simple English and can run on vairious machines with out intallation. do a search and you can find them. and they are all free. Check the video below see how it works.