pnunez Posted May 6 Posted May 6 Hello everyone. I'm new to the forum and I'm trying to write some Lisp code. I'm showing you a snippet of one of the main functions. Through a previously loaded DCL, I get a menu from which I activate a submenu that I call 'panvps'. From there, I set a value, and what I intend is for it to go through the entire drawing, moving the interior of the viewport of each layout by that determined value. The function itself works fine outside of this more complex code, but I can't resolve the interaction between the closing dialogs, and the VEVAL-STR+ ARX error appears. Can anyone help me? Thanks in advance defun _addtab (dchand / shiftY result allLayouts layouts layoutName newCenter layoutNum baseCenter baseHeight) (cond ((not (new_dialog "panvps" dchand)) (princ "\n** Error loading PANVPS dialog **") ) (t (set_tile "shiftY" "100") ; Default value (action_tile "accept" (vl-prin1-to-string '(progn (setq shiftY (atof (get_tile "shiftY"))) (done_dialog 1) ; Close panvps (done_dialog 1) ; Close main dialog ) ) ) (action_tile "cancel" "(done_dialog 0)") (setq result (start_dialog)) (if (= result 1) (progn (princ "\nAlready closed") ;;; START LAYOUT PROCESSING ;;; (vl-load-com) (setq allLayouts (layoutlist)) (setq layouts (vl-remove-if-not '(lambda (x) (wcmatch x "*N[0-9][0-9].*")) allLayouts)) (if (not layouts) (progn (alert "No layouts found with XXX.NXX.Example format to process.") (exit) ) ) (setvar "TILEMODE" 0) (command "._layout" "_Set" (car layouts)) (command "._mspace") (setq baseCenter (getvar "VIEWCTR")) (setq baseHeight (getvar "VIEWSIZE")) (foreach layoutName layouts (setq layoutNum (atoi (substr layoutName (+ (vl-string-position (ascii "N") layoutName) 2) 2))) (if (not (vl-catch-all-error-p (vl-catch-all-apply '(lambda () (command "._layout" "_Set" layoutName) (command "._mspace") (setq newCenter (list (car baseCenter) (+ (cadr baseCenter) (* shiftY layoutNum)))) (command "._zoom" "_C" newCenter baseHeight) (command "._pspace") ) ))) (princ (strcat "\nProcessed layout: " layoutName)) ) ) (princ (strcat "\nViewports adjusted. Offset: " (rtos shiftY 2 2))) ;;; END LAYOUT PROCESSING ;;; ) (princ "\nOperation cancelled") ) ) ) (princ) ) Quote
SLW210 Posted May 6 Posted May 6 See this comment first Exception in VEVAL-STR+ ARX Command - AutoLISP, Visual LISP & DCL - AutoCAD Forums Also, Here And HERE Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.