Results 1 to 7 of 7

Thread: Need to create points at endpoints for selected lines with the same layers

  1. #1
    Login to Give a bone
    0

    Default Need to create points at endpoints for selected lines with the same layers

    Hi Guys,

    I want a lisp that can create points at both the ends for selected lines and whatever the points generated should be in same layer of lines.

    Thanks in advance ..

    Regards,
    T.Brahmanandam
    nanaji130285@gmail.com

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    871
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    Hi,

    Something like this ?

    Code:
    (defun c:Test ( / sel ent lst col)
      ;; Tharwat - Date: 22.Aug.2016 ;;
      (princ "\nSelect lines to add point objects on both ends:")
      (if (setq sel (ssget '((0 . "LINE"))))
        (while (setq ent (ssname sel 0))
          (setq lst (entget ent))
          (or (setq col (assoc 62 lst))
              (setq col (assoc 62 (entget (tblobjname "LAYER" (cdr (assoc 8 lst))))))
              )        
          (mapcar '(lambda (p) (entmake (list '(0 . "POINT") (cons 10 p) col)))
                  (list (cdr (assoc 10 lst))
                        (cdr (assoc 11 lst))
                        )
                  )
          (ssdel ent sel)
          )
        )
      (princ)
      )

  3. #3
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,541
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    What about in the case of two lines, on different layers, that share an endpoint?
    Do you want two points to be placed there, one of each layer?
    R.K. McSwain | CAD Panacea |

  4. #4
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    Code:
    (defun c:POL (/ ss i d l)
    
      (princ "\nSelect lines to create points on: ")
      (if (setq ss (ssget '((0 . "LINE"))))
        (repeat (setq i (sslength ss))
          (setq d (entget (ssname ss (setq i (1- i))))
                l (assoc 8 d)
          )
          (entmake (list '(0 . "POINT") l (assoc 10 d)))
          (entmake (list '(0 . "POINT") l (cons 10 (cdr (assoc 11 d)))))
        )
      )
      (princ)
    )
    Civil 3D 2017 ~ Windohz 7
    Dropbox

  5. #5
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    871
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    Oops, I went with color in lieu of Layer !

  6. #6
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    THANK YOU SO MUCH........

  7. #7
    Woo! Hoo! my 1st post
    Join Date
    2002-12
    Posts
    1
    Login to Give a bone
    0

    Default Re: Need to create points at endpoints for selected lines with the same layers

    Thanks a bunch

    Quote Originally Posted by alanjt View Post
    Code:
    (defun c:POL (/ ss i d l)
    
      (princ "\nSelect lines to create points on: ")
      (if (setq ss (ssget '((0 . "LINE"))))
        (repeat (setq i (sslength ss))
          (setq d (entget (ssname ss (setq i (1- i))))
                l (assoc 8 d)
          )
          (entmake (list '(0 . "POINT") l (assoc 10 d)))
          (entmake (list '(0 . "POINT") l (cons 10 (cdr (assoc 11 d)))))
        )
      )
      (princ)
    )

Similar Threads

  1. Compare line endpoints to points and adjust lines
    By GreyHippo in forum AutoLISP
    Replies: 5
    Last Post: 2018-08-15, 09:20 AM
  2. How do I rotate points, then align, and move the selected points
    By dailey.doug105991 in forum AutoCAD Civil 3D - Land Desktop Companion - General
    Replies: 1
    Last Post: 2015-06-30, 02:40 PM
  3. Replies: 3
    Last Post: 2013-06-08, 02:03 PM
  4. Replies: 19
    Last Post: 2012-11-13, 06:58 AM
  5. Replies: 3
    Last Post: 2006-08-08, 08:53 PM

Posting Permissions

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