I have put the following graph together which will collect all the shared parameters from revit file (titleblock family in my case) and put them in the same format as shared parameter.txt file i.e values are separated by tabs
Where are the SharedParameters nodes coming from? I can’t replicate your results without them. Also, it looks like you might be missing a few fields. If you take the sharedparameters.txt file and paste it into a spreadsheet, you can make sure that each field lines up with the proper header (you need to add another tab for DATACATEGORY and DESCRIPTION for the fields to line up properly.
Thanks for including the family as well–but I’m also trying to figure out where SharedParameters.GUID and SharedParameters.Info are downloaded from as they’re not included in Dynamo by default.
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
sys.path.append(r'C:\Program Files\IronPython 2.7\Lib')
import io
filepath = IN[0]
parameter_lists = IN[1]
id = IN[2]
name = IN[3]
# Separate all fields using tab char
parameters_in = ['\t'.join(p)+'\n' for p in parameter_lists]
# Create new group separated by tab chars
new_group = '{g}\t{i}\t{n}\n'.format(g='GROUP', i=id, n=name)
parameters_out = []
with io.open(filepath, 'r', encoding='utf-16') as f:
lines = f.readlines()
for line in lines:
parameters_out.append(line)
# Insert new group after *GROUP key
if line[:6] == '*GROUP':
parameters_out.append(new_group)
parameters_out.extend(parameters_in)
# Overwrite existing file with new data
with io.open(filepath, 'w', encoding='utf-16') as f:
f.writelines(parameters_out)
f.write('')
Revit still doesn’t consider this a valid shared parameters file, so I’m not sure what’s exactly happening but I’ve discovered a few things.
The shared parameters txt file appears to be encoded in UTF-16, as evidenced by null characters between every character if written in binary.
You are missing a few fields in your inputs, as noted in my other comment.
A group has to be added after the *GROUP line as shared parameters must exist within a group.
This is the output of the graph using the default construction template: