Making Some Graphics & Animate With Script
Hi everyone,
In this post we are going to see how powerful a script can be and what you can accomplish with a script. Also, we will learn a new feature about script.
For the friends who have just joined the series here are the links for the previous posts :
Part - 1 Part - 2 Part - 3
When I started learning scripts and LISP (still learning), I came across a routine that used to rotate a hand of a clock. I recalled and searched further. I found a few videos which were showing the hands rotating. In these videos I found the tutor was having the clock drawing already drawn and then ran the script to rotate the hands.
I tried to draw the clock with the help of a script and then run it with another script. I came up with two scripts and the result I am sharing with you.
Let us discuss how to do this with script.
Please download the script file package by clicking here. Unzip the package and extract the files.
Go through the script file draw-clock.scr , this is a simple script. I have just followed the AutoCAD prompts here.
You must have noticed the "group" command here. This is a way to select the elements to be used with the commands in script. We shall discuss about "group" command in some other post.
Now, fire up AutoCAD and run this file using "script" command. See what happens. You can hit F2 to see what is happening on your command window and analyse the script.
Now that you have drawn the clock go through the file run-clock.scr.
I have used "rotate" command three times.
First rotate command is used to move seconds hand.
Second rotate command is used to move minutes hand.
Third rotate command is used to move hours hand.
"delay 1000" command is used to make the script pause for 1 second.
"Rscript" is used to repeat the script.
An exercise :
Draw something and move or rotate it with script. Let me know if you discover something new or face any problem.
Let me know if you face any problem in downloading or executing the files.
Your comments are always welcome, So don't hesitate.
Enjoy....
Hi everyone,
In this post we are going to see how powerful a script can be and what you can accomplish with a script. Also, we will learn a new feature about script.
For the friends who have just joined the series here are the links for the previous posts :
Part - 1 Part - 2 Part - 3
When I started learning scripts and LISP (still learning), I came across a routine that used to rotate a hand of a clock. I recalled and searched further. I found a few videos which were showing the hands rotating. In these videos I found the tutor was having the clock drawing already drawn and then ran the script to rotate the hands.
I tried to draw the clock with the help of a script and then run it with another script. I came up with two scripts and the result I am sharing with you.
Let us discuss how to do this with script.
Please download the script file package by clicking here. Unzip the package and extract the files.
Go through the script file draw-clock.scr , this is a simple script. I have just followed the AutoCAD prompts here.
You must have noticed the "group" command here. This is a way to select the elements to be used with the commands in script. We shall discuss about "group" command in some other post.
Now, fire up AutoCAD and run this file using "script" command. See what happens. You can hit F2 to see what is happening on your command window and analyse the script.
Now that you have drawn the clock go through the file run-clock.scr.
I have used "rotate" command three times.
First rotate command is used to move seconds hand.
Second rotate command is used to move minutes hand.
Third rotate command is used to move hours hand.
"delay 1000" command is used to make the script pause for 1 second.
"Rscript" is used to repeat the script.
An exercise :
Draw something and move or rotate it with script. Let me know if you discover something new or face any problem.
Let me know if you face any problem in downloading or executing the files.
Your comments are always welcome, So don't hesitate.
Enjoy....
No comments:
Post a Comment