1. Add a fit to the auxiliary part in assembly, so that a point of the part (hereinafter referred to as point 1) can only move along a straight line, for example, only along the Y axis;
2. Create a new part in the assembly, draw a straight line on the front reference plane or the right reference plane, one end point of the straight line coincides with the point 1, and the other end point coincides with the assembly origin, and exit the sketch;
3. Draw a circle (or other closed figure, which is the cross section of the spring you drew) on the front datum plane or the right datum plane;
4. Scan the entity, with the sketch in step 3 as the outline, the straight line as the path in step 2, the option "Twist along the path" as the direction/twist control, and the definition method as the rotation, enter a number of turns, for example, 10, and confirm to exit the part editing state;
5. Move the auxiliary assembly, and then click the Rebuild Model button. At this time, it is found that the spring compresses and expands with the movement of the auxiliary parts.
Note: The above is just a simple example. In fact, the auxiliary part can be just a sketch, not necessarily a solid part, and there is no need to limit its points to linear motion. However, the effect will not only be compression and stretching in one direction, but also the other end point of the straight line of the scanning path can coincide with the point of an auxiliary part, not necessarily fixed at the origin. After moving the auxiliary part, you must rebuild the model to see the effect.