// get the builtin parameter Parameter p = projInfo.get_Parameter(BuiltInParameter.PROJECT_NAME); TaskDialog.Show("Project", "The project name: " + p.AsString()); What Can We Change? One of the great undocumented mysteries of working with the Revit API is what can we – modify. Like many things within Revit this is usually determined by experimentation as much – as anything. But there is a short cut to figuring it out the Parameter.IsReadOnly flag tells you – whether the API is allowed to set the value of that parameter. For example, with a typical wall element: Read-Only Writable Parameters Parameters Area, Base Base Extension Constraint, Distance*, Base Offset, Base is Comments, Attached *, Location Length, Line, Mark, Related To Phase Mass, Top Created, Extension Phase Distance *, Demolished, Top is Room Attached *, Bounding, Unconnected Structural Height *, Usage, Top Volume Constraint, Top Offset, * These may be writable depending on other parameters/situations Type Parameters vs. Instance Parameters So far, in the examples we’ve shown, all of the parameters retrieved have been from “Instance” parameters parameters retrieved directly from the element in question. So where are the – parameters? We need to navigate from the to the element and then “Type” “instance” “type” – retrieve the parameters that are there: private void getParameters(Element elem) { // get both the instance parameters and type parameters
// get the builtin parameter Parameter p = projInfo.get_Parameter(BuiltInParameter.PROJECT_NAME); TaskDialog.Show("Project", "The project name: " + p.AsString()); What Can We Change? One of the great undocumented mysteries of working with the Revit API is – what can we modify. Like many things within Revit – this is usually determined by experimentation as much as anything. But there is a short cut to figuring it out – the Parameter.IsReadOnly flag tells you whether the API is allowed to set the value of that parameter. For example, with a typical wall element: Read-Only Parameters Writable Parameters Area, Base Extension Distance*, Base is Attached *, Length, Related To Mass, Top Extension Distance *, Top is Attached *, Unconnected Height *, Volume Base Constraint, Base Offset, Comments, Location Line, Mark, Phase Created, Phase Demolished, Room Bounding, Structural Usage, Top Constraint, Top Offset, * These may be writable depending on other parameters/situations Type Parameters vs. Instance Parameters So far, in the examples we’ve shown, all of the parameters retrieved have been from “Instance” parameters – parameters retrieved directly from the element in question. So where are the “Type” parameters? We need to navigate from the “instance” to the “type” element – and then retrieve the parameters that are there: private void getParameters(Element elem) { // get both the instance parameters and type parameters
cp231-2-putting-the-i-in-bim-parameters-in-the-revit-api.docx