Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Looking for lisp routine to select objects inside polyline

  1. #1
    Member
    Join Date
    2011-05
    Posts
    5
    Login to Give a bone
    0

    Default Looking for lisp routine to select objects inside polyline

    Buna ziua
    As dori si eu sa ma ajutati daca se poate cu un program in Autolisp pentru ca sunt incepator si imi trebuie pentru proiect.Problema ii urmatoarea:
    Sa se selecteze entitatile polilinie si sa se marcheze capetele cu patrate de latura date de utilizator




    Multumesc frumos

  2. #2
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Quote Originally Posted by vlad_tzok133583 View Post
    Buna ziua
    As dori si eu sa ma ajutati daca se poate cu un program in Autolisp pentru ca sunt incepator si imi trebuie pentru proiect.Problema ii urmatoarea:
    Sa se selecteze entitatile polilinie si sa se marcheze capetele cu patrate de latura date de utilizator




    Multumesc frumos
    嗨!朋友,您能写中文吗?
    It is a joke.
    Could you please write it in English?
    Sorry, I do not understand your question.

  3. #3
    Member
    Join Date
    2011-05
    Posts
    5
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Good Day
    I would like myself if you can help me with a program in AutoLISP for being a beginner and I need to proiect.Problema them the following:
    Polyline to select entities and squares to mark the ends of data the user side

  4. #4
    Director of Operations David Harrington's Avatar
    Join Date
    2000-10
    Location
    Tampa, Florida
    Posts
    416
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Quote Originally Posted by vlad_tzok133583 View Post
    Good Day
    I would like myself if you can help me with a program in AutoLISP for being a beginner and I need to proiect.Problema them the following:
    Polyline to select entities and squares to mark the ends of data the user side
    So you want a program that selects objects surrounded by a polyline and then put squares (polylines?) at the points where the objects are found?
    Take care,
    David Harrington
    AUGI Director of Operations

  5. #5
    Member
    Join Date
    2011-05
    Posts
    5
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    program that selects a polyline entities and heads to mark the squares on the user side

  6. #6
    Member
    Join Date
    2011-05
    Posts
    5
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Quote Originally Posted by David Harrington View Post
    So you want a program that selects objects surrounded by a polyline and then put squares (polylines?) at the points where the objects are found?
    is ok and as you say

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Note that I have changed the original title of this thread (Help me) to something more descriptive.
    R.K. McSwain | CAD Panacea |

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Quote Originally Posted by vlad_tzok133583 View Post
    Quote Originally Posted by vlad_tzok133583 View Post
    Quote Originally Posted by David Harrington View Post
    So you want a program that selects objects surrounded by a polyline and then put squares (polylines?) at the points where the objects are found?
    program that selects a polyline entities and heads to mark the squares on the user side
    is ok and as you say

    What is the purpose of selecting the entities within the polyline boundary, if you're intent is to 'mark' the endpoints of said boundary (or vise versa for that matter)?

    Are these 'marks' intended to be a graphical display of the vertexes of the boundary (i.e., to be removed upon the routine's completion), or are they to remain in the drawing (i.e, separate entities at each vertex)?

    More information is needed.

    Quote Originally Posted by rkmcswain View Post
    Note that I have changed the original title of this thread (Help me) to something more descriptive.
    Hilarious.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  9. #9
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Quick one ... well, if the heading is correct:
    Code:
    (vl-load-com)
    
    ;; Select window poly
    (defun c:SelWP (/)
      (SelPoly "_WP")
      (princ)
    )
    
    ;; Select crossing poly
    (defun c:SelCP (/)
      (SelPoly "_CP")
      (princ)
    )
    
    ;; Select objects inside a polyline
    (defun SelPoly (WC / pSS ss ss1 n m en)
      (if (and
            (progn
              (prompt "\nSelect polylines to form WPoly borders: ")
              (setq pSS (ssget '((0 . "LWPOLYLINE"))))
            )
            (setq n (sslength pSS))
            (setq ss (ssadd))
          )
        (while (> (setq n (1- n)) -1)
          (if (and
                (setq ss1 (ssget WC (mapcar 'cdr (vl-remove-if-not '(lambda (item) (= (car item) 10)) (entget (ssname pSS n))))))
                (setq m (sslength ss1))
              )
            (while (> (setq m (1- m)) -1)
              (setq en (ssname ss1 m))
              (if (not (ssmemb en pSS)) (ssadd en ss))
            )
          )
          (setq ss1 nil)
          (gc)
        )
      )
      (if (and ss (> (sslength ss) 0))
        (sssetfirst nil ss)
      )
    )

  10. #10
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Looking for lisp routine to select objects inside polyline

    Here is another way to select objects inside a polyline (the polyline and all of the objects inside must be onscreen)

    It uses the vlax-curve functions.

    It also assumes straight line edges, curves can be accomodated by increasing the number of points along the edge (not shown)

    I have other methods that are not as fast but can do this off screen.

    Peter


    Code:
    (defun C:Poly (/
                   entSelection   
                   sngParam
                   lstPoints
                   lstSelection
                   objSelection
                  )
     (if  (and (setq lstSelection (entsel "\nSelect Polyline: "))
               (setq entSelection (car lstSelection))
               (setq objSelection (vlax-ename->vla-object entSelection))
               (wcmatch (vla-get-objectname objSelection) "AcDbPolyline,AcDb2dPolyline")
               (= (vla-get-closed objSelection) :vlax-true)
          )
      (progn
       (repeat (fix (+ 0.1 (setq sngParam (vlax-curve-getendparam objSelection))))
        (setq lstPoints (cons (vlax-curve-getpointatparam objSelection sngParam) lstPoints)
              sngParam  (1- sngParam)
        )
       )
       (ssget "_WP" lstPoints)
      )
      (alert "Error: ")    
     )
    )
    (vl-load-com)
    AutomateCAD

Page 1 of 3 123 LastLast

Similar Threads

  1. Select all Objects inside a Polyline
    By avinash00002002 in forum VBA/COM Interop
    Replies: 8
    Last Post: 2015-10-21, 07:09 AM
  2. Select the last N entities created in a lisp routine.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 7
    Last Post: 2015-06-23, 04:36 PM
  3. 2015 copybase not working inside lisp routine
    By d.channon in forum AutoLISP
    Replies: 5
    Last Post: 2015-04-01, 10:40 PM
  4. Replies: 3
    Last Post: 2007-05-23, 11:44 AM
  5. Run a LISP routine from inside another
    By mpemberton in forum AutoLISP
    Replies: 5
    Last Post: 2006-06-26, 07:12 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
  •