Hsanon Posted 4 hours ago Posted 4 hours ago Hi, Is there a Lisp routine which can move all objects within a selected polyline to a layer called "exist" and all objects outside that same polyline to a layer called "site" ?? ignoring all frozen or OFF layers ?? Regards. Quote
Steven P Posted 1 hour ago Posted 1 hour ago If you want to have a go, look at Selection Sets to select everything within the polyline (see Lee Mac Selection sets page - it is rather good - ssget), window polygon or crossing polygon Do 2 selection sets - one for everything "_X" and one for Crossing Polygon, I think Lee Mac has a routine there to remove one selection set from another. This gives you 2 sets of entities to work with Loads of LISPs out there to change layers. Have a go, it is easier than you might think Quote
aridzv Posted 57 minutes ago Posted 57 minutes ago (edited) Try this: (defun c:chglyobjpl (/ acdoc p_list p_coord sset ent obj newLayerName i) (vl-load-com) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) ;;;;;;;;;;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selection-set-using-existing-polygon/td-p/11307274 ;;;;;;;;;;;calderg1000 msg-7 (setq p_list (entget (car (entsel "\nSelect the LwPolyline: ")))) (if (setq p_coord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) p_list) );;end setq p_coord );;end if condition (sssetfirst nil (setq sset (ssget "_wp" p_coord))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Select Objects In polygon;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if sset (progn (setq newLayerName "exist") ;;(getstring T "\nEnter new layer name: ")) (repeat (setq i (sslength sset)) (setq i (1- i)) (setq ent (ssname sset i)) (setq obj (vlax-ename->vla-object ent)) (vla-put-Layer obj newLayerName) );;repeat (vla-Regen acdoc acAllViewports) (sssetfirst nil nil) );;progn (princ "\nNo objects found in the drawing.") );;if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (princ) );;end defun Edited 52 minutes ago by aridzv Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.