Author Topic: How would you handle this: Timer function?  (Read 13066 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
How would you handle this: Timer function?
« on: September 12, 2006, 11:09:59 AM »
A friend asked me to throw something together for him as an art project and this is, essentially, what he wants to do;

Open a drawing
Wait a specified amount of time (5 minutes or so)
Close the drawing
Open the next
Wait a specified amount of time (5 minutes or so)
Close the drawing
Open the next
Wait a specified amount of time (5 minutes or so)
Close the drawing
Open the next
etc...

But here's the catch: He wants the user (gallery patron) to be able to use the 3DOrbit command via touchscreen for those 5 minutes or so...

Now I haven't put a tremendous amount of thought into the process but the half a dozen things I considered didn't seem to work.

While he is a very talented 3D artist and quite proficient with AutoCAD, he wouldn't know a Lisp routine from a script so I'm trying to make this as simple as possible for him.

I've got it setup now to write a script based on the drawings contained in a selected folder, then run the script. No problems there. It's the "start a timer, begin the 3dOrbit command, cancel the command at the specified time" part that's giving me trouble.

Any suggestions or advice?

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
Re: How would you handle this: Timer function?
« Reply #1 on: September 12, 2006, 11:43:01 AM »
.net should be able to handle this pretty easily, i don't think lisp would like it much though.
when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak

T.Willey

  • Needs a day job
  • Posts: 5241
Re: How would you handle this: Timer function?
« Reply #2 on: September 12, 2006, 11:57:06 AM »
.net should be able to handle this pretty easily, i don't think lisp would like it much though.
I second that.  I have written a basic countdown program in C# if you want to see it.  It has been posted in the .Net forum, here.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: How would you handle this: Timer function?
« Reply #3 on: September 12, 2006, 12:05:49 PM »
Well, to think I was trying to make this as simple as possible for my friend... honestly, that code was all Greek to me. :)

Okay, it wasn't that bad, but I have no idea how to use code written in C# in AutoCAD. And I have no idea how to hack your routine to make it do only what I want. And I have no idea how to explain it to anyone else.

Basically, I'm (as usual) quite lost and confused.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1542
  • Moscow (Russia)
Re: How would you handle this: Timer function?
« Reply #4 on: September 12, 2006, 12:12:27 PM »
Use View object...
Stay home. Stay safe. Save lives.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: How would you handle this: Timer function?
« Reply #5 on: September 12, 2006, 12:19:32 PM »
I would think that you would need a reator of some sort so that the user couldn't cancel the ORBIT command and if they do reinvoke it til the time runs out.  I wouldn't se why it couldnt be done with lisp, but it would be hard to control.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

T.Willey

  • Needs a day job
  • Posts: 5241
Re: How would you handle this: Timer function?
« Reply #6 on: September 12, 2006, 12:21:51 PM »
Okay.  :-)

If I understand you correctly, you want to select a certain amout of drawings, have one open for 5 minutes, and then close it (without saving), and open the next one?  I think this shouldn't be too hard.  Let me see what I can come up with.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1542
  • Moscow (Russia)
Re: How would you handle this: Timer function?
« Reply #7 on: September 12, 2006, 12:25:09 PM »
It is possible to write orbit program...
From a script we open the drawing and we start for my_orbit program which watches an operating time and itself it is completed, further the script opens the following drawing.
Stay home. Stay safe. Save lives.

T.Willey

  • Needs a day job
  • Posts: 5241
Re: How would you handle this: Timer function?
« Reply #8 on: September 12, 2006, 12:35:18 PM »
How do you get it to watch the time?  I have never seen a way to do that, and I have seen a couple of people asking for this.  Very interesting.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: How would you handle this: Timer function?
« Reply #9 on: September 12, 2006, 12:50:09 PM »
How do you get it to watch the time?  I have never seen a way to do that, and I have seen a couple of people asking for this.  Very interesting.

x2

Which is why I posted in the first place. I've already got a very simple "select a drawing from your folder, write the script, run it" routine setup I'm just stuck on the whole "after this period of time (during which the 3DOrbit command is being used) go to the next drawing" bit.


John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9484
Re: How would you handle this: Timer function?
« Reply #10 on: September 12, 2006, 08:29:46 PM »
> How would i handle this?
With a program.

> How do you get it to watch the time?  I have never seen a way to do
> that, and I have seen a couple of people asking for this.

Then you havnet paid attention.

EDIT: Fat fingers!!!

Try this on for size. Its real sloppy, but it was a once thru quickie.

Code: [Select]
(defun tryme ( / sec flag)
  (alert "I will give you a few seconds to draw as many lines as you can GO!")
  (command "_.line")
  (setq sec (atoi (substr (rtos (getvar "cdate")2 8) 12 2)))
  (if (= 1 (logand (getvar"cmdactive") 1))
    (setq flag T))
  (while flag
         (command pause)
         (if (> (atoi (substr (rtos (getvar "cdate")2 8) 12 2)) sec)
           (setq flag nil)))
  (command) (command)
  (alert "Alright, that's enough!")
  (princ)
 )
« Last Edit: September 12, 2006, 08:31:22 PM by Se7en »
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

T.Willey

  • Needs a day job
  • Posts: 5241
Re: How would you handle this: Timer function?
« Reply #11 on: September 13, 2006, 11:14:54 AM »
Works.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

nivuahc

  • Guest
Re: How would you handle this: Timer function?
« Reply #12 on: September 13, 2006, 11:16:15 AM »
Not with 3DOrbit. :)

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9484
Re: How would you handle this: Timer function?
« Reply #13 on: September 13, 2006, 05:49:38 PM »
> Works.

Yep, sorta.  It's bloated, crapy, and redundant, but when it comes time we can put a dress on the theory and send it off to the prom.

> Not with 3DOrbit.

Not with the native one. But i was under the impression that we were going to roll our own.  (hence the ``simple'' code. ...I was using something like ``working pseudo code'' to drive a point home.)

TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How would you handle this: Timer function?
« Reply #14 on: September 13, 2006, 05:56:31 PM »
Hi John, long time ...

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--