Coder Posted July 31, 2014 Posted July 31, 2014 Hello guys . I need to use a reactor to re write the text string as it was inserted with a routine if any user changed this text string . This is my codes and it doesn't work , can anyone help me please ? (defun c:write (/ pnt txtobj) (vl-load-com) (setq pnt (getpoint "\n text location :")) (setq txtobj (entmakex (list '(0 . "TEXT") (cons 10 pnt) (cons 11 pnt) (cons 40 1.0) (cons 1 "Text example") ) ) ) (setq *obj* (vlr-object-reactor (list (vlax-ename->vla-object txtobj)) "example-1" '((:vlr-modified . modifytext)) ) ) (princ) ) (defun modifytext (noifier reactor paparms /) (vla-put-textstring (vlr-data reactor) "Text example") ) Quote
BlackBox Posted July 31, 2014 Posted July 31, 2014 What Object Type is reactor, and what does (vlr-data reactor) return? Quote
7o7 Posted August 1, 2014 Posted August 1, 2014 Your code is not working because (vlr-data reactor) in the case is the string "example-1", it doesn't mean anything. You have to put another text object as vlr-data, cad don't let you take reactor's owner (as active object) and reactor's data (as passive object) the same object. You try this: (defun c:write (/ pnt txtobj) (vl-load-com) (setq pnt (getpoint "\n text location :")) (setq txtobj (entmakex (list '(0 . "TEXT") (cons 10 pnt) (cons 11 pnt) (cons 40 1.0) (cons 1 "Text example") ) ) ) (setq txtobj1 (car (entsel "\nChoose another text:"))) (setq *obj* (vlr-object-reactor (list (vlax-ename->vla-object txtobj)) (list (vlax-ename->vla-object txtobj1)) '((:vlr-modified . modifytext)) ) ) (princ) ) (defun modifytext (notifier reactor paparms /) (vla-put-textstring (car (vlr-data reactor)) "Text example rewrote") ) Quote
Coder Posted August 1, 2014 Author Posted August 1, 2014 What Object Type is reactor, and what does (vlr-data reactor) return? thank you for reply . I think vlr-data is the data associated with a reactor . i don't know more . Quote
Coder Posted August 1, 2014 Author Posted August 1, 2014 Your code is not working because (vlr-data reactor) in the case is the string "example-1", it doesn't mean anything.You have to put another text object as vlr-data, cad don't let you take reactor's owner (as active object) and reactor's data (as passive object) the same object. You try this: (defun c:write (/ pnt txtobj) (vl-load-com) (setq pnt (getpoint "\n text location :")) (setq txtobj (entmakex (list '(0 . "TEXT") (cons 10 pnt) (cons 11 pnt) (cons 40 1.0) (cons 1 "Text example") ) ) ) (setq txtobj1 (car (entsel "\nChoose another text:"))) (setq *obj* (vlr-object-reactor (list (vlax-ename->vla-object txtobj)) (list (vlax-ename->vla-object txtobj1)) '((:vlr-modified . modifytext)) ) ) (princ) ) (defun modifytext (notifier reactor paparms /) (vla-put-textstring (car (vlr-data reactor)) "Text example rewrote") ) thank you so much for explanations and modifying codes , very helpful reply many thanks . Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.