Populating shared/project parameters in conduit run schedules

I’m trying to use Dynamo to populate shared/project parameters I’m using for spooling conduit runs. Here’s what I have that seems to almost work.

It seems to populate the conduit run schedule parameters, but the length and comments are being grabbed from a different run of conduit than my two shared parameters.

I’m a new user so I can only post one image at a time. I’ll include a few more below

Any ideas?

EDIT:
This appears to be a similar issue to this thread:

However it doesn’t appear to ever have been actually solved. The final post shows copying the comments parameter to the shared parameter which isn’t quite what I’m aiming for.

Here’s the Identity Data for my selection
image

Here’s what the schedule looks like
image

Hi

If you run the graph, does it give an error?
What does it say?
It will give us a clue

Do you mean running the Dynamo script? If so, everything runs without errors. I can even get my two “SPOOL” parameters to update in the schedule, but they’re showing next to the wrong conduit runs.

If I highlight, let’s say row two, in my schedule an click highlight in model, it highlights a different conduit run, which doesn’t have those two parameters filled out in the properties window.

Is it possible Dynamo is taking my selected elements, and applying those parameter values to the top of the conduit runs list, so to speak? Instead of matching up those elements to their respective conduit run.
I’m not sure if that made sense. Let me know if I need to clarify.

Ah now i see
Your element selection method is off
It produces lists in a different order if you have two or three mixed methods
use one selection node at the time and make multiple connectors
i’d go for the Element Types one :slight_smile:

Here’s our original bit of script, slightly modified from a post from that other thread.

I think it follows the method you’re recommending…

However our Revit model is quite large, and this script takes upwards of 40 minutes to run. Which I why I tried to change to a user selection.

Is it possible to use something like this to get the ID’s of the respective conduit runs based off the selected elements and apply the parameter values accordingly?

i can see why it is taking too long now,
you are getting the parameter value and setting it back to the same object

What I find interesting, is this script didn’t appear to have this issue yesterday. I ran it a few times, and it did take some time, maybe around five minutes or so. However, today I had to force close Revit after about 40 minutes of the script trying to run.

way better than any dynamo method is to take you schedule and use sorting and grouping, don’t forget to untick the itemize all button after sorting, and fill in the empty cells.

Then read the Dynamo Primer, we all did

Unfortunately, that’s the problem.
The only parameter that links between a Conduit Run and it’s children is the comments, which we don’t want to use for this purpose. So when creating the schedule, those values appear blank even if the individual elements have them filled out.

Hence the purpose of this dynamo script.

Been trying to find time to read the primer, as I’m admittedly not well versed in Dynamo. Unfortunately I’m in a bit of a time crunch with this project.

i’m sure someone else here can help you better, i’m sorry, and you have been very polite

1 Like

No problem. I appreciate the effort!

2 Likes

Sounds like an element binding issue… post a Revit model and the dyn here it to another file sharing service and I will look into that. If I’m right I’ll return with instructions on how to fix it and will take the time to explain what it is and why it happens.

Was this ever solved? I an trying to do something similar and decided to search rather than make another post with the same question.

Read up on element binding (use the search on this webpage)
It might lead you somewhere :slight_smile:

We ended up moving to a new solution so I never circled back to this, but may be able to help you out. Are you trying to select a conduit and push a parameter from that object back to the conduit run it belongs to?

I am new to Dynamo and my goal is to get the conduit run schedule to populate other parameters other than the default which is just comments.

I don’t recall ever seeing JacobSmall’s message, so I never did end up looking further into element binding. So perhaps there is a better way than what I’m about to send, but I’ve attached a Dynamo script that should work for you.

It doesn’t monitor for changes or anything like that. So if you make a change after the initial run you’ll have to re-run this script. Also I threw this together in probably about 30 minutes, so there’s no error checking but it should work.

Input the names of the parameters you want to copy in the “Comma Separated Parameters” input - don’t put spaces between the parameters, just commas. If there is a space in the parameter name that is fine, it will still work.
Then select 1 piece of conduit on each run, and hit the play button. It should push the values from the parameters you selected into their respective Conduit Runs.

Here’s the code if anyone is interested and doesn’t want to download the script:

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import * 

# Import RevitNodes
clr.AddReference("RevitNodes")
import Revit

# Import Revit elements & geometry conversion methods
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#The System namespace at the root of .NET
import System 

# Import RevitAPI - This gives general access to Revit tools.
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import * 

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

#Active Revit file
doc = DocumentManager.Instance.CurrentDBDocument 
#UI level interfaces
uiapp = DocumentManager.Instance.CurrentUIApplication
#Current instance of Revit
app = uiapp.Application
#UI level interfaces of the current instance of Revit
uidoc = uiapp.ActiveUIDocument 

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

params = IN[1]

#Start Code

params = params.split(',')

sel = uidoc.Selection.GetElementIds()
sel = [doc.GetElement(x) for x in sel]

parent_types = [sel[0].LookupParameter(x).StorageType for x in params]

run_list = []

TransactionManager.Instance.EnsureInTransaction(doc)
for elem in sel:
    param_vals = []
    run = doc.GetElement(elem.RunId)
    for count, param in enumerate(params):
        if parent_types[count] == StorageType.Double:
            param_vals.append(elem.LookupParameter(param).AsDouble())
        elif parent_types[count] == StorageType.Integer:
            param_vals.append(elem.LookupParameter(param).AsInteger())
        elif parent_types[count] == StorageType.String:
            param_vals.append(elem.LookupParameter(param).AsString())
    [run.LookupParameter(p).Set(v) for (p,v) in zip(params,param_vals)]
TransactionManager.Instance.ForceCloseTransaction()    

#Assign output
OUT = 0

image
Copy Parameter Value to Conduit Run.dyn (7.2 KB)

I supposed I should put in another caveat - this script assumes that both the Conduit and the Conduit Run have the parameters you listed. If you need to add new ones you can do this through the Project Parameters menu in the Manage tab.

I am going to attempt to use this script but I still don’t fully understand the code as I am still learning python.
it still confusing to me… there is a script that I want to write for duplicating views multiple times but I got stuck on the filtered element collector (Document) constructor. there is alot of document classes in the api i dont know which to use.