Author Topic: Reactor save  (Read 1556 times)

0 Members and 1 Guest are viewing this topic.

Jeroen

  • Newt
  • Posts: 21
  • BricsCAD & AutoLisp
Reactor save
« on: November 14, 2012, 04:57:19 PM »
I am trying to create a reactor which get triggered when using SAVE (SAVEAS). When the dialog for filename and path has passed, is there a way to 'read' the chosen filename and path and filter it for specific content? Is this stored somewhere?
What I have is this:

(setq d2_reactor_2404_01
       (vlr-dwg-reactor
    "Save Complete"
    '((:vlr-SaveComplete . DoThisAfterSave)
     )
       )
) ; end setq

(setq savebegin-reactor
       (vlr-dwg-reactor
    "Save Begin"
    '((:vlr-BeginSave . switchbackground))
       )
) ; end setq

(defun switchbackground (calling-reactor commandInfo /)
      (if (vl-string-search "blocks" <path to save>)
      (progn
      (vla-put-GraphicsWinModelBackgrndColor disp newColr)
      (setq col_ch 1)
      ) ; end progn
      ) ; end if
) ; end defun


(defun DoThisAfterSave (Caller1 CmdSet1)
  (prinx "\nTekening opgeslagen!")
  (setq   is_save   T
   is_open   nil
  )
  (if (eq col_ch 1)
    (progn
      (vla-put-GraphicsWinModelBackgrndColor disp oldColr)
      (prinx "   en weer terug naar orginele kleur...")
      ) ; end progn
    ) ; end if
)               ; end defun


What it must do is the following:
The Model drawing background is grey. When the user creates a drawing in the project-path, the background stays grey. If the user creates a block in the library-path (g:\acad\blocks\...) the background is set to white, it saves the drawing and turns the backgroundcolor back to the original grey.
Why do I want this? In AutoCAD 2013 a drawing with a black or grey background is displayed in the designcenter with black or grey background. If I save it with white, in designcenter it becomes white.
Or is there an other way to accomplish this?
Jeroen

Crank

  • Water Moccasin
  • Posts: 1503
Re: Reactor save
« Reply #1 on: November 17, 2012, 10:54:42 PM »
Welkom Jeroen, wil je in 't vervolg CODE-tags gebruiken?

[...]
Or is there an other way to accomplish this?

In this case I think it's easier to redefine the SAVE command.
Vault Professional 2023     +     AEC Collection