Built in Parameter Python Script

Need some expert eyes to consult on my script.

Trying to get the rooms at Level 3 and change BIP Unbounded Height.

Does this look right?

Trrying to do that for Unbounded height

Paste your code.

The issues I can see:

  1. You don’t declare variable ‘x’, meaning the action on line 24 is void. Try using ‘i’

  2. There’s no need to use the enumerate function since you are (I presume) feeding in a list of objects to IN[0]

  3. No need to unwrap IN[1] as they’re doubles (I presume), not Revit elements

  4. No need to output anything since you’re updating parameters

  5. You cant index using i as its a member of IN[0] (a room) meaning UnboundedHeight[i] will return null. You could do something like the following to iterate through two lists:

    for i, j in zip(element, UnboundedHeight):
    do something

2 Likes

Thanks Tom! Trying to get to grips with API syntax…

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 = DocumentMananger.Instance.CurrentDBDocument

element = UnwrapElement(IN[0])
Unbounded Height = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)

for i in enumerate(element):

object_param_UnboundedHeight = x.get_Parameter(BuiltInParameter.ROOM_HEIGHT)

object_newUnbounded Height = Unbounded Height[i]

object_param_Unbounded Height.Set(object_newUnbounded Height)

TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = element

As Thomas pointed out the code needs some changes, but besides that: I don’t think you can change the parameter ‘Unbounded Height’. It’s a read only parameter, so using a built in parameter probably won’t help much in this case.

Maybe you can use the parameter ‘Limit Offset’ instead? But my knowledge on Rooms and their parameters isn’t that great.

2 Likes

On UnboundedHeight parameter:

I don’t think you can change the parameter ‘Unbounded Height’. It’s a read only parameter [… ]
Maybe you can use the parameter ‘Limit Offset’ instead?

This is correct.

ROOM_HEIGHT aka “Unbounded Height” is read-only and is computed from:

  1. Level (bottom plane) - Fixed based on room placement
    • Upper Limit (top plane), a level element
    • Base Offset (bot plane offset), feets (double)
    • Limit Offset ( top plane offset) feets (double)

You should be able to change the corresponding BIPs (except for #1),
but also note you can change properties 2,3,4 listed above using their property setters instead of builtin params:

room_element.LimitOffset = 5.0
room_element.UpperLimit = SomeLevelElement
room_element.BaseOffset = 5.0

http://www.revitapidocs.com/2015/1ee9db0a-558c-e44a-97af-eadc5cafff76.htm

http://www.revitapidocs.com/2015/760d7f16-c715-1fa5-55b1-3ede2492d9fd.htm

http://www.revitapidocs.com/2015/ee4b5be1-482f-e195-e522-28cc2d90dd9a.htm

1 Like

You are right. I was seeing an arrow on the space which when adjusted modified the Unbounded height and falsely assumed it is editable.

My issue was in a the room bounding boolean of ceiling floors elements as I am intrested in services.

Thanks for revitapidocs I find it very insightful @Gui_Talarico.

1 Like