Search the Community
Showing results for tags 'vla-sendcommand'.
Found 2 results
Hello! I'm performing a count in order to create a report from a dwg file. Counting functioncan be called at any time, but necessarily runs on close - when I also count the edit time. For that I'm using a reactor. That works fine. Prior to start the counting I'd like to overkill the whole drawing. That way it will not generate fake data due to duplicated objects. My code: (defun finalize ( / total_vector t_time) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-sendCommand doc "_.-overkill\r_all\r\r_done\r") (arxload "EDITTIME") (load "julian") (setq total_vector (jtoc (acet-edittime-total))) (setq t_time (strcat (LM:rtos (nth 3 total_vector) 2 0) ":" (LM:rtos (nth 4 total_vector) 2 0))) (acet-edittime-enable "OFF") (report1 t_time) (report2 t_time) (CloseReactor) ) As you can see, I'm using a few of (the marvelous) Lee Mac's functions too: (defun CloseReactor nil (vl-load-com) ;; Lee Mac ~ 14.04.10 ( (lambda ( data / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-editor-reactor) ) ) ) (if (vlr-added-p react) (vlr-remove react) (vlr-add react) ) (setq react (vlr-editor-reactor data (list (cons :vlr-beginclose 'CloseCallBack) ) ) ) ) (princ (if (vlr-added-p react) "\n** Reactor Activated **" "\n** Reactor Deactivated **" ) ) react ) "Close-Reactor" ) (princ) ) (defun CloseCallBack (reactor arguments) (vla-put-ActiveSpace (setq doc (vla-get-ActiveDocument (setq acad (vlax-get-acad-object)) ) ) acModelSpace ) (vla-ZoomExtents acad) (vla-put-ActiveLayer doc (vla-item (vla-get-layers doc) "0" ) ) (vla-put-ActiveUCS doc (vla-add (vla-get-usercoordinatesystems doc) (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point '(1. 0. 0.)) (vlax-3D-point '(0. 1. 0.)) "TempWord_UCS" ) ) (if (not (eq "" (vla-get-FullName doc))) (vla-saveas doc (vla-get-FullName doc)) ) (princ) (finalize) ) ;; rtos wrapper - Lee Mac ;; A wrapper for the rtos function to negate the effect of DIMZIN (defun LM:rtos ( real units prec / dimzin result ) (setq dimzin (getvar 'dimzin)) (setvar 'dimzin 0) (setq result (vl-catch-all-apply 'rtos (list real units prec))) (setvar 'dimzin dimzin) (if (not (vl-catch-all-error-p result)) result ) ) I'm using vla-sendfile to call the overkill because I can't use command inside a reactor. If I close the reactor in the begining of the finilize funcion, it closes the drawing before running through the whole function. But I realized that the overkill is being performed AFTER the report1 and report2 functions. That is a problem because report1 and report2 are the functions that generate the report. So, I'm guessing there's some sort of priority of vanilla lisp over vla functions. Is that right? Is there other way of performing this overkill whithout using vla-sendcommand or command? Thanks a lot.
How can I identify a drawing that it is not the active one? vla-get-ActiveDocument? And if so... What is the purpose for vla-sendcommand? I want to run a lisp routine in a drawing that it is not the active one What is proper syntax for both situations? I have been able to make active another drawing than the current one. Even change the screen to this another one but I ahve not been able to run a lisp routine on the last one, I mean from the one I was calling the new one to be active with: vla-activate Thanks in advance Svorgodne