Last active
March 21, 2018 05:29
-
-
Save joakimsk/e661df7fecf8c281632c759bfa9693ff to your computer and use it in GitHub Desktop.
Autocad 2018 - Select elements within a POLYLINE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Script courtesy of wronzky @ http://ww3.cad.de/foren/ubb/Forum54/HTML/018135.shtml | |
; Use a polyline (supposedly only LWPOLYLINE) as a selector. Will select all items inside. | |
; If you have a Region, try to EXPLODE, QSELECT lines then JOIN to form a single POLYLINE | |
; Use BOUNDARY to create a new POLYLINE from an enclosed area. | |
; Follow the command with WBLOCK to write elements to a new file. | |
; Modified by joakimsk, tested on Autocad 2018 OS X | |
(defun c:lcp ( / ) ; lcp selects all elements crossing or is inside the polyline (Crossing Polygon) | |
(sssetfirst nil (ssget "_CP" (vox-get-points (car (entsel "\nSelect 'Crossing Polygon' POLYLINE:"))))) | |
) | |
(defun c:lwp ( / ) ; lwp selects all elements fully inside the polyline (Window Polygon) | |
(sssetfirst nil (ssget "_WP" (vox-get-points (car (entsel "\nSelect 'Window Polygon' POLYLINE:"))))) | |
) | |
(defun vox-get-points (ele) ; subroutine that remove all points that are outside the polyline area | |
(mapcar 'cdr (vl-remove-if '(lambda(x) (/= (car x) 10)) (entget ele))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment