Revit element seems randomly read-only

Hello peoples! I’m having a problem with the level parameter of my floors.

  1. When I assign a new level to the level parameter of my floors a couple of the level parameters of a couple floors become read-only. I can’t understand why some do work and other don’t. I made a screencast, demonstrating my problem. Am I doing something wrong, bug, anything specifiek I need to add?
    Screencast video, Link to script

and/or

  1. I found 3 other topics touching on this subject. Here @T_Pover seems to solve this by using python. Unfortunately when I copy the python-code, it gives me a nonetype error on line 27. I’m using the code with a list of placed floors, not a total list of [all elements of category]. Im not familiar with revit api nor c# (c# right?) to solve this unfortunately.

pls send help

Hello Alex,

Floors have a different BuiltInParameter for Level so that’s why the code won’t work. You can use this instead:

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

element = UnwrapElement(IN[0])
ref_level = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)

for i,x in enumerate(element):
	ref_levelid = ref_level.Id
	
	object_param_level = x.get_Parameter(BuiltInParameter.LEVEL_PARAM)
	object_param_level.Set(ref_levelid)

TransactionManager.Instance.TransactionTaskDone()

This only works on with a single level, if you want to use it with different levels, just change line 23 to this:
ref_levelid = ref_level[i].Id

Thanks a lot! I got it working.

1 Like

There is something strange happening. Here you can see the output of the element.GetparameterValue… is empty. Resulting in the walls not being adjusted to to the bottom of the floors.Incorrect

When I switch to the element list (before the python script) I get results again. And the walls update correct. Correct

It does the same the other way arround, so I dont think it’s a problem with the python script. Once switched, I can switch back again and it works again…
I tried to write directly to built-in parameter. No luck with that. Any ideas?