Files
2024-12-12 09:51:40 +01:00

99 lines
8.9 KiB
Plaintext

{\rtf1\fbidis\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fnil\fprq2\fcharset2 Wingdings;}}
{\colortbl ;\red0\green0\blue255;}
\viewkind4\uc1\pard\ltrpar\b\f0\fs20 Application:\b0 Materials\line\b Revit Platform:\b0 All\line\b Revit Version:\b0 2010.0\line\b First Released For:\b0 2008.2\line\b Last Modified:\b0 03/10/2008\line\b Modified By:\b0 RZ Autodesk\line\b Programming Language:\b0 C#\line\b Skill Level:\b0 High\line\b Category:\b0 Materials\line\b Type:\b0 ExternalCommand\line\line\b Subject:\b0 Get and Set material's parameters and Render Appearance.\line\b Summary:\b0 \line This sample demonstrates 4 main features:\par
\pard\ltrpar\fi-360\li360 1.\tab How to get and set the parameters of materials in the current document.\par
2.\tab How to duplicate a material (Concrete material).\f1\par
\f0 3.\tab How to change the material of a structural element.\f1\par
\f0 4.\tab How to get and set material\rquote s Render Appearance\f1 .\par
\pard\ltrpar\f0\par
\b Classes:\b0 \par
\pard\ltrpar\fi360 Autodesk.Revit.IExternalCommand\f1\par
\f0 Autodesk.Revit.Elements.Material\par
Autodesk.Revit.Elements.MaterialConcrete\par
Autodesk.Revit.Elements.MaterialGeneric\f1\par
\lang1031\f0 Autodesk.Revit.Elements.MaterialOther\f1\par
\f0 Autodesk.Revit.Elements.MaterialSteel\f1\par
\f0 Autodesk.Revit.Elements.MaterialWood\f1\par
\f0 Autodesk.Revit.Enums.DisplayUnitType\f1\par
\f0 Autodesk.Revit.Utility\f1\par
\pard\ltrpar\f0\par
\lang1033\b Project Files:\b0 \par
Command.cs\f1\par
\pard\ltrpar\li360\tx720\f0 This file contains the class \ldblquote Command\rdblquote that inherits from \ldblquote IExternalCommand\rdblquote interface and implements the \ldblquote Execute\rdblquote method. \f1\par
\pard\ltrpar\f0\par
MaterialParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialParameters\rdblquote which is the base class of \ldblquote MaterialConcreteParameters\rdblquote , \ldblquote MaterialGenericParameters\rdblquote , \ldblquote MaterialSteelParameters\rdblquote , \ldblquote MaterialWoodParameters\rdblquote , \ldblquote MaterialOtherParameters\rdblquote ; the base class is used to get general properties of a material(such as Color, Smoothness, Transparent\f1 ,\f0 etc.).\f1\par
\pard\ltrpar\f0\par
MaterialConcreteParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialConcreteParameters\rdblquote used to get special properties of MaterialConcrete\f1 .\par
\pard\ltrpar\f0\par
MaterialGenericParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialGenericParameters\rdblquote used to get special properties of MaterialGeneric\f1 .\par
\pard\ltrpar\f0\par
MaterialSteelParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialSteelParameters\rdblquote used to get special properties of MaterialSteel\f1 .\par
\pard\ltrpar\f0\par
MaterialWoodParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialWoodParameters\rdblquote used to get special properties of MaterialWood\f1 .\par
\pard\ltrpar\f0\par
MaterialOtherParameters.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialOtherParameters\rdblquote used to get special properties of MaterialOther\f1 .\par
\pard\ltrpar\f0\par
MaterialParametersFactory.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialParametersFactory\rdblquote used to create an instance of MaterialParameters's derived class according to Material's type\f1 .\par
\pard\ltrpar\f0\par
ElementMaterialEditor.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote ElementMaterialEditor\rdblquote used to edit a material\f1 .\par
\pard\ltrpar\par
\f0 MaterialsMgr.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialsMgr\rdblquote used to store and manage all materials of active document, such as classifying, modifying operations\f1 .\f0\par
\pard\ltrpar\f1\par
\f0 MaterialsForm.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote MaterialsForm\rdblquote which works like \ldblquote Settings->Materials\'85\rdblquote menu command. It displays all materials in the current document in a list, and the information of the selected material in a Tab control. The Tab control has two pages \ldblquote Physical\rdblquote and \ldblquote Render Appearance\rdblquote .\f1\par
\par
\pard\ltrpar\f0 RenderAppearanceDescriptor.cs\f1\par
\pard\ltrpar\li360\tx720\f0 It contains a class \ldblquote RenderAppearanceDescriptor\rdblquote which is a wrapper of Material\rquote s Render Appearance to display Render Appearance in a PropertyGrid. And the other class \ldblquote AssetPropertyPropertyDescriptor\rdblquote which is used to describe an AssetProperty in Render Appearance\f1 ,\f0 can be regarded as a property displayed in PropertyGrid.\f1\par
\pard\ltrpar\par
\f0 RenderAppearancesForm.cs\par
\pard\ltrpar\li360\tx720 It contains a class \ldblquote RenderAppearancesForm\rdblquote which displays all Assets in the current Application in a list, and the information of the selected Asset in a PropertyGrid. \f1\par
\pard\ltrpar\par
\f0\par
\b Description:\par
\b0 This sample demonstrates the following functionalities:\par
\pard\ltrpar\fi-360\li360\tx360 -\tab Get all materials in the active project.\par
\pard\ltrpar\fi-360\li360 -\tab Get the current system display unit.\par
-\tab Get parameters of the selected material object\f1 .\par
\f0 -\tab Change the parameters\rquote value. \par
-\tab List materials by category.\f1\par
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab Get Render Appearance of the selected material object\f1 .\par
\f0 -\tab Change Render Appearance of the selected material object. \f1\par
\pard\ltrpar\fi-360\li360\f0 -\tab Duplicate a concrete material whose weight is not light: rename it by adding \ldblquote _LW\rdblquote suffix to its name and do other modifications\f1 .\par
\f0 -\tab If a structural element (structure beam, structure wall, beam, or slab) is selected, its material can be changed to the newly created concrete material.\f1\par
\pard\ltrpar\par
\f0 Implementation:\f1\par
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab All available materials can be retrieved via \f1\par
\pard\ltrpar\fi-420\li780\f2\'d8\tab\f0 Revit.Materials Revit.Document.Settings.Materials\f1 .\par
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab The material object\rquote s parameter can be got and set via\f1\par
\pard\ltrpar\fi-420\li780\f2\'d8\tab\f0 Revit.Parameter Revit.Element.get_Parameter(Revit.Parameters.BuiltInParameter parameterId)\f1\par
\pard\ltrpar\li360\f0 and methods\par
\pard\ltrpar\fi-420\li780\f2\'d8\tab\f0 System.String Autodesk.Revit.Parameter\f1 .\f0 AsValueString()\par
\f2\'d8\tab\f0 bool Autodesk.Revit.Parameter\f1 .\f0 SetValueString(System.String valueString) \f1\par
\pard\ltrpar\li360\f0 which can deal with unit\f1 .\par
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab Material\rquote s Render Appearance can be retrieved and set and set via\f1\par
\pard\ltrpar\fi-420\li780\f2\'d8\tab\f0 Revit.Utility.Asset Revit.Elements.Material.RenderAppearance\f1\par
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab All Assets in current Application can be retrieved via\f1\par
\pard\ltrpar\fi-420\li780\f2\'d8\tab\f0 Revit.Utility.AssetSet Revit.Application.Assets[Revit.Enums.AssetType]\par
\pard\ltrpar\par
\b Instructions:\cf1\b0 \cf0\f1\par
\pard\ltrpar\fi-360\li360\tx360\f0 1.\tab Make sure rendering library has been installed; otherwise, Render Appearance will not be available.\par
\pard\ltrpar\fi-360\li360 2.\tab [Optional]Change some settings of materials from \ldblquote Settings->Materials\rdblquote menu\f1 .\f0\par
3.\tab Run this command.\par
4.\tab List all Materials. All materials in current document are shown in a list box of a Form.\par
\pard\ltrpar\li360 The selected Material\rquote s information is displayed in a Tab control, includes parameters and Render Appearance.\par
\pard\ltrpar\fi-360\li360\tx360 5.\tab Get and set parameters. All parameters of selected material are shown in tab page \ldblquote Physical\rdblquote . Change values of some parameters and check whether the parameter is equal to the value got from \ldblquote Settings->Materials\rdblquote menu.\par
\pard\ltrpar\fi-360\li360 6.\tab Get and set Material\rquote s Render Appearance. Selected material\rquote s Render Appearance is shown in tab page \ldblquote Render Appearance\rdblquote . Click \ldblquote Replace\rdblquote button to view all Assets of current Application in a new Form and select one to replace selected Material Render Appearance.\par
7.\tab Duplicate MaterialConcrete. Select a MaterialConcrete and duplicate it by clicking \ldblquote Duplicate\rdblquote button.\par
8.\tab Change the material of a structural element. While clicking \ldblquote OK\rdblquote button\f1 ,\f0 if a structural element had been selected, its material will be changed to the newly created concrete material.\par
\pard\ltrpar\par
}