You can keep the value of the dimension in a string and then apply back the same value
Thanks for your reply.
I know how to directly set the value back to the original one.
I want to know if it is possible to do it using the undo mark because i think that will be efficient.
Well tried using Undo after rebuild and it worked as expected.
Thanks for your effort, Deepak.
I am working in an assembly environment (solidworks 2014).
Your reply reminds me to have a test in the part environment.
After the test, it seems to me that it works in the part environment but not in the assembly.
I am using the following code with swModel being partdoc or assmeblydoc.
Could you please have a test in the assembly?
Dim features As Object = swModel.FeatureManager.GetFeatures(False)
Dim swDispDim As DisplayDimension = Nothing
Dim swDim As Dimension = Nothing
Dim swFeat As Feature = Nothing
For j = 0 To UBound(features)
swFeat = features(j)
swDispDim = swFeat.GetFirstDisplayDimension()
While Not swDispDim Is Nothing
swDim = swDispDim.GetDimension
swDim.SetValue2(swDim.GetValue2("") + 5, 1)
Liang, yes it doesn't work in assembly environment. So you either can open the files read-only OR close without saving. And if this is not possible then use the same route of applying the same dimension.
Thank you, Deepak.