Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

How to find elements associated with level in Revit before deleting a level

25 ANTWORTEN 25
GELÖST
Antworten
Nachricht 1 von 26
jledgewood409
25842 Aufrufe, 25 Antworten

How to find elements associated with level in Revit before deleting a level

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?

25 ANTWORTEN 25
Nachricht 2 von 26
RobDraw
als Antwort auf: jledgewood409


@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.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Nachricht 3 von 26
Viveka_CD
als Antwort auf: jledgewood409

Hi @jledgewood409

 

There are two methods to do this:

 

The @chrisphlyler method :leicht_lächelndes_Gesicht:

1. Create a Multi-Category schedule,

  • It should consist of the following fields Level, Count and Family and Type.
  • Then sort it by Level
  • Filter it to the particular level you want to be checked to get a list of everything associated with that Level.

 

The @toan_dn method:)

2. Tile a 3D view and an elevation so you can see both, turn on everything for the 3D view

  • Select the level on the elevation, move it a known and far distance from its original.
  • If a warning pops up and tells you 50 things can break then that's it.  Go back to 1.
  • If no warning or only a few things get warned, then go ahead and accept your fate.
  • Look at the 3D view and you will see what moves.  Select all of them, look in the Filter list and jot down the categories included.
  • Undo 'til the elevation back to its original elevation

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,

 

 

Nachricht 4 von 26
jledgewood409
als Antwort auf: Viveka_CD

what category should I put this schedule in?

Nachricht 5 von 26
ToanDN
als Antwort auf: jledgewood409

Multi-Category schedule.
Nachricht 6 von 26
Viveka_CD
als Antwort auf: jledgewood409
Nachricht 7 von 26
jledgewood409
als Antwort auf: Viveka_CD

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?

Nachricht 8 von 26
ToanDN
als Antwort auf: jledgewood409


@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.

Nachricht 9 von 26
PerryLackowski
als Antwort auf: ToanDN

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."
Nachricht 10 von 26
benschilders
als Antwort auf: jledgewood409

@PerryLackowski  awesome script ! , immidiatly added it to my personal pyrevit toolbar. (made a separate tool tab with the tools i use the most)

pyRevitHave a look at my idea: Material priority Revit quick start guide ┃Please accept soulution if my anwser solved your problem
Nachricht 11 von 26
yangshilun2012
als Antwort auf: benschilders

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 

Nachricht 12 von 26
benschilders
als Antwort auf: yangshilun2012

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. 

pyRevitHave a look at my idea: Material priority Revit quick start guide ┃Please accept soulution if my anwser solved your problem
Nachricht 13 von 26
yangshilun2012
als Antwort auf: benschilders

really helpful, I am reading it! Thanks :leicht_lächelndes_Gesicht:
Nachricht 14 von 26
BigPicture045
als Antwort auf: Viveka_CD

I have done the schedule method, however, the majority of the project elements are not displaying the level:

 

BigPicture045_0-1671125723765.png

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?

Nachricht 15 von 26
Phil.Semanek2
als Antwort auf: PerryLackowski

Hi Perry,

I am new to pyRevit and wanted to know if there is a way to run your pyRevit script directly within the pyRevit Panel in Revit 2021?

Thank you so much!

Sincerely,

Phil Semanek
Nachricht 16 von 26
PerryLackowski
als Antwort auf: Phil.Semanek2

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.

Nachricht 17 von 26
benschilders
als Antwort auf: Phil.Semanek2

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

pyRevitHave a look at my idea: Material priority Revit quick start guide ┃Please accept soulution if my anwser solved your problem
Nachricht 18 von 26
Phil.Semanek2
als Antwort auf: benschilders

Thanks Ben!

 

I will look into this over the Weekend and check back.

 

Have a "festive" Weekend!

 

PJ Semanek

Nachricht 19 von 26
Phil.Semanek2
als Antwort auf: Phil.Semanek2

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

Nachricht 20 von 26
PerryLackowski
als Antwort auf: Phil.Semanek2

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.

In Foren veröffentlichen  

Autodesk Design & Make Report