Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant set orthomode in lisp routine. 1

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
US
i have been trying to get this line of code to work. if i move the red text between the first and second pause the ortho sets. if i move it between the second and third pause the program crashes. What do i need to do to make this work?

Code:
(defun c:gl ()
  (initerr)
  (setvar "orthomode" 0)
  (command "-style" "notes" "romans.shx" "4.75" ".85" "10" "n" "n" "n")  	
  (setvar "osmode" 512)
  (command "-insert" "grabm" pause "" "" pause)
  (command "pline" pause pause [COLOR=red](setvar "orthomode" 1)[/color] pause "" "")
  (setvar "osmode" 0)
  (command "dtext" pause "0")
(reset)
(princ)
)
;;;*==========================================================
(defun initerr ()
  (setq oldlayer (getvar "clayer"))
  (setq oldsnap (getvar "osmode"))
  (setq oldSTYLE (getvar "TEXTSTYLE"))
  (setq echo (getvar "cmdecho"))
  (setq temperr *error*)
  (setq *error* trap)
  (princ)
)
;;;*===========================================================
(defun trap (errmsg)
  (command nil nil nil)
  (if (not
	(member errmsg
	 '("console break" "Function Cancelled"))
      )
    (princ (strcat "\nError: " errmsg))
  )                 
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (setvar "textstyle" oldstyle)
  (setvar "cmdecho" echo)
  (princ "\nError Resetting Enviroment ")
  (terpri)
  (setq *error* temperr)
  (princ)
)	
;;;*===========================================================
(defun reset ()
  (setvar "clayer" oldlayer)
  (setvar "osmode" oldsnap)
  (setvar "textstyle" oldstyle)
  (setvar "cmdecho" echo)
  (princ)
)
;;;*======================================================
(princ)
 
Having the (setvar ...) in the middle of commands causes it to crash for me also, in either position. it also seems you have an extra "enter" at the end. Try these 3 lines instead of the one line:

(command "pline"pause pause)
(setvar "orthomode" 1)
(command pause "" )


 
THANKS CARLAK WORKS LIKE A DREAM NOW.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top