InternalDefinition.SetAllowVaryBetweenGroups() method was talked about some time ago. Here let's talk about it again.
InternalDefinition class has a read-only property to access its so called AllowVaryBetweenGroups inside flag, however also provides the SetAllowVaryBetweenGroups() method trying to change the flag from outside.
public bool VariesAcrossGroups { get; }
Besides naming inconsistencies for the property and method names here (Varies/Vary, Allow/Can, and Between/Across/Among), people would wonder more about the fact why a read-only property kid is accompanied with a sibling set method inside the same parent class! Why not simply make the property to be get/set?!
Ah, we kind of got that might be because the property can not be set for some InternalDefinition instances. Then why not provide another simple flag such as IsVAGApplicable and still make the property to be read-write? If programmers do not check the flag but try to set the VAG even if not allowed, Revit (API) can simply ignore the call rather than throw out some pretty expensive (time-consuming) exception! In that way, a good parameter UI can easily determine whether to enable its VAG check boxes!! We tried to temporarily set the flag as true and back to its initial value in try/catch block inside a rollback (sub)transaction but found it's too expensive and might cause something unexpected such as definition instance being really changed anyway, so finally decided to give it up! Oh!!!
Revit Parameter Organizer has been refining to address this kind of matters ...
Recent Comments