ccowgill
2006-12-13, 06:49 PM
I am using a reactor that fires when our titleblock is double clicked on (eattedit) my program works great when the last blcok inserted was the titleblock, but if it wasnt it doesnt seem to work, I would like to have the program run only when the item to be selected is the title block (hence the last item selected, or modified). I am positive it is a simple function, but I cant find it anywhere in help.
;; Check if Bridge_Reactor is loaded in the task otherwise load it ( Do NOT load a reactor more than once )
(if (not Bridge_Reactor )
(setq Bridge_Reactor (vlr-command-reactor nil '((:vlr-commandEnded . My_Bridge_Command ))) )
( ) ;; The reactor is already loaded
)
;;; Function used as Callbacks when the event fires / reactor triggers
(defun My_Bridge_Command (In_ReactorName In_Command / )
;(PRIN1 (car In_Command )) ;; <-- Remove this line, it shows all incomming command
;; Check if incomming command is Insert, Pasteclip or Dropgeom
(if
(or
(= (car In_Command ) "EATTEDIT" )
(= (car In_Command ) "DDEDIT" )
)
;; Then check if the last selected object is TBL13
(if (= (cdr (assoc 2 (entget (entlast)))) "TBL13" )
(BN) ;; Run the already loaded function BN
( ) ;; The last object was not TBL13
)
( ) ;; The last command was not EATTEDIT OR DDEDIT
)
(princ)
)
;|;; How to remove the Reactor :
(vlr-remove Bridge_Reactor )
;;; How to clear the place holder :
(setq My_Bridge_Command nil )
|;
(defun bn ()
(setq filetype (getvar "dwgname"))
(setq Ent (ssname (ssget "_x" '((0 . "insert")(2 . "TBL13")))0))
(setq EntData (entget Ent))
(if
(and
(= (cdr (assoc 0 EntData)) "INSERT")
(= (strcase (cdr (assoc 2 EntData))) "TBL13")
(not
(foreach Att (vlax-invoke (vlax-ename->vla-object Ent) 'GetAttributes)
(if (= (vla-get-TagString Att) "PLANANDPROFILE")
(setq tmpList (cons Att (vla-get-TextString Att))
val (cdr tmplist))
)
(if (= (vla-get-TagString Att) "SHEET_DESCRIPTION")
(setq tmpList2 (cons Att (vla-get-TextString Att)))
)
);end foreach
);END NOT
);END AND
(vla-put-TextString (car tmpList2) val)
(vla-Update (car tmpList2))
);end if
);END DEFUN
;; Check if Bridge_Reactor is loaded in the task otherwise load it ( Do NOT load a reactor more than once )
(if (not Bridge_Reactor )
(setq Bridge_Reactor (vlr-command-reactor nil '((:vlr-commandEnded . My_Bridge_Command ))) )
( ) ;; The reactor is already loaded
)
;;; Function used as Callbacks when the event fires / reactor triggers
(defun My_Bridge_Command (In_ReactorName In_Command / )
;(PRIN1 (car In_Command )) ;; <-- Remove this line, it shows all incomming command
;; Check if incomming command is Insert, Pasteclip or Dropgeom
(if
(or
(= (car In_Command ) "EATTEDIT" )
(= (car In_Command ) "DDEDIT" )
)
;; Then check if the last selected object is TBL13
(if (= (cdr (assoc 2 (entget (entlast)))) "TBL13" )
(BN) ;; Run the already loaded function BN
( ) ;; The last object was not TBL13
)
( ) ;; The last command was not EATTEDIT OR DDEDIT
)
(princ)
)
;|;; How to remove the Reactor :
(vlr-remove Bridge_Reactor )
;;; How to clear the place holder :
(setq My_Bridge_Command nil )
|;
(defun bn ()
(setq filetype (getvar "dwgname"))
(setq Ent (ssname (ssget "_x" '((0 . "insert")(2 . "TBL13")))0))
(setq EntData (entget Ent))
(if
(and
(= (cdr (assoc 0 EntData)) "INSERT")
(= (strcase (cdr (assoc 2 EntData))) "TBL13")
(not
(foreach Att (vlax-invoke (vlax-ename->vla-object Ent) 'GetAttributes)
(if (= (vla-get-TagString Att) "PLANANDPROFILE")
(setq tmpList (cons Att (vla-get-TextString Att))
val (cdr tmplist))
)
(if (= (vla-get-TagString Att) "SHEET_DESCRIPTION")
(setq tmpList2 (cons Att (vla-get-TextString Att)))
)
);end foreach
);END NOT
);END AND
(vla-put-TextString (car tmpList2) val)
(vla-Update (car tmpList2))
);end if
);END DEFUN