Instance Parameter Exists in Unplaced Family

Hi,

So, this came from a twitter query… if we wanted to check which families contain an Instance Parameter & that family is not placed…

Is it possible to check without placing then deleting every family in the project?!

Here’s a graph and some test files I’ve been playing with, you can see that I am correctly returning the Type Parameter exists, but incorrectly returning that the Instance Parameter doesn’t exist.

Any help would be great,

Thanks!

Mark

Find Parameters In Family-1.dyn (40.2 KB)

test.rvt (1.6 MB)

In the same way that a family instance does not have access to type properties, a family type does not have access to instance properties. I think your only other option is to open the family document and check the parameter list there.

1 Like

Thanks Nick,

I’m sure you’re right :slight_smile:

But it’s a niggle… Obviously we do see these in Revit… when I get in the office tomorrow I’ll have a play with Parameter Maps… it does seem to be operating in a Family class rather than a Type class… It says All Parameters…

https://www.revitapidocs.com/2020/f3615aef-5a80-26d7-fe0d-18fc4285a277.htm

https://www.revitapidocs.com/2020/82c45482-a018-32e4-d8e5-9751e10ffeb9.htm

https://www.revitapidocs.com/2020/6548108c-0ba1-b02a-3c01-e0145ddce53d.htm

Edit: I haven’t looked in detail, but Door Mark is returned here, so maybe there’s something to be got, I don’t mind if it comes back blank as long as I can get it’s name :slight_smile:

I’d be curious to see if you can figure this out. Would be nice for QCing models and families.

So this…

#thanks everyone for their help!
import clr
import sys


# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System

den = UnwrapElement(IN[0])
dln = []
output = []

for d in den:
	dln.append(d.GetOrderedParameters())
	
	
for dl in dln:
	paramNames = []
	for l in dl:
		paramNames.append(l.Definition.Name)

	output.append(paramNames)
    
OUT = output

Gets this…

image

Not much help!

Edit: If I run it on a family type I get type parameters, but not instance :frowning:

I guess my first question is how are you searching for families that aren’t placed? After that, once you get the families you want, as @Nick_Boyts said the next step I would do is open the family, check each parameter if it is instance, and then close the family but I could see this getting resource intensive depending on the model size.

But then this gets harder because all families have instance parameters like base level or offset or mark, etc. and I am not sure if these would show up in your checking.

Thanks Kenny,

Like this…

But yes, I was hoping when the documentation said ‘all parameters’ it meant through the sub-classes, but it doesn’t… So I just get the parameters directly available to a family, e.g. Shared, Hosted (or I get the Type parameters if I run it on a Type).

I’d hoped to avoid the create and delete method.

Never mind, seems like a dead end.

Thanks anyway,

Mark

Or not…

Got a breakthrough :smiley:

image

#thanks everyone for their help!
import clr
import sys


# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System


# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

fams = UnwrapElement(IN[0])

famParams = []
output = []

for fam in fams:
	if fam.IsEditable:
		familyDoc = doc.EditFamily(fam)
		familyMan = familyDoc.FamilyManager
		familyPar = familyMan.GetParameters()
		famParams.append(familyPar)
		TransactionManager.Instance.ForceCloseTransaction()
	save = False
	familyDoc.Close(save)
	else:
		famParams.append('Not Editable')
	
for famParam in famParams:
	paramNames = []
	try:
		for famPm in famParam:
				paramNames.append(famPm.Definition.Name)
	except:
		paramNames.append('Not Editable')

	output.append(paramNames)
    
OUT = output

Still needs some work, but the principle is there… basically background opening the family from within the active document, that gives access to the family manager, then you can get all parameters :smiley:

Cheers,

Mark

Edit: Thanks @john_pierson for noting that I need to close the families after editing

1 Like

I’m following that topic and that looks interesting, but won’t this return only Type parameters and not Instance parameters?

Hey,

Thanks :slight_smile:

No… if you see my screen grab, ‘test’ is a Type and ‘test int’ is an Instance…

It is basically automatically opening the family from inside the project, reading the dialogue you get when you hit the blue squares, then closing the family again…

So it is labour intensive for the programme…

Cheers,

Mark

2 Likes

Hi @Mark.Ackerley

No need to open the Family and Close. You can just edit the family and get the family document.

Edit:For Mark with Close Fam Doc.DYN (13.2 KB)

4 Likes

Um, I am pretty sure you need to close out the document. If I am not mistaken, EditFamily essentially opens the document in memory.

@Kulku, A simple test is to, run your workflow l, then go to Manage>Transfer Project Standards and see if there are any families open that were not before.

I just felt like that was worth mentioning…

1 Like

Thanks @john_pierson. Sorry I missed reading Mark’s Edited comment.

No problem at all. The only reason I know is because I have had some interesting experiences with background opened files. :joy: