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

54 lines
4.8 KiB
Plaintext

{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
{\colortbl ;\red0\green0\blue0;\red0\green0\blue255;}
\viewkind4\uc1\pard\ltrpar\nowidctlpar\b\f0\fs20 Application:\b0 ValidateParameters\b\f1\par
\f0 Revit Platform:\b0 All\line\b Revit Version:\b0 2011.0\line\b First Released For:\b0 2010.0\line\b Programming Language:\b0 C#\line\b Skill Level:\b0 Beginning\line\b Category:\b0 Families\line\b Type:\b0 ExternalCommand and ExternalApplication\f1\par
\par
\b\f0 Subject:\b0 Validate Parameters\f1\par
\b\f0 Summary:\b0 This sample will demonstrate if every type has valid values for certain parameters.\f1\par
\f0\par
\b Classes:\b0 \f1\par
\pard\ltrpar\nowidctlpar\fi360\f0 Autodesk.Revit.UI.IExternalCommand\par
Autodesk.Revit.UI.IExternalApplication\par
Autodesk.Revit.UI.UIDocument \par
Autodesk.Revit.DB.Element\par
Autodesk.Revit.DB.FamilyManager\par
Autodesk.Revit.DB.ParameterSet\par
\f1\par
\pard\ltrpar\nowidctlpar\b\f0 Project Files:\b0 \par
Command.cs\f1\par
\pard\ltrpar\nowidctlpar\li360\tx720\f0 This file contains a class Command which implements IExternalCommmand interface. The function of the class is to call API FamilyType.HasValue and methods FamilyType.AsDouble (Parameter), AsElementId(Parameter) to validate parameters\f1 .\par
\pard\ltrpar\nowidctlpar\lang1024\f0 Application.cs\par
\pard\ltrpar\nowidctlpar\li360\tx720\lang1033 This file contains a class \cf1\lang1024 Application\cf0\lang1033 which implements IExternalApplcation interface. The OnStartUp method will register DocumentSaving, DocumentSavingAs events when Revit starts. The pre-event handler will validate parameters when document is saving; the post-event handler will validate parameters when document is saving as another file. The OnShutdown method will get rid of the two events when Revit shuts down\f1 .\par
\pard\ltrpar\nowidctlpar\f0 MessageForm.cs\par
\pard\ltrpar\nowidctlpar\li360 This file contains a windows form, which shows the parameters validation result to user.\f1\par
\pard\ltrpar\nowidctlpar\par
\b\f0 Description:\b0 \par
This sample only can be used in family. The sample implements IExternalApplication interface and subscribes DocumentSaving, DocumentSavingAs, events in OnStartUp method; the registered event handlers will validate parameters when events are raised\f1 .\f0 It can also be launched by external command. If there is any parameter which cannot pass the validation, one warning message will show and list the invalid type and parameter\f1 .\f0 There is one log file that stores all information displayed in the form.\f1\par
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360\f0 -\tab To register events to the application, use the event handler DocumentSaving and DocumentSavingAs of Controlled Application\f1 .\par
\pard\ltrpar\nowidctlpar\fi-360\li360\f0 -\tab To get the family types, use the property FamilyManager\f1 .\f0 Types\f1 .\par
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360\f0 -\tab To get the family parameters, use the property FamilyManager\f1 .\f0 Parameters\f1 .\par
\f0 -\tab To check whether the type has value for certain parameter, use the method FamilyType.HasValue (FamilyParameter)\f1 .\par
\pard\ltrpar\nowidctlpar\fi-360\li360\f0 -\tab To check the Parameter\rquote s storage type, use the property Parameter\f1 .\f0 StorageType\f1 .\par
\f0 -\tab To retrieve the parameter value, use the methods FamilyType.AsDouble (Parameter), AsElementId(Parameter) etc.\f1\par
\pard\ltrpar\nowidctlpar\li360\par
\pard\ltrpar\nowidctlpar\b\f0 Instructions:\cf2 \f1\par
\pard\ltrpar\nowidctlpar\fi-360\li360\tx360\cf0\b0\f0 1.\tab Update your Revit.ini by following lines: \f1\par
\pard\ltrpar\nowidctlpar\li360\f0 [ExternalApplications] \par
EACount = 1 \par
\par
EAClassName1=Revit.SDK.Samples.ValidateParameters.CS.Application\f1\par
\f0 EAAssembly1 = \i <your path>\i0\f1\\\f0 ValidateParameters.dll \par
[ExternalCommands]\par
ECCount = 1\par
ECName1= Validate Parameters\par
ECClassName1 = Revit.SDK.Samples.ValidateParameters.CS.Command\f1\par
\f0 ECAssembly1 = \i <your path>\f1\\\i0\f0 ValidateParameters.dll \par
ECDescription1 = Validate every type has valid values for certain parameters.\f1\par
\pard\ltrpar\nowidctlpar\fi-420\li420\tx360\f0 2.\tab Start Revit, DocumentSaving and DocumentSavingAs events will be registered automatically.\f1\par
\pard\ltrpar\nowidctlpar\fi-420\li420\tx420\f0 3.\tab In order to use a family, user should manually open a family document.\f1\par
\pard\ltrpar\nowidctlpar\fi-420\li420\f0 4.\tab Run the extern command \lang1024 ValidateParameters\lang1033\f1 .\par
\f0 5.\tab Raise Save event by UI menu File\\Save\f1 .\par
\f0 6.\tab Raise SaveAs event by UI menu File\\SaveAs.\f1\par
\pard\ltrpar\nowidctlpar\par
}