gerardo2m Posted June 6, 2019 Posted June 6, 2019 Hi. The following routine generates the exception e06d7363 when using (* push-error-using-command *). If I replace "myerror" (* push-error-using-command *) with (* push-error-using-stack *) and the "command" with "command-s", the exception is not generated; but when activating "myerror" the message is generated that indicates that I must use (* push-error-using-command *) or command-s. (defun test (a b / ) (entradaTest) ;;(*push-error-using-command*) (/ a b) (setq *DrawingGER* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq LayersColeccion (vlax-get-property *DrawingGer* "Layers")) ;;Crea las layer necesarias para alojar las entidades del dibujo. (setq ListaLayers (list "Make_Tuberias" "Biseles" "3D_Perfil")) ;;Funcion: AX-EXISTE+. ;;Parametro "elemento" es una cadena con el nombre de elemento a buscar en una coleccion, ej (ax-existe+ "0" "LAYERS"). ;;Archivo iList.lsp (foreach X ListaLayers (if (not (ax-Existe+ X "Layers")) (vl-cmdf ".-layer" "New" X "T" X "")) ) (salidaTest) ;;(*pop-error-mode*) ) (defun myerror (s) (if (/= s "Function cancelled") (princ (strcat "\nError GER: " s)) ) (setvar "cecolor" color_org) (setvar "cvport" port_view_ger) (command "_vpoint" vpoint_ger) (command "_zoom" "W" MSMAX_GER MSMIN_GER) (setvar "clayer" clayer1) (setvar "INSUNITS" val_var_INSUNITS) (cmd-salir) (SETVAR "osmode" ref0) (setvar "3dosmode" 3DOSMODE_ORG) (setq *error* olderr) (command "_undo" "_end") (SETVAR "cmdecho" 1) (PRIN1) ) (defun entradaTest ( / ) (*push-error-using-command*) ;;(*push-error-using-stack*) (SETVAR "cmdecho" 0) (COMMAND "_undo" "_begin") (setq olderr *error* *error* myerror) (SETQ ref0 (GETVAR "osmode")) (SETVAR "osmode" 0) (setq 3DOSMODE_ORG (GETVAR "3dosmode")) (setvar "3dosmode" 0) (SETQ port_view_ger (getvar "cvport")) ;;(SETQ vpoint_ger (getvar "viewdir")) ;;(SETQ VSMAX_GER (getvar "vsmax")) ;;(SETQ VSMIN_GER (getvar "vsmin")) (setq val_var_INSUNITS (getvar "INSUNITS")) ;;(setvar "INSUNITS" 1) ;1 para pulgadas. (setq clayer1 (getvar "clayer")) (setvar "clayer" "0") (setq color_org (getvar "cecolor")) ) (defun salidaTest ( / ) (setvar "cecolor" color_org) ;;(setq *error* olderr) (setvar "cvport" port_view_ger) (command "_vpoint" vpoint_ger) (setvar "clayer" clayer1) (setvar "INSUNITS" val_var_INSUNITS) (SETVAR "osmode" ref0) (setvar "3dosmode" 3DOSMODE_ORG) (COMMAND "_undo" "_end") (setq *error* olderr) ; Restore old *error* handler (COMMAND "_undo" "_end") (SETVAR "cmdecho" 1) (*pop-error-mode*) (PRIN1) ) (defun AX-EXISTE+ (elemento coleccion / Colecciones temp X resultado *DrawingGER* Coleccion ) ;;Colecciones disponibles. (setq Colecciones (list "Blocks" "Dictionaries" "DimStyles" "FileDependencies" "Groups" "Layers" "Layouts" "LineTypes" "Materials" "ModelSpace" "PaperSpace" "PickFirstSelectionSet" "Plot" "PlotConfiguration" "Preferences" "RegisteredApplications" "SelectionSets" "SummaryInfo" "TextStyles" "UserCoordinatesSystems" "Utility" "Viewports" "Views") ) ;;Verifica si la coleccion existe en el documento actual. (setq temp nil) (foreach X Colecciones (if (equal (strcase coleccion) (strcase X)) (setq temp T)) ) (if temp (progn (setq *DrawingGER* (vla-get-ActiveDocument (vlax-get-acad-object))) ;;Obtiene el objeto DXF del dibujo actual. (setq Coleccion (vlax-get-property *DrawingGer* coleccion)) ;;Obtiene el objeto DXF de la Coleccion requerida, por ejemplo "Layers". (if (not (vl-catch-all-error-p (setq resultado (vl-catch-all-apply 'vla-item (list coleccion elemento))))) t nil) ) (progn (prompt (strcat "\n**(ax-Existe+) Nombre de coleccion \"" coleccion "\" no identificada.\n")) (princ) nil ) ) ) Any idea of the reason for the exception? Greetings. Quote
dlanorh Posted June 7, 2019 Posted June 7, 2019 If you are seeing this, Quote Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. It is because your local error replacement contains command calls. "command" needs replacing with "command-s" only in local error sub routines, or replace command calls entirely if possible. This problem will also affect some "express tools" if loaded. 1 Quote
gerardo2m Posted June 10, 2019 Author Posted June 10, 2019 I removed all the "comand" instructions and the exception was no longer generated. Thank you. Quote
mohammadreza Posted December 18, 2023 Posted December 18, 2023 On 6/7/2019 at 11:18 AM, dlanorh said: If you are seeing this, It is because your local error replacement contains command calls. "command" needs replacing with "command-s" only in local error sub routines, or replace command calls entirely if possible. This problem will also affect some "express tools" if loaded. On 6/7/2019 at 11:18 AM, dlanorh said: If you are seeing this, It is because your local error replacement contains command calls. "command" needs replacing with "command-s" only in local error sub routines, or replace command calls entirely if possible. This problem will also affect some "express tools" if loaded. i have this problem with below code(Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended.) (progn (if (and (setq Locator (vlax-create-object "WbemScripting.SWbemLocator")) (setq Server (vlax-invoke Locator 'ConnectServer "." "root\\cimv2")) (setq meth1 (vlax-invoke Locator 'ConnectServer nil nil nil nil nil nil nil nil)) (setq Query (vlax-invoke Server 'ExecQuery "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True")) (setq meth2 (vlax-invoke meth1 'ExecQuery "select ProcessorId from Win32_Processor")) ) (and (vlax-for item Query (setq ret (vlax-get item 'MacAddress))) (vlax-for item meth2 (setq serx (vlax-get item 'ProcessorId))) ) ) (foreach obb '(Locator Server Query meth2) (vl-catch-all-apply 'vlax-release-object (list obb)) ) (if (and (eq "78:24:AF:9D:95:49" ret) ;; This is your Pc MAC (eq "BFEBFBFF000306C3" serx) ;; This is your Processor Id ) (princ "You can work") (progn (setvar "osmode" 0) (command "PLINE" "-0.244,-0.137" "-0.22,-0.049" "-0.205,0.088" "-0.211,0.177" "-0.222,0.285" "-0.222,0.359" "-0.213,0.479" "-0.201,0.606" "-0.201,0.699" "-0.21,0.805" "-0.21,0.89" "-0.186,1.205" "-0.152,1.289" "-0.089,1.322" "-0.033,1.333" "0.051,1.314" "0.118,1.276" "0.144,1.198" "0.09,1.231" "0.035,1.258" "-0.028,1.266" "-0.105,1.249" "-0.125,1.234" "-0.11,1.058" "-0.081,1.018" "-0.033,0.996" "0.023,1.002" "0.067,1.038" "0.092,1.206" "0.09,1.231" "0.144,1.198" "0.151,1.018" "0.165,0.88" "0.165,0.794" "0.151,0.683" "0.151,0.569" "0.171,0.388" "0.167,0.249" "0.157,0.105" "0.173,-0.046" "0.189,-0.14" "0.173,-0.046" "0.157,0.105" "0.167,0.249" "0.171,0.388" "0.193,0.383" "0.298,0.379" "0.369,0.356" "0.423,0.307" "0.436,0.267" "0.489,-0.101" "0.436,0.267" "0.443,0.294" "0.499,0.312" "0.569,0.312" "0.614,0.288" "0.647,0.255" "0.736,-0.167" "0.714,-0.243" "0.664,-0.308" "0.618,-0.33" "0.522,-0.355" "0.493,-0.348" "0.484,-0.302" "0.493,-0.348" "0.438,-0.431" "0.366,-0.46" "0.277,-0.47" "0.191,-0.456" "0.179,-0.365" "0.192,-0.456" "0.108,-0.493" "-0.013,-0.524" "-0.077,-0.517" "-0.165,-0.489" "-0.216,-0.454" "-0.179,-0.348" "-0.217,-0.455" "-0.311,-0.448" "-0.429,-0.416" "-0.525,-0.344" "-0.553,-0.276" "-0.626,-0.079" "-0.672,0.032" "-0.646,0.161" "-0.573,0.347" "-0.494,0.447" "-0.478,0.383" "-0.494,0.447" "-0.394,0.447" "-0.215,0.447" "-0.222,0.359" "-0.255,0.37" "-0.391,0.354" "-0.472,0.297" "-0.484,0.176" "-0.508,-0.005" "-0.524,-0.147" "-0.553,-0.276" "") (command "zoom" "w" '(-1.134 1.449) '(1.204 -0.677)) (quit) ) ) (princ) ) 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.