My lisp is not waiting for my command

My lisp is not waiting for my command

ola.harrius
Explorer Explorer
654 Views
6 Replies
Message 1 of 7

My lisp is not waiting for my command

ola.harrius
Explorer
Explorer

Hi

I have made a script that makes a block of my drawings, save the file vith new name and place, then it rotate and move objects to new coordinates and finaly explode the block and save the file again.

I have made a lisp for the rotate and move, like this:

(defun C:MO (/ MOT NOT ANG)

(setq ANG (getreal "\n Ange vinkel, 0.0 i grader: ")) ; Frågar efter vinkel        

(setq MOT (getpoint "\n Ange nollpunkt, eg 0,0,0: ")) ; Frågar efter koordinater från (0,0,0) i mm

(setq NOT (getpoint "\n Ange ny punkt, eg 0,0,0: ")) ; Frågar efter koordinater till (x,y,z) i mm

(princ)

(command "_.rotate" "all" "" MOT ANG) ; Kör kommandot rotera

(princ)        

(command "_.move" "all" "" MOT NOT) ; Kör kommandot flytta

(princ)

(setq MAGN 2000)

(command "_ZOOM" "_E" NOT MAGN) ; Kör kommandot zoom och förstoring 2000

(princ)

)

It works when I run it all alone, but togheter with my script it not wait for my input and therefore take my next command i my script and I have the "can't reenter lisp" "error". Then it runs my lisp correct but my next commands in my script does not run after this.

I have som error in my lisp, i think, but here I need some help to guide me in the right direction.

0 Likes
655 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

unfortunately you can't pause a script to getpoint


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

EnM4st3r
Advocate
Advocate

wouldnt it work if you put a resume at the end of the lisp?

So like this: 

(command "_resume")
0 Likes
Message 4 of 7

EnM4st3r
Advocate
Advocate

would this work?

 

(defun C:MO (/ mot ang not1)
(setq mot (cond ((getpoint "\n Ange nollpunkt, eg 0,0,0: ")) ('(0 0 0))) ; Frågar efter koordinater från (0,0,0) i mm
      ang (cond ((getangle mot "\n Ange vinkel, 0.0 i grader: ")) (0)) ; Frågar efter vinkel        
      not1 (cond ((getpoint "\n Ange ny punkt, eg 0,0,0: ")) ('(0 0 0))) ; Frågar efter koordinater till (x,y,z) i mm
)
(command "_.rotate" "all" "" mot (polar mot ang 10)) ; Kör kommandot rotera    
(command "_.move" "all" "" mot not1) ; Kör kommandot flytta
(command "_ZOOM" "_E") ; Kör kommandot zoom och förstoring 2000
(command "_resume")  
(princ)
)

 

0 Likes
Message 5 of 7

ola.harrius
Explorer
Explorer
No, the problem is still there....
I tried and did a workaround instead, split my script into two, and run them after each other! Thank you anyway for trying!!
//Ola
0 Likes
Message 6 of 7

EnM4st3r
Advocate
Advocate

what i noticed in my testing is that somehow after using the resume the first expression withing the script gets skipped.. idk why. So i put a dummy there and it works somehow.

 

 

;...
(c:MO)
(princ "\nDummy message")
;dummy line gets skipped idk why
burst
all

;....

 

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

Maybe 

(command "_ZOOM" "_E" NOT MAGN) 

(command "_ZOOM" "_C" NOT MAGN) 
0 Likes