- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I did some digging on the forums, and I'm not having any luck finding a clear explanation for this one. Specifically, I'm trying to duplicate sheets and transfer all the parameter data with them. I'm having no problems using ViewSheet.Create() to duplicate the sheet, but we have many Shared Project Parameters on the sheet that control the visibility of different parts of the key plan, and I'd like these Yes/No settings to carry over as well. For any parameter in old_sheet, how can I find the parameter in new_sheet? I am trying to avoid using the name property, since duplicate parameter names have been known to occur. I thought I'd be able to compare the definitions, but that hasn't worked:
old_sheet_params = old_sheet.Parameters
new_sheet_params = new_sheet.Parameters
param_dict = {}
for param in old_sheet_params:
if param.StorageType == DB.StorageType.String:
val = param.AsString()
elif param.StorageType == DB.StorageType.Double:
val = param.AsDouble()
elif param.StorageType == DB.StorageType.Integer:
val = param.AsInteger()
else:
val = None
param_dict[param.Definition] = param.Definition.Name, val
print('{} {} {}'.format(param.Definition.Name, val, param.Definition))
print('\nNEW PARAMS\n')
for param in new_sheet_params:
if param.Definition.Name == 'Sheet Number':
continue
if param.Definition in param_dict:
print('definition found.')
new_val = param_dict[param.Definition][1]
else:
continue
print('{} {} {}'.format(param.Definition.Name, new_val, param.Definition))
Solved! Go to Solution.