TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Visual DCL Programming => Topic started by: jbuzbee on June 03, 2008, 10:23:00 AM

Title: Blockview Control problem
Post by: jbuzbee on June 03, 2008, 10:23:00 AM
4.1.2.2
AutoCAD Architecture 2009
WinXP Pro (32)

the scenario:
Modeless form with a blockView control, AutoCAD set to Multi Document Mode, more than one drawing opened.  When the active document is closed, if the blockView control is dispaying a block AutoCAD will crash: Fatal Error.  If the control is clear, i.e. not displaying a block, everything is fine.  So I came up with this work-around which basically clears any blockView controls on any floating modeless forms during the vlr-BeginClose event of a VLR-Dwg-Reactor.

If your experiencing the same problem try the following.  Just change the form variables in the jb:BeginClose callback function.


Code: [Select]
(vl-load-com)
;;; BeginClose ;
 (defun jb:BeginClose(calling-reactor event / )
   (if (dcl_Form_IsActive jb006_00)
    (dcl_BlockView_Clear jb006_00_BlockView1))
(if (dcl_Form_IsActive jb003_00)
    (progn(dcl_BlockView_Clear jb003_00_DwgView)
      (dcl_BlockView_Clear jb003_00_BlockView)
      )
  )
   (if (dcl_Form_IsActive jb004_00)
    (dcl_BlockView_Clear jb004_00_BlockView))
   (princ)
   )

;;; Construct the BeginClose Reactor ;
(defun jb::ConstructBeginCloseReactor  (/)
  (if (= (type *jbBeginCloseReactor*) 'VLR-Dwg-Reactor)
    (progn (vlr-remove *jbBeginCloseReactor*) (setq *jbBeginCloseReactor* nil)))
  (if (/= (type *jbBeginCloseReactor*) 'VLR-Dwg-Reactor)
    (setq *jbBeginCloseReactor*
           (VLR-Dwg-Reactor
             "jbTools Begin Close Event Reactor" ; Data associated with the editor reactor
             ;; call backs
             '
              ((:vlr-beginClose . jb:BeginClose)
               )) ;_ end of vlr-editor-reactor
          ))

  (if (not (vlr-added-p *jbBeginCloseReactor*))
    (progn
    (vlr-add *jbBeginCloseReactor*)
    (vlr-set-notification *jbBeginCloseReactor* 'active-document-only)));added 09.26.2003
  (princ))


;;; load reactors ;

(if jb::ConstructBeginCloseReactor
  (jb::ConstructBeginCloseReactor))