Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get category parameters

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
3592 Views, 8 Replies

Get category parameters

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!

8 REPLIES 8
Message 2 of 9
jeremytammik
in reply to: Anonymous

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...



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 9
Anonymous
in reply to: jeremytammik

Jeremy, thanks for the ideea. I will try it.

 

Roxana

Message 4 of 9
Anonymous
in reply to: Anonymous

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.

 

 

Message 5 of 9
Anonymous
in reply to: jeremytammik

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

Message 6 of 9
Anonymous
in reply to: Anonymous


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.

Message 7 of 9
FRFR1426
in reply to: Anonymous

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.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Message 8 of 9
aignatovich
in reply to: Anonymous

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

Message 9 of 9
DmitryStrelnikov
in reply to: Anonymous

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.

Post to forums  

Autodesk Design & Make Report