Have a look at this similar problem with solution http://www.cadtutor.net/forum/showthread.php?78109-Block-by-windowing-lisp
What I was saying is your asking 2 questions needs 2 different answers.
Also pretty sure handles are unique so no 2 would be alike so can not find object in 2nd dwg.
Also its about time this is a free forum so we still have to work and play. I would have done it for you but I am busy, I do repsonses in my lunch time not company time. Hi BigAl,
Thanks again for your comment.
What i would probably do with text that currently sits outside the polygons is move them inside. That will make things a lot quicker than trying to write two pieces of code!
I appreciate that the forum is free and i don't expect people to give-up hours of their free time to right a code for someone that is a newbie to the forum.
I am greatful for your input, it has helped. I will persist a bit longer with finding an online manual to help me wite this code.
Thanks I have made a start this pulls co-ords from pline very simple method and then allows ssget to find text it needs some debugging but a start next will be to create a loop for all plines selected.
(defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ))(defun co-ords2xy (); convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z(setq numb (/ (length co-ords) 2))(setq I 0)(repeat numb(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))(setq co-ordsxy (cons xy co-ordsxy)))); program starts here(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))(co-ords2xy)(setq ss (ssget "WP" co-ordsxy (list (cons 0 "*text")))) ; selection set of text within polygon Hi BigAl,
I am working my way through this tutorial http://www.afralisp.net/autolisp/tutorials/the-basics-part-1.php
Fixed a mistake in code I have tried your code on the dwg file i attached at the start of this thread. It doesn't seem to pick up any of the polygons.
On a positive note though i am working my way through the online tutorial and so i am starting to pick up and understand the odd bits of text I will check it and if I have time add the missing do all plines. an upgrade still work in progress a bit busy right now
(defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ))(defun co-ords2xy (/ xy); convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z(setq numb (/ (length co-ords) 2))(setq I 0)(repeat numb(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))(setq co-ordsxy (cons xy co-ordsxy))(setq I (+ I 2)))); program starts here(setq plist (ssget (list (cons 0 "lwpolyline"))))(setq numb (sslength plist))(setq J 0)(repeat numb(setq co-ords (getcoords (ssname plist J)))(co-ords2xy)(setq ss (ssget "WP" co-ordsxy (list (cons 0 "*text")))) ; selection set of text within polygon(princ (sslength ss)) ; this is howmany texts etc (setq co-ordsxy nil)(setq J (+ J 1))(setq ss nil)) ; end repeat I am over the moon that you are helping me with this Big Al.
I have run the lisp and it is now picking up multiple polygons :-)
Thank you What are you trying to achieve in terms of output a simple TXT file or excel or a CSV
pline1 xy xy xy xy
text1 abcde
text2 addd
pline2 xy xy xy xy
text3 jjjj
pline4 and so on ?
页:
1
[2]