Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@davedt31 wrote:
Hi,
Can anyone please help me in creating lisp for selecting text in enclosed entity and copy it to excel.
I have tried with below lisp but its not working out please help. I am new to lisp so there may be many flaws in this lisg please ignore those.
your help is highly appreciated,
Thanks in advance.
I had a hard time understanding the sequence of your posted code. Maybe you can describe for us what you are wanting to do. Better yet, attached a sample drawing and excel file here davedt3.
@davedt31 wrote:
Hi,
Thanks for the reply and sorry for the trouble. I am looking for a lisp, in which I can export the text enclosed in polylines to excel without manual selection Those polylines will be in some perticular layers. I used entsel, and then after picking closed loop polylines manualy it is selecting everything inside those polylines, but I am not able to export it to excel. Sorry if I am confusing... please reply...
Thanks in advance.
Is there a particular layer for TEXT inside the polyline ? what properties of the text you want to export? the string value? the insertion point? Like i said before, a drawing sample would be better for us to understand your need davedt31
Adopt this file to your suit Dave
Cool mod Oleg, have to admit, i dont rally understand the code the OP posted till i saw you modifcation, then it clicks 🙂
Cheers my friend
Another approach [Play time for pBe]
(defun c:ShowMe (/ _outside-p text ss Pline Txtinside i e entdata spc) (defun _outside-p (pt ent / YoRay len) ;;; pBeFeb20014 ;;; ;;; http://en.wikipedia.org/wiki/Point_in_polygon ;;; ;;; even-odd rule ;;; (setq YoRay (entmakex (list '(0 . "RAY") '(100 . "AcDbEntity") '(100 . "AcDbRay") (cons 10 pt) '(11 1.0 0.0 0.0) ) ) ) (setq len (/ (length (vlax-invoke (vlax-ename->vla-object YoRay) 'intersectwith ent acextendnone ) ) 3) ) (entdel YoRay) (zerop (rem len 2)) ) (if (setq text nil Pline nil Txtinside nil ss (ssget "_X" (list '(-4 . "<OR") '(-4 . "<AND") '(0 . "LWPOLYLINE") '(8 . "avn") '(-4 . "AND>") '(-4 . "<AND") '(0 . "TEXT") '(8 . "Anno-Text") '(-4 . "AND>") '(-4 . "OR>") (cons 410 (getvar 'ctab)) ) ) ) (progn (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i))) entdata (entget e) ) (if (eq "TEXT" (cdr (assoc 0 entdata))) (setq text (cons (list e (cdr (assoc 10 entdata))) text)) (setq Pline (cons (vlax-ename->vla-object e) Pline)) ) ) (foreach itm text (if (setq hit (vl-some '(lambda (pl) (if (not (_outside-p (Cadr itm) pl)) (car itm) ) ) pline ) ) (setq Txtinside (cons hit Txtinside) ) ) ) (foreach tx Txtinside (print (cdr (assoc 1 (entget tx))))) ) )(princ) )
NOT THOROUGHLY TESTED
HTH