Skip to content

Instantly share code, notes, and snippets.

@pzurek
Created January 14, 2011 00:34
Show Gist options
  • Save pzurek/778928 to your computer and use it in GitHub Desktop.
Save pzurek/778928 to your computer and use it in GitHub Desktop.
A simple workaround for a problem with Revit 2011 API
void updateReferencingSheet(Document doc)
{
// Retrieve the built-in VIEW_DISCIPLINE parameter
Parameter discipline = selectedViewport
.get_Parameter(BuiltInParameter.VIEW_DISCIPLINE);
// Save the value of that parameter for later
int disciplineNo = discipline.AsInteger();
Transaction transaction = new Transaction(doc);
transaction.Start("Updating the model");
// If the parameter value is set to 1 change it to 2
// if it's set to anything else change it to 1
discipline.Set(1 == disciplineNo ? 2 : 1);
// Now change it back to the previously saved value
discipline.Set(disciplineNo);
transaction.Commit();
// Voila! Your "Referencing Sheet" parameter is up to date
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment