Author Topic: The area reactor question?  (Read 2300 times)

0 Members and 1 Guest are viewing this topic.

hunterxyz

  • Guest
The area reactor question?
« on: March 13, 2007, 08:23:30 AM »
QQ1: When area writing deletion, how restores the area writing?

QQ2: After the file puts on file the closure or closes CAD,
will open to the next time when how will restore the reactor?

My procedure:

Code: [Select]
(defun C:PLAREARO ()
(vl-load-com)
(setq acaddocument(vla-get-activedocument(vlax-get-acad-object)))
(setq pt (getpoint "\n Selects point the area writing laying:"))
(setq EN (CAR(ENTSEL "\n Selects the PLINE thing:")))
(command "-BOUNDARY" pt "")
(setq vla-en (cons (vlax-ename->vla-object en) '()))
(if (/= en nil)
      (progn
      (command "area" "o" en)
      (command "layer" "m" "tmp" "c" "1" "" "")
      (command "chprop" en "" "la" "tmp" "")
      (setq txt (strcat (rtos (/ (getvar "area") 10000) 2 2) "㎡")
      )
      (command "layer" "m" "AREA-TEXT" "c" "4" "" "")
      (command "text" "j" "MC" pt "30" "0" txt)
(setq vla-area-txt (cdr (assoc 5 (entget (entlast)))))))

(setq vla-rot (vlr-pers
       (vlr-object-reactor vla-en vla-area-txt
'((:vlr-modified . area-txt))) )
)
(vlr-type vla-rot)
(princ "\n Established the reactor Has: ")
(princ (vlr-reactors))
)

(defun area-txt (notifier-object reactor-object parameter-list)
(setq pl-txt (handent (vlr-data reactor-object)))
(setq txt (vlax-ename->vla-object pl-txt))
(setq obj-area (vla-get-area notifier-object))
(setq txt-nub (strcat (rtos (/ obj-area 10000) 2 2) "㎡") )
(vla-put-TextString txt txt-nub )
)

Requests fellow masters to be allowed to help to explain Thanks!
« Last Edit: March 13, 2007, 01:25:26 PM by Maverick® »

Guest

  • Guest
Re: The area reactor question?
« Reply #1 on: March 13, 2007, 08:42:49 AM »
Why not just use a FIELD instead?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: The area reactor question?
« Reply #2 on: March 13, 2007, 11:30:51 AM »
QQ1: When area writing deletion, how restores the area writing?
I don't think you can with the code you have.  Maybe you can store the insertion point along with the handle, so you can check if the text is erased, and if so then make it again with the reactor portion.  Or you can create a diction for your reactor text objects.  Store them with the handle and the insertion point.  Then you can check to see if it's erased, and if so, look in the dictionary and get the insertion point so you can create a new text object that way.  That way it will be stored within the drawing also.  Just shouting out ideas.

QQ2: After the file puts on file the closure or closes CAD,
will open to the next time when how will restore the reactor?
You are making the reactor persistant in the code.  Here
Code: [Select]
(setq vla-rot (vlr-pers
          (vlr-object-reactor vla-en vla-area-txt
      '((:vlr-modified . area-txt))) )
)
So as long as you load the reacting code into the drawing again, it will react correctly.

Hope that makes sense to you.

Edit:  If you can use fields, then you might want to for this, as it will be easier.  Or you can use this as a learning exercise.
« Last Edit: March 13, 2007, 11:32:19 AM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

hunterxyz

  • Guest
Re: The area reactor question?
« Reply #3 on: March 16, 2007, 07:08:46 PM »
THANK YOU