Getting a non BuiltIn parameter that, (upsettingly) has the same name as a built in

I use the get/set BuiltIn paramter names often, but with one titleblock family someone has created the family to use a manual Text scale so that we can schedule the scale on sheet.

Issue is I can get the sheet scale just fine, but does anyone know if there’s a way to force the use of the not-BuiltIn version of a parameter? (in this instance Scale) Dynamo get’s hit and miss and will only fill in about half for me, when it is hitting the built in before the manual parameter.

If I have to redo the parameter and rejig all the schedules it’s not a huge amount of work, just annoying, but if I could avoid that, it would be really nice.

Cheers all.

If it’s a shared parameter you can use its GUID to identify it.

If it’s a built-in parameter then you can query its built-in parameter! If the value returned is null then it’s user defined. That’s how I do it when dealing with non-shared parameters.

What if the built-in parameter != null and you still want the non-shared parameter?

One possible solution is to use Element.GetParameters() to get all (both) parameters and discard the parameter (value) equal to the built-in one.

@Einar_Raknes the built-in parameter will always return null if its not OOTB. Built-in means exactly that, there are no exceptions, (not that I am aware of anyway) as it would be a contradiction. Its therefore a reliable test.

As an example, I’ve added a user defined Type parameter called myParameter to Doors. Firstly, (using Revit Lookup) every parameter listed has a Definition property which provides access to its BuiltInParameter. If its OOTB, this parameter will always return a value:

In contrast, here’s myParameter, which reports null when querying its BuiltInParameter (as expected, as its not built-in!):

I think the case is when you have two parameters with the same name, and you do not want the Built-In one.

As I said, just evaluate the BuiltInParameter value of each parameter and only return the value that’s null (Invalid) :

#Copyright 2017. All rights reserved. Bimorph Consultancy LTD, 5 St Johns Lane, London EC1M 4BH
#Written by Thomas Mahon @Thomas__Mahon Package: bimorphNodes
#Follow: | | @bimorphBIM

import clr

import RevitServices
from RevitServices.Persistence import DocumentManager

import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

t = UnwrapElement(IN[0])
lookUpParamName = IN[1]

parameters = t.Parameters

userDefinedParameter = []
for p in parameters:
	definition = p.Definition
	name = definition.Name
	bip = definition.BuiltInParameter

	if name == lookUpParamName and bip == BuiltInParameter.INVALID:
		userDefinedParameter.append( [p, p.AsString()] )
OUT = userDefinedParameter
1 Like

Thank you @Thomas_Mahon, that last example was crystal clear. Sorry for having such a slow brain.

1 Like