Hello everybody!
I am new to Revit API, and I don't manage to find away to get all the properties available on a FamilyInstance without having a family instance.
So I need to get all the parameters for a category even if there are no family instances of that category in the project.
When using the export to ODBC in REVIT, it generates tables and columns for each category even if not in use. But the columns are much less than the parameters a family instance has.
I tried TableView.GetAvailableParameters but it still does not return as many parameters as FamilyInstance.Parameters property.
I also tried ParameterFilterUtilities.GetFilterableParametersInCommon(doc, category), but again it returns less parameters than FamilyInstance.Parameters.
Is there a way to achive what I need?
Many thanks in advance!
If all else fails, you could create an instance of the type you need in a temporary transaction, and then abort and roll back the transaction after determining what parameters it is equipped with...
let's review elements hierarchy in revit (and other bim softwares):
1- category (for example Structural Framing)
2- Family ( for example an IPE or Box)
3- type ( IPE 18 , Box 30*30)
4- instance - a single IPE 18 at a specific location of the model.
with these definitions, it's obvious that it's not possible to get access to all of the parameters of an instance by analyzing it's related type.
for example an instance have some parameters such as level, length and etc, which a type doesn't have and vice versa- e.g: if you want to get geometry parameters of a Steel beam section, you should use type parameters not instance parameters.
Jeremy, the issue with this approach is that you must know how to instantiate a family symbol for each family - to know exactly which version of Document.Create.NewFamilyInstance function to use and pass appropriate parameters (Face, Curve etc...).
I thought I could treat the families in a more generic manner. I guess there is no other way of creating a "dummy" family instance, right?
Thanks
Alzi, thanks for the response.
Actually all I need is the instance parameters names. If there is a family instance in the project is not a problem - easy to get them. But the problem is when there is no instance of the family in the project.
E.g: even if there is no door in the project I need to know the list of door instance parameters names.
There should be an API for that. In almost all my projects, I need to list the parameters of a category in my user interface. And every time I stumble upon this problem.
Hi, Roxana!
I think, you can achieve this something like this:
1) for each family in project get family document via famDoc = Document.EditFamily(family) method
2) get all family parameters via famDoc.FamilyManager.Parameters
3) explore Definition.Name, IsInstance and other properties of FamilyParameter you want
4) close famDoc
In addition, do not forget about project parameters, that applicable to family.FamilyCategory
Hello, possible this code will help.
private void GetParametersCategory(ElementId catid,Document doc)
{
List<ElementId> catsids = new List<ElementId>() { catid };
ICollection<ElementId> parametersIds = ParameterFilterUtilities.GetFilterableParametersInCommon(doc, catsids);
if (parametersIds != null)
{
foreach (ElementId paramId in parametersIds)
{
ParameterElement paramEl = doc.GetElement(paramId) as ParameterElement;
if (paramEl != null)
{
var namepar=paramEl.Name;
}
else
{
BuiltInParameter bp = (BuiltInParameter)paramId.IntegerValue;
var namepar=LabelUtils.GetLabelFor(bp);
}
}
}
}
Can't find what you're looking for? Ask the community or share your knowledge.