Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Command function in reactor

  1. #11
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Command function in reactor

    Quote Originally Posted by newfoundfreedom View Post
    RenderMan, whilst I am disappointing with not being able to automate this functionality through a reactor, I really appreciate your efforts in helping me out.
    Trust me, I was extremely disappointed, and even embarrassed by my suggestion(s)... I feel that I should have known better.

    Quote Originally Posted by newfoundfreedom View Post
    Nearly every thread I've ever read on these boards has some contribution from you. So have a my friend - for so consistently helping us noobs out.
    I was a noob not so long ago myself, and still feel that I have much to learn (as this thread perfectly demonstrates! LoL). I'm flattered that my small contribution(s) have been so helpful to you *blushing*.

    Quote Originally Posted by newfoundfreedom View Post
    And, by the way - I had no idea bout the ai_commands hidden under the Acad####doc.lsp - thanks for pointing that out.

    Cheers
    Yes, many things are hidden throughout the AutoCAD deployment, especially when you are working with verticals (i.e., Land Desktop, Civil 3D, etc.). *grin*

    Just be sure to NOT put your custom code in any acad####*.lsp file, as these are reserved for AutoCAD, and can be overwritten without notification. Stick to using ACAD.lsp, and ACADDOC.lsp which are both user defined files built into the Startup Sequence. The former is loaded once per session (by default), and the latter is loaded once per drawing.

    Cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  2. #12
    Member
    Join Date
    2013-04
    Posts
    25
    Login to Give a bone
    0

    Default Re: Command function in reactor

    Try this:

    By using:

    Code:
    (vla-SendCommand object Command)

    Point of reference here: https://knowledge.autodesk.com/searc...A0A57-htm.html

    Code:
    ;; AtSaveCommand
    ;; loadTheSaveReactor
    ;; Found here: http://forums.augi.com/showthread.php?93534-Run-lisp-when-closing-drawing&p=926895&viewfull=1#post926895
    (defun AtSaveCommand (calling-reactor b)
    	(if
    		(or
    			(= (car b) "QSAVE")
    			(= (car b) "SAVEAS")
    			(= (car b) "SAVE")
    			)
    		(progn
    			(setq acadObj (vlax-get-acad-object))
    			(setq activeDoc (vla-get-ActiveDocument acadObj))
    			;; Get activeDoc Help: https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-ActiveX/files/GUID-161FD7E5-B739-4E09-8430-BA04A6298703-htm.html
    			(if	(= (vla-get-ActiveSpace activeDoc) 1)
    				(progn
    					(vla-SendCommand activeDoc (strcat "._TEXTTOFRONT A "))
    					; (vla-Regen activeDoc acAllViewports)
    					; (vla-SendCommand activeDoc (strcat "_REGEN "))
    					)
    				(progn
    					; (princ "\nSwitching to ModelSpace & Back, 1 sec...")(princ)
    					;; (run your command here)
    					;; Code changed from here
    					;; YOu can run a command like so: See help here:
    					;; https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-E13A580D-04CA-46C1-B807-95BB461A0A57-htm.html
    					(vla-SendCommand activeDoc (strcat "._TILEMODE 1 "))
    					(vla-SendCommand activeDoc (strcat "._TEXTTOFRONT A "))
    					(vla-SendCommand activeDoc (strcat "._TILEMODE 0 "))
    					; (vla-SendCommand activeDoc (strcat "_REGEN "))
    					; (vla-Regen activeDoc acAllViewports)
    					)
    				)
    			)
    		)
    	)
    (defun loadTheSaveReactor ()
    	(if *FileOnSave* (vlr-remove *FileOnSave*))
    	(setq *FileOnSave*
    		(vlr-command-reactor nil '((:vlr-commandwillStart . AtSaveCommand)))
    		)
    	)
    (vl-load-com)
    (loadTheSaveReactor)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. command reactor selected entity
    By Serhan_BAKIR in forum AutoLISP
    Replies: 3
    Last Post: 2012-01-13, 01:10 PM
  2. Cancel command with Visual Lisp reactor
    By vasco_rou in forum AutoLISP
    Replies: 1
    Last Post: 2011-11-24, 01:20 PM
  3. command Reactor and condtional processing
    By rklee in forum AutoLISP
    Replies: 6
    Last Post: 2009-07-24, 11:42 AM
  4. UnKnown Command Reactor
    By kerbocad in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-01-21, 04:45 PM
  5. Embed command reactor inside a drawing.
    By jrd.chapman in forum AutoLISP
    Replies: 6
    Last Post: 2005-04-25, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •