Application: ParameterValuesFromImage
Revit Platform: All
Revit Version: 2011.0
First Released For: 2011.0
Programming Language: C#
Skill Level: Advanced
Category: Massing
Type: ExternalCommand

Subject: Set parameter values based on image data

Summary: Compute a grayscale value for each pixel in an image file. Use this value to set a parameter that will change the model’s geometry.

Classes: 
	System.Drawing.Bitmap
Autodesk.Revit.DB.DividedSurface
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.DB.Parameter

Project Files:

Command.cs
	This file contains the implementation of the SetParamterValueWithImageData command

Description: 
1.	Open one of the sample files, Tower.rfa or brickFanWall.rfa
2.	Run the external command
3.	Revit will open the corresponding image file (Tower.rfa_grayscale.bmp or brickFanWall.rfa_grayscale.bmp)
4.	For each panel of the divided surface, Revit will compute the grayscale value of the corresponding pixel in the image file (Red + Green + Blue divided by 3).
5.	The panel’s “Grayscale” parameter will be set to this grayscale value.
6.	The panel’s geometry will update based on relationships in the parameter’s definition driven by this parameter.
7.	Several sample image files are provided for the Tower example. To use a file, rename it to Tower.rfa_grayscale.bmp before running the command.