Magazine Internet

How to animate a spring - Part 2

Publié le 10 juin 2009 par Clement Donzel

Here is part two of Spring Animation. To start you will the spring file you created in the last chapter i.e. How to animate a spring - Part 1.

1. Open the spring part file.
2. Click on the Record button on the macro tool bar. If you haven’t have the macro toolbar one, you can go to Tools > Macros > Record to start recording. To show the macro toolbar go to View > Toolbar > Macro.

as31

3. Double click on the spring body to show the dimensions and then click on the length, 100 mm in this case if you used the same old spring part file.

How to animate a spring - Part 2

4. In the pop up window change the value to anything > I have changed it to 110 mm.

How to animate a spring - Part 2

5. Click on Rebuild in the same dimension box or from the toolbar.

How to animate a spring - Part 2

6. Finally click Stop on the macro toolbar or Tools > Macros > Stop.

How to animate a spring - Part 2

7. Give a name your macro and hit save. I have used Spring Animate.

How to animate a spring - Part 2

8. Now click on Edit button on macro toolbar or Tools > Macros > Edit

How to animate a spring - Part 2

9. Browse to the macro you saved in the step 7 and open it.

How to animate a spring - Part 2

10. VB editor will get open up and your screen will look like this.

How to animate a spring - Part 2

11. Remove the extra line and make your window look like this.

How to animate a spring - Part 2

12. Copy these 3 highlighted lines and paste them.

How to animate a spring - Part 2

13. The editor window will look like this. Change the system value to .1. The system takes all in puts in meter. So if you want any other value convert it to meter and put here. .1 denotes .1 m i.e. 100mm

How to animate a spring - Part 2

14. Add these 4 lines as shown and save you macro. You can keep any value for “i”. In this case I have used 10 which means the macro will run for 10 times. You can give any value or can create an input box where user can put the number of steps he needs. I will put up a macro or tutorial on how to do that.

How to animate a spring - Part 2

15. Close the VB editor and back to SolidWorks window. Click on Play button on macro toolbar or Tools > Macros > Play

How to animate a spring - Part 2

16. Browse to the macro you edited and saved in step 14.

How to animate a spring - Part 2

17. Now sit back and enjoy the animation.

Apart from using macro, I have been trying to use Phil Sluder’s trick (SW Tips/Tricks - July Issue Adding Logic to Equations) but getting some error. I have requested Phil to check the same. As soon as he fixes as where I’m going wrong, we can have animation of spring using equations too. I’m also going to put another one using a combination of equations and Animator.

Link for the macro used in this tutorial: Spring Animate.swp


Retour à La Une de Logo Paperblog

A propos de l’auteur


Clement Donzel 83 partages Voir son profil
Voir son blog

l'auteur n'a pas encore renseigné son compte l'auteur n'a pas encore renseigné son compte

Magazine