Closed RyanSchw closed 5 years ago
Any progress on this @DanRumery ? I have some time to contribute. If you have a branch with changes I can add on to that. Not sure how you envisioned this being implemented but I'll try to follow along with your current structure.
@RyanSchw
Sorry I've been away for a while. I've just pushed some commits relating to this but the code is currently untested so there are likely some bugs in there. Will do some testing then let you know so you can try it out.
The function you'll use in the task script is revit_script_util.GetAssociatedData() which is intended to return a list of text values that were found in the same row (and to the right) of the Revit file path.
@DanRumery
Where can I find these commits? I'll try to follow your line of thinking as closely as possible since you're much better versed in how this should be implemented. Is there a branch on RBP?
Do you have any ideas on how the settings can be better transferred to the python files? Perhaps we use a function call like settings.get('SETTING NAME')
so that the function can throw a useful error if the setting is not found. Otherwise, I'll continue with the structure that was initially proposed.
@RyanSchw I pushed three commits to master several hours ago. You should be able to see them.
the function is revit_script_util.GetAssociatedData()
but if you look under the hood the actual "transfer" of the data is via ScriptData
class which is serialized/deserialized to/from json so the task script can get at the settings data. Most of the functions simply wrap access to this object.
(Note that this class is instantiated per Revit file and carries the associated data for that file, so there is no need for an explicit mapping elsewhere.)
I've taken a look at the code -- very nice implementation. I've tested the following items and so far it's been working as expected:
main_use_case.csv
xxx\Multiple_Doors.rvt,setting_1,setting_2,setting_3
test_file_path_missing.csv
xxx\Multiple_Doors.rvt,setting_1,setting_2,setting_3
,setting_1,setting_2,setting_3 # Note this one is skipped
test_blank_setting.csv
xxx\Multiple_Doors.rvt,setting_1,,setting_3
test_multiple_revit_files_on_same_line.csv
xxx\Multiple_Doors.rvt,xxx\Multiple_Doors.rvt,setting_2,setting_3 # the first associated data should be xxx\Multiple_Doors.rvt
Cool! I did some regression testing too and all seems to be working. This will be in the next release...
A few of my scripts have some variables that were given by the user as a form input. I want to automate the task, but still enable the user to be able to provide those custom settings.
Off the top of my head, I think the easiest way to do this would be allowing the user to add additional columns in their file list. The python script the user writes (sorry, not sure how Dynamo would work) could reference an import that RBP creates and exports with the python file. Another option would be to do this in conjunction with #36 that manages communication between all of the processes as well.
Example: CSV file
Python script
file_settings.py (created by RBP when it parsed the CSV)