create an flip book type animation of a mechanism in action: Script delay issue

create an flip book type animation of a mechanism in action: Script delay issue

Curtis_Waguespack
Consultant Consultant
1,540 Views
27 Replies
Message 1 of 28

create an flip book type animation of a mechanism in action: Script delay issue

Curtis_Waguespack
Consultant
Consultant

I did a bit of searching for this but didn't find what I was looking for.

 

Thanks in advance!

 

Short version:

I am trying to speed up a script that simply turns layers on and off, but it runs slowly or skips around as it if cant keep up with a faster delay.

 

I'm doing this with a *.scr file and the AutoCAD command SCRIPT

 

Is this just how it is? or is there some way to speed this up?

 

See attached example file.

 

 

Long version:

I have a drawing such as this:

 

Curtis_Waguespack_0-1682004920691.png

 

And a script such as this:

 

 

-layer s 0 off * n on 01 
delay 3500
REDRAW
-layer off 01 on 02 
delay 3500
REDRAW
-layer off 02 on 03 
delay 3500
REDRAW
-layer off 03 on 04 
delay 3500
REDRAW
-layer off 04 on 05 
delay 3500
REDRAW
-layer off 05 on 06 
delay 3500
REDRAW
-layer off 06 on 07 
delay 3500
REDRAW
rscript

 

 

 

 

This turns off the layers to move the circle from left to right, and works as expected but runs really slooooooooow...

 

If I try to use a shorter delay to speed things up, it still runs slow, but it skips around from 01 to 04 to 07 to 02 to 06, etc.

 

 

 

-layer s 0 off * n on 01 
delay 1000
REDRAW
-layer off 01 on 02 
delay 1000
REDRAW
-layer off 02 on 03 
delay 1000
REDRAW
-layer off 03 on 04 
delay 1000
REDRAW
-layer off 04 on 05 
delay 1000
REDRAW
-layer off 05 on 06 
delay 1000
REDRAW
-layer off 06 on 07 
delay 1000
REDRAW
rscript

 

 

 

[ The subject line of this post has been edited for clarity by @pendean Original: Script delay issue]

EESignature

0 Likes
Accepted solutions (3)
1,541 Views
27 Replies
Replies (27)
Message 2 of 28

paullimapa
Mentor
Mentor

I’ve experienced this too when attempting to reduce the delay #. But I think that has to do with todays fast processors.  What I have not tried is using multiple delay lines with a smaller #


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 28

pendean
Community Legend
Community Legend
@Curtis_Waguespack If I remove all of your DELAY entries your scripts are blazingly fast here in AutoCAD2023.1.3 in Win10Pro. Nothing is skipped.

Why if I may ask are you needing the DELAY entries? What's the goal here?
0 Likes
Message 4 of 28

Curtis_Waguespack
Consultant
Consultant

@pendean This is just a simple example of the real file, but the goal it to create an flip book type animation of a mechanism in action

 

I was looking at this for someone else, and we are seeing that without a delay the script seems to skip steps, as if it is running too fast. It appears to bounce around out of sequence, like 01 to 04 to 07 to 02 to 06 to 03 , etc.

 

No delay or a delay of less than 3500 or so results in it skipping about.

 

Something like this:

 

Skipping.gif

 Adding a delay of 3500 allows it to show all steps, but it runs really slow, something like this:

Script Slow.gif

 

The goal is something more like this, but we can't seem to get this result:

 

Script Fast.gif

EESignature

0 Likes
Message 5 of 28

Curtis_Waguespack
Consultant
Consultant

I am testing this with AutoCAD 2024 , windows 10

 

 

EESignature

0 Likes
Message 6 of 28

Curtis_Waguespack
Consultant
Consultant
Accepted solution

 

A colleague determined that it was the visual style that was causing the long refresh rates. Using the Visual Style set to wireframe, seems to resolve this.

 

see explanation ( graphics card vs CPU doing graphic emulation)  at this link: 

https://forums.autodesk.com/t5/autocad-forum/runscript-error/m-p/7119848#M882020

 

 

We can add VScurrent wireframe to the beginning of the script as shown, to get this to work as expected:

 

 

 

VScurrent wireframe
-layer s 0 off * n on 01
delay 300
REDRAW
-layer off 01 on 02
delay 300
REDRAW
-layer off 02 on 03
delay 300
REDRAW
-layer off 03 on 04
delay 300
REDRAW
-layer off 04 on 05
delay 300
REDRAW
-layer off 05 on 06
delay 300
REDRAW
-layer off 06 on 07
delay 300
REDRAW
rscript

 

 

 

 

 

 

 

EESignature

Message 7 of 28

Sea-Haven
Mentor
Mentor

Have done stuff like this I would not use layers I would use a move with delays.

 

Ok got something together I took advantage of princ "." to command line as forces a slower rate. Tried a counter v's delay both seem to work.

 

Tested on Bricscad V20

 

 

(defun c:movie ()
(setvar 'cmdecho 0)
(setq ent (car (entsel "\nPick obj ")))
(setq pt '(0 0 0) dist 10)
(repeat 20
(command "move" ent "" pt (setq pt (mapcar '+ pt (list dist 0.0 0.0))))
;(setq x 1)
;(repeat 10000000
;(setq x (1+ x))
;)
(command "delay" 100)
(princ ".")
(Command "regen")
)
(princ)
)
(c:movie)

 

 

 

Changed dist to 1 and repeat to 100 moves slowly now.

 

Have seen say Earth Excavator with arms rotating could do that but way more complicated.

Why not

 

(defun c:movie2 ()
(setq ent (car (entsel "\nPick obj ")))
(setq pt (getpoint "\nSelect a centre point "))
(setq howmany (getint "\nEnter how many angle facets max 360 "))
(setq angseg (/ (* 2 pi) howmany) ang 0.0)
(repeat howmany
(command "Rotate" ent "" pt (setq ang (+ ang angseg)))
(command "delay" 100)
(princ ".")
(Command "regen")
)
(princ)
)
(c:movie2)

 

0 Likes
Message 8 of 28

rik_pfau
Contributor
Contributor
Thanks for working this out, Curtis!
Message 9 of 28

Curtis_Waguespack
Consultant
Consultant
 

 

Would you mind taking a look at this and confirming that we haven't missed something?
 
 
 

 

We used some information you provided in the past to get this script working as expected (see post 6 in this thread) , but now there is a user trying to use this solution, but they have ACAD LT?

 

Visual Styles are not available in LT, so  VSCurrent can't be used.

 

Can you think of another system variable, command, or some other trick that we employ to get this script to run as expected with the proper delays in AutoCAD LT?

 

Thanks in advance, 

Curtis

 

 

EESignature

0 Likes
Message 10 of 28

paullimapa
Mentor
Mentor

What happens when the vscurrent wireframe line is removed for the LT user?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 11 of 28

rik_pfau
Contributor
Contributor

Then it behaves as it did in the original description of the problem. It seems to skip lines, and not "stop on each step."

 

0 Likes
Message 12 of 28

pendean
Community Legend
Community Legend
@rik_pfau @Curtis_Waguespack someone needs to treat the LT user as a special case: you are fighting a lack of feature in LT.

Why don't you start a new thread: your use of multiple logins, not replying to specific users, and tagging those that have never been involved in the original discussion is going to be a challenge to follow for everyone.
0 Likes
Message 13 of 28

Waguespack_Curtis
Contributor
Contributor

@pendean wrote:
 your use of multiple logins, not replying to specific users, and tagging those that have never been involved in the original discussion is going to be a challenge to follow for everyone.

Let me see if I can help clarify the challenge you've identified. 😉

 

I am one user/login, my name is Curtis 🙂

 

Rik is a different user/login, his name is Rik 🙂

 

I (Curtis) created this thread in the past to help him (Rik) with the original issue.

 

In doing a bit of searching/reading on this issue, I turned up 3 or 4 of Alfred's old posts in a row, and so it seemed he (Alfred) might know his way around these areas. And so, I (Curtis) tagged him (Alfred) to see if he would be kind enough to take a few minutes to confirm that there is not something that we ( Curtis and Rik) have overlooked before settling on the answer of: "it's a limitation of LT, there is nothing else that can be done to make the script run well in LT, and it just is what it is." 

 

If you (Dean), or some other forum member ( <that person's name here> ) would like to confirm that "it is what it is", and there is nothing else to investigate or do to get this script to work as expected with ACAD LT, then feel free to do so.

 

😁 🤣 😋

 

Message 14 of 28

Curtis_Waguespack
Consultant
Consultant

lol, I just realized that last reply WAS from my other Autodesk account!  Jokes on me! 😃

 

( I had to log into that account to download an update on this machine, and didn't realize I was replying from the other browser) 

 

 

EESignature

0 Likes
Message 15 of 28

paullimapa
Mentor
Mentor

AutoCAD LT supports command: SHADEMODE 2D 

try & see if that works...

Frankly I don't know why VSCURRENT Wireframe helps for AutoCAD with VSLIDE


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 16 of 28

pendean
Community Legend
Community Legend

@Curtis_Waguespack wrote:

lol, I just realized that last reply WAS from my other Autodesk account!  Jokes on me! 😃


My point was that your post in question could have just said "...LT user cannot do this, can someone help..." would have been a direct ask instead of all that unnecessary wordiness and tagging of others and referencing other posts  blah blah blah LOL

 

Either way, it does not change my first sentence: ".... treat the LT user as a special case: you are fighting a lack of feature in LT....". See SHADEMODE=2D suggestion as a custom-for-them-alone solution just for that LT user.

 

Which LT year version is in question? That would have been helpful to confirm as well.

0 Likes
Message 17 of 28

Curtis_Waguespack
Consultant
Consultant



@paullimapa wrote:

AutoCAD LT supports command: SHADEMODE 2D 

try & see if that works...

Frankly I don't know why VSCURRENT Wireframe helps for AutoCAD with VSLIDE


@paullimapa the reason it helps is explained here by Alfred:

https://forums.autodesk.com/t5/autocad-forum/runscript-error/m-p/7119848#M882020

 

From testing we know that SHADEMODE 2D does not resolve the original issue in standard AutoCAD, and I would think that AutoCAD LT and AutoCAD handle graphics in the same way concerning the graphics card vs CPU, no?

 

 

EESignature

0 Likes
Message 18 of 28

paullimapa
Mentor
Mentor

Ah so the fix maybe using gpu somehow slows it down rather than cpu or causes AutoCAD to fully process the delay commands in the script. So in LT setting shademode to 2D may be the same as Vscurrent set at 2D (using  cpu) instead of Wireframe (using gpu) and may not be the solution. But still give it a try in LT cause I would be interested in seeing if it makes a difference 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 19 of 28

paullimapa
Mentor
Mentor
Accepted solution

Come to think of it, if you're not dealing with any 3d objects then perhaps setting SHADEMODE in LT to Hidden may be the same as setting VSCURRENT to Wireframe in AutoCAD to force Delay command to work.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 20 of 28

Sea-Haven
Mentor
Mentor

For Lt maybe look at my move option can select an object and use "P" then move.

 

Select an object this is a script so SCRIPT and load it. NOTE there is a space after the P . Blank line at end so last move is carried out.

 

 

 

move p 
0,0 1,0
move p 
0,0 1.0
move p 
0,0 1.0
move p 
0,0 1.0
move p 
0,0 1.0
move p 
0,0 1.0

 

 

 

 

Moved a donut to right at a reasonable speed.

 

Try it dont have LT select object then paste code to command line. Make sure move 1 in X is correct spacing.

 

It may be possible to add the select as well into script.

 

0 Likes