MEP - How to set dialog box values

Hi Everyone,

Thanks to previous help I was able to setup a little script to eliminate a Warning givin by Revit for MEP Duct fittings by changing the the Loss Method to “Specific Loss”.

Warnings_NoLossDefined

Now I’d like to change the default value of the “Specific Loss” to something other than 0. I’ve looked for ways of inputing this value in but can’t seem to be able to write my value in???

“Loss Method Settings” is a parameter of the fitting but I can’t write anything to it… How can I get to the right dialog box? Because this will also apply to other parameters that have dialog boxes…

 

Specific_Loss_Setting_Dyn_Error

Specific_Loss_Setting_Rvt_ValueSetting

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thanks

 

 

Hi Jonathan,

If your looking to set “Loss Method Settings” you need to get built in Parameter name that is “RBS_DUCT_FITTING_LOSS_METHOD_SERVER_PARAM” from Revit Lookup Table and then use Python script to Set your values. See below workflow. Good Luck!

Untitled3

Hello Kulkul! Thank you for the answer! I have also been troubled by this problem. Could you please repost the Python script? It is a little hard for me to tell the letters from the picture in your answer QQ Many thanks again!

Untitled1

Hi Kulkul,

I just got back from the holidays! Thanks for the reply. I’m just starting with Dynamo and if I understand correctly there is no other way to do this without using a Python script? I’ll rewrite what you did without rely knowing what I’m doing…

Would you say I’d have to use Python scripts to modify every dialog box in Revit since we can’t do it with Dynamo nodes?

Thanks

And how did you get the “Snoop parameter” and “Enum mappings” windows???

You need to download “Revit Lookup Table” here is the download link for 2016 https://app.box.com/s/5hxbjrtgk77a80uwvycvfxinjvo9tzvt

Just extract the contents of the zip file into your Revit 2016 addins folder (C:\ProgramData\Autodesk\Revit\Addins\2016</span> )

and for 2015 is here https://docs.google.com/file/d/0B7VxBYKCiaH7YllnRzQ2QUlFc2M/edit?pli=1

Extract the 2 files to<i style=“color: #000000;”>C:\ProgramData\Autodesk\Revit\Addins\2015&lt;/i>

Good Luck!!!

So I retyped the script and it’s giving me and error that I can’t seem to fix… I opened a blank project, modeled a couple of duct with elbow and ran the script. I eliminated the errors with the first script but didn’t write the value 10 with the second script because of an error in my Python Script attempt :wink:

Here’s my Python Script corrected with mistakes I made. But it still bugs at line 43 for some reason…

Warnings_NoLossDefined_20160106

import clr
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.ExternalService import *
from Autodesk.Revit.DB.ExtensibleStorage import *
from System.Collections.Generic import*

clr.AddReference(“ProtoGeometry”)
from Autodesk.DesignScript.Geometry 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
from System.Collections.Generic import *

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

def getServerByID(serverGUID, serviceId):
service = ExternalServiceRegistry.GetService(serviceID)
if service != “null” and serverGUID != “null”:
server = service.GetServer(serverGUID)
if server != “null”:
return server
return null
lc=[]
def getLossMethods(serviceID):
service = ExternalServiceRegistry.GetService(serviceID)
serviceIDs = service.GetRegisteredServerIDs()
list=ListElementId
for serverId in serverIds:
server = getServerByID(serverID, serviceId)
#ductServer = server.IDuctFittingAndAccessoryPressureDropServer

id=serverId
name=server.GetName()
lc.append(id)
lc.append(name)
lc.append(server)

return lc
elems=UnwrapElement(IN[0])
SetNew = IN[1]
elem=[]
for el in elems:
eleId = el.Id
fitting = doc.GetElement(eleId)
param = fitting.get_Parameter(BuiltInParameter.RBS_DUCT.FITTING_LOSS_METHOD_SERVER_PARAM)
lc = getLossMethods(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropServices)
schema = lc[8].GetDataSchema()
field = schema.GetField(“Coefficient”)
entity=fitting.GetEntity(schema)

oldval = entity.Getfield.ValueType # obtaining values

TransactionManager.Instance.EnsureInTransaction(doc)
entity.Set[field.ValueType](field, SetNew) # installation of a new coefficient value of certain
fitting.SetEntity(entity)
TransactionManager.Instance.TransactionTaskDone()
elem.append(fitting)
OUT = elem

Kulkul: Thanks for the Lookup Table install instructions. Can I modify this value without Python? I found the Builtin parameter node Sylvester was talking about but I can’t seem to modify the value I’m looking for… see dyn file in previous reply to see different “attempts”. Looking around the lookup tables:

Here is the dyn file Change - Coeff. - loss - fitting - duct

1 Like

Tried it and it works great! Thank you for your precious time!

Now my question is can this be done without Python? Because I’d like to do this myself and know nothing about python language. I’m just getting started with Dynamo…

I don’t think we can do this without “Python”. If your interested learning Python check out this website https://docs.python.org

Good Luck!

Well, thanks for your help on this problem. It’s very appreciated!

Hi All

Yes, there are a number of Revit parameters that are pretty complicated or atypical. MEP in particular has some specialized interactions, so I’m not too surprised by needing to make special scripts to address parameter inputs. Some of these situations may have been addressed by packages that others have shared, community contributions have grown faster than I can keep up with though, so would not be surprised if some packages have been posted that address this need. As you can see, trying to describe the problem is a challenge in itself, which makes searching for answers difficult. The challenge with dialog box parameters is that they are, almost by definition, complicated because they have identified that their data inputs are more developed than a simple number, integer, Boolean, string value, or Revit object type.

Thanks

Zach

Hey everybody, excuse me if I bring this thread back to life after two years.
I tried the linked dyn both in revit 2016 and 2018 but had the same result: the Loss Method and Loss Method Settings would change, but the calculated value Pressure Drop would not.
i.e. If I input the value by hand the calculated value updates, but with python it does not. Should there be some kind of “update calculated value” code? something like "hey revit I changed the Loss Method Settings so you should recalculate the Pressure Drop value?"or is it not working with Dynamo 1.3?
Thanks

@GregX
It is recommended that you start a new tread and link this conversation in it. It simplifies follow-ups, kudos and solutions. I haven’t been able to dive into Python to help.

1 Like