its dimension has to vary with respect to the motion of the movable ends
You can use formulae. I've done this with springs. The lenght of the springs is equal to the distance between the two limits (for expample, two flat surfaces). When defining the parameter (in this case, lenght) you have to select the option "measure between" (secondary button), and then use the measure tool as usual.
Note: the shape and size of this flexible part (spring, tube, whatever) will not uptdate automatically. You need to click the update icon, then the part will change.