Hello all,
I found this lisp-routine here:
http://www.theswamp.org/index.php?topic=10248.15Here is a piece of code from it, just to show were my problem starts:
(defun c:AreaReact (/ Sel EntData PolyObj TextObj ReactList Pos TextSel)
;| Adds a presistant reactor to a polyline object that
updates a selected text object to the polylines area
in square feet. You will have to have the subs loaded
in everydrawing for it to work, so that it know what
to do with the reactor, because it is saved with the
drawing. Saves the association between the text
and the polyline in the extension dictionary of the
polyline. If the text object is deleted, then the
program will remove the reactor related to the polyline.
Thanks to Luis Esquivel for his help and guidance.
v1.0 2/2006 Tim Willey
v1.1 5/2006 Added the ability to select an attribute.
|;
(if
(and
(setq Sel (entsel "\n Select polyline to get area of: "))
(setq EntData (entget (car Sel)))
(= (cdr (assoc 0 EntData)) "LWPOLYLINE")
(setq PolyObj (vlax-ename->vla-object (car Sel)))
(setq Sel (nentsel "\n Select text of hold area value: ")) (setq EntData (entget (car Sel)))
(or
(if (vl-position (cdr (assoc 0 EntData)) '("TEXT" "MTEXT"))
(setq TextSel T)
)
(= (cdr (assoc 0 EntData)) "ATTRIB")
)
(if TextSel
(if (equal (length Sel) 2)
T
(prompt "\n Cannot select nested text.")
Well its working fine, but I thought it might be better, to show the user which polyline ist selected.
I tried to insert
(redraw Sel 3)
after the selction statement, but if iI'm trying to run the programm, I only receive an error-message, "bad argumenttyp: lentityp "
The code looks like this:
(if
(and
(setq Sel (entsel "\n Select polyline to get area of: "))
(redraw Sel 3)
(setq EntData (entget (car Sel)))
(= (cdr (assoc 0 EntData)) "LWPOLYLINE")
(setq PolyObj (vlax-ename->vla-object (car Sel)))Has anyone an idea, how to change the code in a way, the selected polyline is highlighted?
Best regards
Wolfgang