Remove Parameters while Avoiding Built-In Parameters

First time Dynamo user and poster. I love that there is a building coder community out there that I was completely unaware of until recently.

I’m trying to finish a Python script that will batch remove/delete parameters from a family at the project view. This is based on this @awilliams useful post here where she creates new family types from the project view.

The Orchid Parameter.Delete node will delete parameters from the project view but will crash if passed a Built-In Parameter. I wanted to create a node that will delete a list of parameters from a family document but will also catch and pass over any Built-In Parameters that will throw an error.


My attempt at a script here accepts the family document and parameter list inputs, but ultimately no parameters are deleted. The error log message populates in the output, so I know at least the program entered the Transaction loops.

TLDR, my main questions are:
• Am I correct in assuming that this method should remove parameters? (doc.FamilyManager.RemoveParameter§)
When I isolate this I get a Type Error:’ expected FamilyParameter, got Parameter’

Looking at the RevitAPI, this seems like the only method that will remove a parameter. The Orchid Parameter.Delete Node could handle deleting parameters collected from nodes, so I would think the node somehow casts the parameter objects to familyparameter objects that the RemoveParameter method will accept.

• Am I going about this in the wrong way? Should I focus on just trying to filter out the Built-In parameters before passing it to the Parameter.Delete node?
On previous attempts I found that using the Parameter.GetbuiltInParameterName node with a BoolMask did not catch all the built-in parameters in my test families.

Any tips appreciated thank you!

@podrick Could you post your dyn and rvt files (or a link) ? Thanks.

To get the actual FamilyParameter objects from the Family, you should use doc.FamilyManager.Parameters which will return all FamilyParameter objects able to be removed using the RemoveParameter() method. I’ll look a bit more into this tomorrow.

@salvatoredragotta Looks like I can’t upload directly but here’s my google drive link if that’s okay with the current state of the dynamo file and revit

Google Drive Link


The revit model is a sample project with generic Greenheck inline fan family that I tried to manipulate.

Thanks @cgartland! I’ll try that tonight to get the Family Parameters directly

So doc.FamilyManager.Parameters returns FamilyParameterSet objects. Unfortunately I’m not finding much documentation or forum discussion on those…can a FamilyParameterSet be manipulated to get FamilyParameters?

As another workaround to get the FamilyParameter objects I also tried using the Family Manager Parameter String property. The Orchid package also uses parameter string names as input to the Parameter.Delete node so I figured this could be the right path.

Right now I’m stuck trying to get IronPython to follow the correct Overload.

I pass it the parameter string names, but get a ‘TypeError: expected GUID, got str’
It’s clearly using the first overload constructor as opposed to the second one I want

This problem has come up a lot on the discussions, I tried manually inputting Overloads and the specific function but it did not work
I tried following this Overloads solution for reference

The error I get when trying to manually force an Overload is:
AttributeError: ‘indexer#’ object has no attribute ‘Overloads’

As far as I know you cannot delete a parameter from a family without opening the family. You first need to load the family into memory before you can do any operations on it (just like with project files).
Here is some code that I use for renaming parameter names in families. With some small modifications you should be able to use it for deleting parameters instead of renaming.

import clr

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

import Autodesk
from Autodesk.Revit.DB import *

import Revit

search = IN[0]
replace = IN[1]
families = UnwrapElement(IN[2])

found = []
notfound = []

class FamilyLoadOption(IFamilyLoadOptions):
	def OnFamilyFound(self,familyInUse,overwriteParameterValues):
		overwriteParameterValues = True
		return True
	def OnSharedFamilyFound(self,sharedFamily,familyInUse,FamilySource,overwriteParameterValues):
		return True

reload = []
failed = []
for family in families:
	famdoc = doc.EditFamily(family)
	FamilyMan = famdoc.FamilyManager
	check = 0
	for param in FamilyMan.Parameters:
		paramName = param.Definition.Name
		if search in paramName:
			newname = paramName.replace(search, replace)
				check += 1
	if check > 0:
OUT = found, reload, failed


Your framework worked, thank you so much! I simply removed any language for renaming parameters and used RemoveParameter instead


1 Like