Question:Is a view's 'annotation crop" exposed via the API? I see the properties cropBox, cropBoxActive, and cropBoxVisible -- but not similar properties for the annotation crop.
Solution
For easily access the view’s parameter value, Revit API exposes some properties for View class to get and set the parameter value. So developers can read and write parameters’ value in one line. However, not all the view’s parameters have a corresponding property under View class. In this situation, we can access directly access the target parameter, and change its value in the way of changing parameter value.
Here is the code fragment to change the Annotation Crop parameter value. it changes the current view’s Annotation Crop value.
Parameter param = doc.ActiveView.get_Parameter(BuiltInParameter.VIEWER_ANNOTATION_CROP_ACTIVE);
Transaction trans = new Transaction(doc);
trans.Start("ChangeAnnotationCrop");
param.Set(1);
trans.Commit();
For other kind of element, developer can use the same way to change a parameter value if the representing class doesn’t provide the corresponding property.