Pdf namingrules

Might my monday startup but when setting a generic namingrule as one would do manually (File > PDFexport > namingrule)

We can pick settings from veiws, projectinformation and sheets.

I want to grab a parameter which is from a shared parameter file.

	namingrule = DB.TableCellCombinedParameterData.Create()
	namingrule.CategoryId = DB.ElementId(DB.BuiltInCategory.OST_Sheets)
	namingrule.Prefix = ""
	namingrule.ParamId = DB.ElementId(DB.BuiltInParameter.SHEET_NUMBER)
	namingrule.SampleValue = ""
	namingrule.Suffix = ""
	namingrule.Separator = ""

The above works as expected but now the DB.ElementId(DB.BuiltInParameter.SHEET_NUMBER) should be
sheet.lookupparameter("myparam").

But as it is generic “sheet” isn’t available. How do I get this parameter?
I tried

param_guid = Guid("6a7dbe6d-aedc-4c88-a2cf-f5ece36287c0")
test = DB.ElementId(param_guid)

It feels like I’m close but my head is foggy or so. Any thoughts?

Not sure this is possible

Perhaps another approach? Doing this manually works.

1 Like

Ughh.

For now I’m gonna loop through the sheet to get the param.Id … horrible approach. If someone has a clue: please do share!

I’m not sure I follow…
If you just want a particular shared parameter in a project:

params = FilteredElementCollector(doc).OfClass(SharedParameterElement).ToElements()
paramset = []
for p in params:
	if p.Name == "Depth":
		paramset.append(p)
print(paramset)

From there you can get the definition, ID, guid and other information.
But to get the data - you need to get the information from the object - such as the sheet.
And note that Revit doesn’t clean up shared parameters and you can have multiple shared parameters f the same name (my example above returns two in our template) all pointing to different things. Also, old deleted shared parameters aren’t really deleted - just kind of hidden.

If you want the parameters related to a sheet - you don’t have to loop all the sheets. One sheet will do. FilteredElementCollector(doc).OfClass(ViewSheet).FirstElement() is fast and gives you the first sheet it finds. From there just get Parameters, ParametersMap or GetOrderedParameters() depending on what you’re doing.

def getparam(doc)
	sheet = FilteredElementCollector(doc).OfClass(ViewSheet).FirstElement()
	params = sheet.GetOrderedParameters()
	for param in params:
		if param.Definition.Name == "Sheets Submittal Date 02":
		return param

Note: The above gets the first parameter it finds with the name. So, if you have several of the same name on the same object class - you have to further check. (Does happen.) Same as the LookUpParameter.