Results 1 to 3 of 3

Thread: Autolisp Function to Determine Point Location

  1. #1
    ACAD Wish List Administration
    Join Date
    2005-06
    Posts
    1,920

    Default Autolisp Function to Determine Point Location

    Summary: An Autolisp function to determine if a point is inside a closed polyline or selection set of objects.

    Description: I wish there was an autolisp function to determine if a point is "inside" a closed polyline or selection set of objects.

    How Used: Having such a function would fill a gap in the current function list, and would eliminate ~200 lines of code (at least in my case) for lisp programs that require that test, making it more efficient.

    Feature Affinity: Lisp

    Submitted By: Tim Creary on January 16, 2008

  2. #2
    Woo! Hoo! my 1st post
    Join Date
    2006-10
    Posts
    1

    Default Re: Autolisp Function to Determine Point Location

    I have a lisp to do this.
    It's actually simple.
    Steps (in lisp or vba)
    1) Draw a line from the coordinates of the target point.
    2) project the line horizontally further than the X value of the polyline vertices.
    3) Do an inters (for lisp) or ent.IntersectWith (for vba)
    4) Count the numbers of intersection points.
    5) If count is Odd, point is inside poly, otherwise outside if even.

    This should only make you 10 to 15 lines of code.

    Efren

  3. #3
    Active Member
    Join Date
    2004-07
    Posts
    96

    Default Re: Autolisp Function to Determine Point Location

    Quote Originally Posted by acadwishlist View Post
    Summary: An Autolisp function to determine if a point is inside a closed polyline or selection set of objects.

    Description: I wish there was an autolisp function to determine if a point is "inside" a closed polyline or selection set of objects.

    This can be done by using the polylines co-ordinates as a crossing polygon or window polygon to generate the selection set.

    I've done exactly this for a routine which populates block attributes with the room number of the room they are located in. Each room has a polyline around it and the routine detects which blocks are inside the polyline.

    i.e.

    (setq ss1 (ssget "WP" (list pt1 pt2 pt3))) - where pt1 pt2 etc are the verticies taken from the polyline.

    Works a treat!
    Last edited by BrenBren; 2008-05-27 at 01:30 PM. Reason: fixed quote tags

Similar Threads

  1. Elevation Retrive? Using AutoLisp Function
    By sanrajbhar677632 in forum AutoLISP
    Replies: 3
    Last Post: 2011-11-08, 04:40 AM
  2. Replies: 2
    Last Post: 2011-02-14, 09:07 PM
  3. Autolisp function to determine point location
    By BrenBren in forum API Wish List
    Replies: 2
    Last Post: 2010-09-28, 03:45 PM
  4. AutoLISP function to change DB's values
    By truevis in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2007-11-19, 05:31 AM
  5. AutoLISP function to get values of existing dynamic block insert
    By truevis in forum Dynamic Blocks - Technical
    Replies: 0
    Last Post: 2007-11-17, 04:34 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
  •