Coder Posted July 31, 2014 Share 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 Link to comment Share on other sites More sharing options...
BlackBox Posted July 31, 2014 Share Posted July 31, 2014 What Object Type is reactor, and what does (vlr-data reactor) return? Quote Link to comment Share on other sites More sharing options...
7o7 Posted August 1, 2014 Share 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 Link to comment Share on other sites More sharing options...
Coder Posted August 1, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
Coder Posted August 1, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
7o7 Posted August 1, 2014 Share Posted August 1, 2014 You are welcome Coder. Quote Link to comment Share on other sites More sharing options...
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.