i would like to delete a level but first i need to find out if there are any and all elements that are using the level for reference or are associated with said level so i dont lose a lot of work?
Gelöst! Gehe zur Lösung
Gelöst von Viveka_CD. Gehe zur Lösung
@jledgewood409 wrote:
i would like to delete a level but first i need to find out if there are any and all elements that are using the level for reference or are associated with said level so i dont lose a lot of work?
Save a copy of the project and delete all the other levels so you can see what is left.
There are two methods to do this:
The @chrisphlyler method ![]()
1. Create a Multi-Category schedule,
The @toan_dn method:)
2. Tile a 3D view and an elevation so you can see both, turn on everything for the 3D view
Let me know if this helps. We do have third-party plugins for the same.
Please select the Accept as Solution button if my post solves your issue or answers your question. Likes welcome!
Regards,
Viveka CD
Designated Specialist - AEC, AR/VR Research
Autodesk playlists| Find Recommended Hardware| System requirements for Revit products| Contact Autodesk Support| Autodesk Virtual Agent| Browse Revit Ideas| Revit Tips/Tricks| Revit Help| Revit Books
Please see AKN article on Creating a Multi-Category Schedule
Regards,
Viveka CD
Designated Specialist - AEC, AR/VR Research
Autodesk playlists| Find Recommended Hardware| System requirements for Revit products| Contact Autodesk Support| Autodesk Virtual Agent| Browse Revit Ideas| Revit Tips/Tricks| Revit Help| Revit Books
so I found the families that are associated with said level and I changed to a different level they will host to. when I tried to delete that said level a message told me that there are several views associated with that level and they will be deleted as well.
is there a way to re-associate the views to a new level?
@jledgewood409 wrote:
so I found the families that are associated with said level and I changed to a different level they will host to. when I tried to delete that said level a message told me that there are several views associated with that level and they will be deleted as well.
is there a way to re-associate the views to a new level?
No. You can copyclip annotation and detail items from those views and paste align to new views.
I discovered this thread when I was working on a new script to select all elements on a level. Now that the script is complete, I'm posting it here for others who find this thread. Simply select an element on the offending level, then run the script (using pyRevit) to select all the elements with matching reference levels. It may take a 15 seconds or more to run on larger projects.
"""
Selects all elements that share the same Reference Level as the selected element.
TESTED REVIT API: 2020.2.4
Author: Robert Perry Lackowski
"""
from Autodesk.Revit.DB import ElementLevelFilter, FilteredElementCollector
from Autodesk.Revit.DB import Document, BuiltInParameter, BuiltInCategory, ElementFilter, ElementCategoryFilter, LogicalOrFilter, ElementIsElementTypeFilter, ElementId
from Autodesk.Revit.Exceptions import OperationCanceledException
# from pyrevit import DB
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
from rpw import ui
import sys
#Ask user to pick an object which has the desired reference level
def pick_object():
from Autodesk.Revit.UI.Selection import ObjectType
try:
picked_object = uidoc.Selection.PickObject(ObjectType.Element, "Select an element.")
if picked_object:
return doc.GetElement(picked_object.ElementId)
else:
sys.exit()
except:
sys.exit()
def get_level_id(elem):
BIPs = [
BuiltInParameter.CURVE_LEVEL,
BuiltInParameter.DPART_BASE_LEVEL_BY_ORIGINAL,
BuiltInParameter.DPART_BASE_LEVEL,
# BuiltInParameter.FABRICATION_LEVEL_PARAM,
BuiltInParameter.FACEROOF_LEVEL_PARAM,
BuiltInParameter.FAMILY_BASE_LEVEL_PARAM,
BuiltInParameter.FAMILY_LEVEL_PARAM,
BuiltInParameter.GROUP_LEVEL,
BuiltInParameter.IMPORT_BASE_LEVEL,
BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM,
BuiltInParameter.INSTANCE_SCHEDULE_ONLY_LEVEL_PARAM,
BuiltInParameter.LEVEL_PARAM,
BuiltInParameter.MULTISTORY_STAIRS_REF_LEVEL,
BuiltInParameter.PATH_OF_TRAVEL_LEVEL_NAME,
BuiltInParameter.PLAN_VIEW_LEVEL,
# BuiltInParameter.RBS_START_LEVEL_PARAM,
BuiltInParameter.ROOF_BASE_LEVEL_PARAM,
BuiltInParameter.ROOF_CONSTRAINT_LEVEL_PARAM,
BuiltInParameter.ROOM_LEVEL_ID,
BuiltInParameter.SCHEDULE_BASE_LEVEL_PARAM,
BuiltInParameter.SCHEDULE_LEVEL_PARAM,
BuiltInParameter.SLOPE_ARROW_LEVEL_END,
# BuiltInParameter.SPACE_REFERENCE_LEVEL_PARAM,
BuiltInParameter.STAIRS_BASE_LEVEL,
BuiltInParameter.STAIRS_BASE_LEVEL_PARAM,
BuiltInParameter.STAIRS_RAILING_BASE_LEVEL_PARAM,
BuiltInParameter.STRUCTURAL_REFERENCE_LEVEL_ELEVATION,
BuiltInParameter.SYSTEM_ZONE_LEVEL_ID,
BuiltInParameter.TRUSS_ELEMENT_REFERENCE_LEVEL_PARAM,
BuiltInParameter.VIEW_GRAPH_SCHED_BOTTOM_LEVEL,
BuiltInParameter.VIEW_UNDERLAY_BOTTOM_ID,
BuiltInParameter.WALL_BASE_CONSTRAINT,
BuiltInParameter.WALL_SWEEP_LEVEL_PARAM
# BuiltInParameter.ZONE_LEVEL_ID,
]
level_id = None
for BIP in BIPs:
param = elem.get_Parameter(BIP)
if param:
# print "A common level parameter has been found:" + str(BIP)
param_elem_id = param.AsElementId()
if param_elem_id.Compare(ElementId.InvalidElementId) == 1:
level_id = param_elem_id
# print "match found on common level parameter " + str(BIP) + "Level ID: " + str(level_id)
return level_id
# print "No matching common level parameters found, checking for .LevelId"
try:
level_id = elem.LevelId
if level_id.Compare(ElementId.InvalidElementId) == 1:
# print "match found on .LevelId. Level ID: " + str(level_id)
return level_id
except:
# print "No LevelId parameter on this element."
pass
# print "Still no matches. Try checking for .ReferenceLevel.Id"
try:
level_id = elem.ReferenceLevel.Id
if level_id.Compare(ElementId.InvalidElementId) == 1:
# print "match found on .ReferenceLevel.Id Level ID: " + str(level_id)
return level_id
except:
# print "No ReferenceLevel parameter on this element."
pass
# print "No matches found. Returning None..."
return None
# print "get selected element, either from current selection or new selection"
selection = ui.Selection()
if selection:
selected_element = selection[0]
else:
selected_element = pick_object()
#print "Element selected: " + selected_element.Name
# print "Search selected element for its reference level's element ID"
target_level_id = get_level_id(selected_element)
# print target_level_id
if target_level_id is not None:
#poor attempts at filtering FECs. Not filtered enough - they contain far too many elements.
#all_elements = FilteredElementCollector(doc).ToElements()
#all_elements = FilteredElementCollector(doc).WherePasses(LogicalOrFilter(ElementIsElementTypeFilter( False ), ElementIsElementTypeFilter( True ) ) ).ToElements()
#Create a filter. If this script isn't selecting the elements you want, it's possible the category needs to be added to this list.
BICs = [
BuiltInCategory.OST_CableTray,
BuiltInCategory.OST_CableTrayFitting,
BuiltInCategory.OST_Conduit,
BuiltInCategory.OST_ConduitFitting,
BuiltInCategory.OST_DuctCurves,
BuiltInCategory.OST_DuctFitting,
BuiltInCategory.OST_DuctTerminal,
BuiltInCategory.OST_ElectricalEquipment,
BuiltInCategory.OST_ElectricalFixtures,
BuiltInCategory.OST_FloorOpening,
BuiltInCategory.OST_Floors,
BuiltInCategory.OST_FloorsDefault,
BuiltInCategory.OST_LightingDevices,
BuiltInCategory.OST_LightingFixtures,
BuiltInCategory.OST_MechanicalEquipment,
BuiltInCategory.OST_PipeCurves,
BuiltInCategory.OST_PipeFitting,
BuiltInCategory.OST_PlumbingFixtures,
BuiltInCategory.OST_RoofOpening,
BuiltInCategory.OST_Roofs,
BuiltInCategory.OST_RoofsDefault,
BuiltInCategory.OST_SpecialityEquipment,
BuiltInCategory.OST_Sprinklers,
BuiltInCategory.OST_StructuralStiffener,
BuiltInCategory.OST_StructuralTruss,
BuiltInCategory.OST_StructuralColumns,
BuiltInCategory.OST_StructuralFraming,
BuiltInCategory.OST_StructuralFramingSystem,
BuiltInCategory.OST_StructuralFramingOther,
BuiltInCategory.OST_StructuralFramingOpening,
BuiltInCategory.OST_StructuralFoundation,
BuiltInCategory.OST_Walls,
BuiltInCategory.OST_Wire,
]
category_filters = []
for BIC in BICs:
category_filters.Add(ElementCategoryFilter(BIC))
final_filter = LogicalOrFilter(category_filters)
#Apply filter to create list of elements
all_elements = FilteredElementCollector(doc).WherePasses(final_filter).WhereElementIsNotElementType().WhereElementIsViewIndependent().ToElements()
# print "Number of elements that passed collector filters:" + str(len(all_elements))
selection.clear()
for elem in all_elements:
elem_level_id = get_level_id(elem)
if elem_level_id == target_level_id:
selection.add(elem)
selection.update()
else:
print "No level associated with element."
@PerryLackowski awesome script ! , immidiatly added it to my personal pyrevit toolbar. (made a separate tool tab with the tools i use the most)
Hi, I am new for pyRevit, could u show how I can run the script by pyRevit? I have not found videos about it. Thanks
Nicolas Catellier, Architect made a good discription of how to add scripts to the pyrevit toolbar.
(he uses screenshots, wich all are verry helpfull)
You can subscribe to his newsletter wich will give you acces to all the phamflets,
do this and look for #15 called "RP-Pamphlet15-py-Revit "
(the other phamflets are intressting as well).
Subscribe on this page to recieve the phamflets:
https://revitpure.com/
Hope this might help, it is how i learned how to add scripts,
and even make a custom tooltab for te company with only the intensivly used scripts.
I have done the schedule method, however, the majority of the project elements are not displaying the level:
These are all associated with levels. Any suggestions to get their level to show up in the schedule or does this only work with particular elements?
I'm not sure it's robust enough to handle every type of element, so I hadn't considered adding it to the main pyRevit toolbar. However, you should be able to watch the pyRevit tutorials on youtube and add it to a button or ribbon tab of your own quite easily.
You can take a look at my comment above, i described how to download the pyrevit tutorial from Revit PURE.
This is a real clear explanation how to add your own scripts to the pyrevit toolbar,
and also how to make a company toolbar i believe.
It is really worth subscribing and downloading the tutorial.
Goodluck
Thanks Ben!
I will look into this over the Weekend and check back.
Have a "festive" Weekend!
PJ Semanek
Hey Ben,
I was able to successfully add the Python script you listed in this forum in Revit 2021, BUT I am trying to add Ceiling elements to the script and getting the error below...
Where am I going wrong?
Thanks to you and Revit Pure for helping me in this regard!
Cheers!
PJ Semanek
I haven't tested, but I think you can take the code in message 9 and just add the OST_Ceiling category to the list of BuiltInCategory items.
I haven't looked at your code too closely, but it seems like you're adding other level parameters that are unnecessary. If you use Jeremy Tammik's Revit Lookup tool and Snoop Objects on a ceiling element, you can see that the parameter set contains two parameters named Level. If you look at the BuiltInParameter name property for those parameters, they are BuiltInParameter.LEVEL_PARAM, and BuiltInParameter.SCHEDULE_LEVEL_PARAM, which are already in my code in message 9. So I think you can just remove the two you added: CEILING_BASE_LEVEL_PARAM and CEILING_CONSTRAINT_LEVEL_PARAM. Your code is erroring because these parameters aren't available in the enumeration BuiltInParameter. You can see all the available parameters here.
Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.