vferrara
2009-04-10, 08:30 PM
Hello Augi Members,
I had developed a reactor to automatically set a specific layer when attaching an image file to the drawing. When we migrated to AutoCAD 2009 this image reactor stopper working. Can anyone take a look at the enclosed code and let me know if you find anything that would cause this to happen.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;IMAGE REACTOR
;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
(vl-load-com)
(or dimagereactor
(setq dimagereactor
(vlr-command-reactor
nil
'((:vlr-commandwillstart . cmdstart)
(:vlr-commandended . cmdend)
(:vlr-commandfailed . cmdend)
(:vlr-commandcancelled . cmdend)
)
) ;_ end of vlr-command-reactor
) ;_ end of setq
) ;_ end of or
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;START REACTOR
;;;;;;
(defun cmdstart (react cmd / lay)
(setq cmd (strcase (car cmd) t))
(cond
((wcmatch cmd "*image*")
(setq *clayer* (vla-get-activelayer
(vla-get-activedocument (vlax-get-acad-object))
) ;_ end of vla-get-ActiveLayer
lay (vla-add
(vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
"S-image"
) ;_ end of vla-add
) ;_ end of setq
;;;;;;
;;;;;;Check for Defpoints Layer
;;;;;;
(if (= (strcase (vla-get-name *clayer*)) "DEFPOINTS")
(alert "...The Current Layer is \"DEFPOINTS\" ...Do Not Attach Image Files in Layer Defpoints...Setting Layer S-image As Active Layer...")
) ;_ end of if
(vla-put-color lay 9)
(vla-put-activelayer
(vla-get-activedocument (vlax-get-acad-object))
lay
) ;_ end of vla-put-ActiveLayer
)
) ;_ end of cond
) ;_ end of defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;END REACTOR
;;;;;;
(defun cmdend (react cmd /)
(setq cmd (strcase (car cmd) t))
(cond
((wcmatch cmd "*image*")
(if *clayer*
(vla-put-activelayer
(vla-get-activedocument (vlax-get-acad-object))
*clayer*
) ;_ end of vla-put-ActiveLayer
) ;_ end of if
(setq *clayer* nil)
)
) ;_ end of cond
) ;_ end of defun
Any assistance would be appreciated....!
Regards,
Vince
I had developed a reactor to automatically set a specific layer when attaching an image file to the drawing. When we migrated to AutoCAD 2009 this image reactor stopper working. Can anyone take a look at the enclosed code and let me know if you find anything that would cause this to happen.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;IMAGE REACTOR
;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
(vl-load-com)
(or dimagereactor
(setq dimagereactor
(vlr-command-reactor
nil
'((:vlr-commandwillstart . cmdstart)
(:vlr-commandended . cmdend)
(:vlr-commandfailed . cmdend)
(:vlr-commandcancelled . cmdend)
)
) ;_ end of vlr-command-reactor
) ;_ end of setq
) ;_ end of or
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;START REACTOR
;;;;;;
(defun cmdstart (react cmd / lay)
(setq cmd (strcase (car cmd) t))
(cond
((wcmatch cmd "*image*")
(setq *clayer* (vla-get-activelayer
(vla-get-activedocument (vlax-get-acad-object))
) ;_ end of vla-get-ActiveLayer
lay (vla-add
(vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
"S-image"
) ;_ end of vla-add
) ;_ end of setq
;;;;;;
;;;;;;Check for Defpoints Layer
;;;;;;
(if (= (strcase (vla-get-name *clayer*)) "DEFPOINTS")
(alert "...The Current Layer is \"DEFPOINTS\" ...Do Not Attach Image Files in Layer Defpoints...Setting Layer S-image As Active Layer...")
) ;_ end of if
(vla-put-color lay 9)
(vla-put-activelayer
(vla-get-activedocument (vlax-get-acad-object))
lay
) ;_ end of vla-put-ActiveLayer
)
) ;_ end of cond
) ;_ end of defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
;;;;;;END REACTOR
;;;;;;
(defun cmdend (react cmd /)
(setq cmd (strcase (car cmd) t))
(cond
((wcmatch cmd "*image*")
(if *clayer*
(vla-put-activelayer
(vla-get-activedocument (vlax-get-acad-object))
*clayer*
) ;_ end of vla-put-ActiveLayer
) ;_ end of if
(setq *clayer* nil)
)
) ;_ end of cond
) ;_ end of defun
Any assistance would be appreciated....!
Regards,
Vince