Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

exit lisp command due to error

2 REPLIES 2
Reply
Message 1 of 3
GeryKnee
423 Views, 2 Replies

exit lisp command due to error

 

 

i wrote the following code


(defun c:PasteBlockX ()
  (command "_.pasteblock" "0,0,0")
  (command "_.erase" "_L" "")
  (command "-insert" "")
  (princ)
)

 

code is working fine scalling the clipboard drawing data both X and Y direction

 

the problem is that when the current clipboard data is not drawing (for example bitmap) , the function halts on many errors :::

 

 


Command:
Command: PasteBlockX _.pasteblock
Command: 0,0,0 Unknown command "0,0,0".  Press F1 for help.
Command: _.erase
Select objects: _L 0 found
Select objects:
Command: -insert Enter block name or [?]:
Invalid block name.
; error: Function cancelled

 

How to halt / stop / exit command aborting the following "_.pasteblock" command code?

 

 

2 REPLIES 2
Message 2 of 3
smaher12
in reply to: GeryKnee

Maybe try the pasteclip command.

Message 3 of 3
hmsilva
in reply to: GeryKnee

Untested...

 

(defun c:PasteBlockX ()
   (command "_.pasteblock")
   (if (> (getvar 'cmdactive) 0)
      (progn
         (command "0,0,0")
         (command "_.erase" "_L" "")
         (command "-insert" "")
      )
      (princ "\nWrong type of data, in clipboard... ")
   )
   (princ)
)

 

Hope this helps,
Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost