By Joe Ye
I tried to change VolumeComputationEnable value by below codes:
Settings setting = activedoc.Settings.VolumeCalculationSetting;
setting.VolumeCalculationOptions.VolumeComputationEnable = true;
Unfortunity, the property value was not changed successfully. It still keeps unchanged. Transaction commit was considered. The help documentation says it is read-write property. Then how to change its value?
VolumeCalculationOptions object obtained by activedoc.Settings.VolumeCalculationSetting.VolumeCalculationOptions is a new VolumeCalculationOptions object. It doesn't refer to the VolumeCalculationOptions object stored in document. If assign the property value directly, in fact, only the temp VolumeCalculationOptions object's property value is changed. The object stored in document isn't changed.
We need to write the changed VolumeCalculationOptions object back to activedoc.Settings.VolumeCalculationSetting.VolumeCalculationOptions to change the property value.
Settings setting = activedoc.Settings.VolumeCalculationSetting;
VolumeCalculationOptions options = setting.VolumeCalculationOptions;
options.VolumeComputationEnable = true;
setting.VolumeCalculationOptions = options;
My colleague Jeremy Tammik reminded that this post in his blog also talked about this topic.
http://thebuildingcoder.typepad.com/blog/2009/06/volume-computation-enable.html
And in this post, another sample shows the usage of this in VB:
http://thebuildingcoder.typepad.com/blog/2009/09/room-boundary-location.html