(RhinoInside)extract type materials and then apply to other revit file

hello everyone,
i try a little bit but cannot find the suitable way:
i want to extract A Revit rvt file type materials and then apply to B REVIT rvt file same type ,

my concept(may go wrong):
extract type material ,and open B document and then apply material to same type

problem:
i cannot extract type material ,only extract element materials

Does it have any simple way to do that ?
many thanks
Brad Chan

Basically, you have to know all the materials which are present in the software. For your help I am writing down all the materials -
Materials are one of the more complicated data types in Revit. They are regularly used to (a) assign graphical properties to Revit elements for drafting (e.g. tile pattern on a bathroom wall), (b) embed architectural finish information in the building model for the purpose of scheduling and takeouts, (c) assign appearance properties to surfaces for architectural visualizations, and (d) assign physical and (e) thermal properties to elements for mathematical analysis of all kinds.

Therefore a single Material in Revit has 5 main aspects:

  • Identity
  • Graphics
  • Appearance Properties
  • Physical Properties
  • Thermal Properties

Each one of these aspects is represented by a tab in the Revit material editor window:

In the sections below, we will discuss how to deal with all of these 5 aspects using Rhino.Inside.Revit

Querying Materials

In Revit API, Materials are represented by the DB.Material. This type, handles the Identity and Graphics of a material and provides methods to query and modify the Appearance , Physical , and Thermal properties.

The first challenge is to be able to query available materials in a Revit model or find a specific one that we want to work with. For this we use the Query Materials component. The component outputs all the materials in a Revit model by default, and also has optional inputs to filter the existing materials by class or name, and also accepts customs filters as well:

The Class and Name inputs accept Grasshopper string filtering patterns

< Starts with
> Ends with
? Contains, same as a regular search
: Wildcards
; Regular expression

Extracting Materials from Geometry

To extract the set of materials assigned to faces of a geometry, use the Geometry Materials component shared here. In this example, a custom component is used to extract the geometry objects from Revit API (DB.Solid - See Extracting Type Geometry by Category). These objects are then passed to the Geometry Materials component to extract materials. Finally the Element.Decompose component is used to extract the material name.

Geometry Materials
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Material Identity

Use the Material Identity component to access the material identity:

You can make changes to the identity properties using the same component:

Material Graphics

Use the Material Graphics component to access the material graphics:

You can make changes to the graphic properties using the same component. See Styles and Patterns page for the Find Fill Pattern component:

Creating Materials

Use the Add Material document-aware component to create a new material in the Revit model. You must assign a unique name to the new material:

After creating the material, use the Material Graphics component to assign graphic properties to the new material:

Material Assets

So far, we have learned how to analyze material identify and graphics, and to create simple materials. To be able to take full advantage of the materials in Revit, we need to be familiar with the underlying concepts behind the other three aspects of a material: Appearance , Physical , and Thermal properties.

Assets

Assets are the underlying concept behind the Appearance , Physical , and Thermal aspects of a material in Revit. Rhino.Inside.Revit provides a series of components to Create, Modify, and Analyze these assets in a Grasshopper-friendly manner. It also provides components to extract and replace these assets on a Revit material. Basically, I am designing this thing for the best payroll software Kolkata and here I have to select the materials.

Remember that Assets and Materials are different data types. Each Revit Material had identity and graphics properties, and also can be assigned Assets to apply Appearance, Physical , and Thermal properties to the Material. Having Physical, and Thermal assets are completely optional.

Revit API support for assets is very limited. This note section, attempts to describe the inner-workings of Revit Visual API

Appearance Assets

All Appearance assets are of type [DB.Visual.Asset]asset_id=T:Autodesk.Revit.DB.Visual.Asset) has lookup methods to find and return these properties. These properties are wrapped by the type DB.Visual.AssetProperty in Revit API. This type provides getters to extract the value from the property.

There are many different Appearance assets in Revit e.g. Generic , Ceramic , Metal , Layered , Glazing to name a few. Each asset has a different set of properties. To work with these Appearance assets, we need a way to know the name of the properties that are available for each of the asset types. Revit API provides static classes with static readonly string properties that provide an easy(?) way to get the name of these properties. For example the GenericDiffuse property of DB.Visual.Generic, returns the name generic_diffuse which is the name of the diffuse property for a Generic Appearance asset.

Appearance assets are then wrapped by DB.AppearanceAssetElement so they can be assigned to a Revit Material (DB.Material)

Physical and Thermal Assets

Physical , and Thermal assets are completely different although operating very similarly to Appearance assets. They are still a collection of properties, however, the properties are modeled as Revit parameters (DB.Parameter) and are collected by an instance of DB.PropertySetElement. Instead of having static classes as accessors for the names, they must be accessed by looking up the parameter based on a built-in Revit parameter e.g. THERMAL_MATERIAL_PARAM_REFLECTIVITY of DB.BuiltInParameter

Revit API provides DB.StructuralAsset and DB.ThermalAsset types to provide easy access to the Physical , and Thermal properties, however, not all the properties are included in these types and the property values are not checked for validity either.

Grasshopper as Playground

The Grasshopper definition provided here, has custom python components that help you interrogate the properties of these assets:

!

To replace assets of a material with a different asset, use theReplace Material’s Assets** component:

2 Likes