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,545 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,546 Views
27 Replies
Replies (27)
Message 21 of 28

rik_pfau
Contributor
Contributor
Accepted solution

I was successful this morning, so I came to update the group, and I see that @paullimapa had suggested the best solution while "I was away." Since I don't have LT, myself, I had to wait for the user to get back in.

 

Instead of setting SHADEMODE to "2D wireframe", which seemed logical, given the AutoCAD setting: VSCURRENT "Wireframe", I noticed there are only two options in LT, so I used SHADEMODE "Hidden" and everything worked as we had hoped.

It switches layers as it runs through the script, and doesn't seem to skip anything.

Thanks, everybody!

 
Message 22 of 28

paullimapa
Mentor
Mentor

Looks like we all learned a good fix that works in bot AutoCAD and LT. Now if the LT user is running 2024 version which accepts Autolisp then a single script can be modified to accommodate for both situations without having two separate scripts. Can you confirm that it’s LT 2024 by running the About command


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

rik_pfau
Contributor
Contributor

Our user is on LT 2021. But if I see where you're going, in the future, the script could read the software version, and make use of an if/then...

It makes sense to me.

0 Likes
Message 24 of 28

paullimapa
Mentor
Mentor

Yes exactly that. But in either case you’ll have to manually set the vscurrent or shademode back to the original setting since this cannot be included in the original script 


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

paullimapa
Mentor
Mentor

One more thing since AutoCAD still accepts the Shademode command but just responds with Vscurrent prompts you can just use Shademode Hidden for both LT and AutoCAD in a single script. 


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

Curtis_Waguespack
Consultant
Consultant

@rik_pfau that's great news! Thanks for providing the solution, hopefully that'll help someone else in the future.

 

@paullimapa, thanks for the helpful suggestions, and ultimately the solution!

EESignature

0 Likes
Message 27 of 28

paullimapa
Mentor
Mentor

Glad to end up with a fix that’s a win win for all…cheers!!!


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

Mike_Y2
Advocate
Advocate

I have skimmed through the posts...

 

I had a similar type of issue in Excel / VBA. The way I got around it was to add a "Calculate" in-between my lines of code.

 

Does adding "Regen" or "RegenAll" have a similar effect? I don't have LT installed to test it - I see you have already used "redraw" so maybe you have already tried this?

0 Likes