+ Reply to Thread
Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 48
  1. #11
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    Registered forum members do not see this ad.

    Dont give up that easy

    Have a look at this similar problem with solution http://www.cadtutor.net/forum/showth...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.
    A man who never made mistakes never made anything

  2. #12
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    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

  3. #13
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    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.

    Code:
    (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
    Last edited by BIGAL; 21st Mar 2013 at 10:17 pm.
    A man who never made mistakes never made anything

  4. #14
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    Hi BigAl,
    I am working my way through this tutorial http://www.afralisp.net/autolisp/tut...ics-part-1.php


  5. #15
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    Fixed a mistake in code
    A man who never made mistakes never made anything

  6. #16
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    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

  7. #17
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    I will check it and if I have time add the missing do all plines.
    A man who never made mistakes never made anything

  8. #18
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    an upgrade still work in progress a bit busy right now

    Code:
    (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
    A man who never made mistakes never made anything

  9. #19
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2013
    Posts
    23

    Default

    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

  10. #20
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,879

    Default

    Registered forum members do not see this ad.

    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 ?
    A man who never made mistakes never made anything

Similar Threads

  1. Extracting xyz coordinates from 3d polylines
    By 1ridgey in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 13th Apr 2012, 02:08 am
  2. How to do this handle????
    By stevep80 in forum AutoCAD 3D Modelling & Rendering
    Replies: 8
    Last Post: 3rd Jan 2012, 08:08 pm
  3. extracting cursor coordinates
    By rusty in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 29th Jun 2006, 10:30 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts