Family Editor Reference Material by String Name

Family Editor Reference Material by String Name

Anonymous
Not applicable
1,324 Views
1 Reply
Message 1 of 2

Family Editor Reference Material by String Name

Anonymous
Not applicable

Is it possible to reference a material by it's string name in the FamilyEditor? A material object can be retrieved in this way using the Revit API. However, as not everything is possible in the Revit UI that can be achieved with the API, I was wondering if there is any way to achieve this behavior over the UI that I haven't thought about yet.

 

Preferable Implementation:

  • Family that has a text parameter (MaterialText) and a material parameter (Material) where the material parameter is driven by the text parameter.
  • When the user inserts a string name in "MaterialText", e.g. "Concrete" - Revit looks for the respective Material in the project and if found sets this material in "Material". If not found, it does nothing. See point below.
  • Conditional statements in formulas could be implemented for parameter "Material" where the string "Concrete" references a material object with a much longer name to make life for users easier and to not result in an error when the material was not found. 

Documentation of Revit says that conditional statements in formulas are only permitted for numeric and yes/no parameters (see link below). So the latter point will not be achievable so far.

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2019/EN... 

 

Some people might wonder why I don't want the user to set the parameter via the Material-Browser. This is because of reduction of clicks and time for searching, and to ensure that the "MaterialText" parameter is mapped to a specific material representation in the project. "MaterialText" could change very often depending on how many alternatives are played through. It should always be the same instance only with the two parameters changed. The solution over the API has the disadvantage that the user always has to remember to click the button that overwrites the material parameters based on the text parameter.

 

I assume that the explained behavior is not implemented within the Revit Family Editor yet; no formulas are permitted for material parameters and also the Revit documentation does not mention it. Still, I hope there's someone out there who has some more information on that topic. 

 

Thanks in advance!

 

0 Likes
Accepted solutions (1)
1,325 Views
1 Reply
Reply (1)
Message 2 of 2

Mirko.Jurcevic
Collaborator
Collaborator
Accepted solution

Do not waste time, this is not possible in Revit UI, only with Revit API.

 

In general, using text (string) in family IF formulas is not possible, for example:

  • this will NOT work: IF(var = "Concrete", true, false)  //where var is string
  • this will work: IF(var > 0, "True string", "False string")  // where var is numeric
  • this will work: IF(var, "True string", "False string")   // where var is boolean
If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.

Mirko Jurcevic


Via BIM: apps.viabim.co
Try my Revit add-ins: Via BIM Tools