SLW210 Posted December 13, 2024 Posted December 13, 2024 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the correct forum. 1 1 Quote
SLW210 Posted December 13, 2024 Posted December 13, 2024 Can you post an actual drawing? And explain what you want in more detail. Quote
pkenewell Posted December 13, 2024 Posted December 13, 2024 @Akanezuko If I'm interpreting you correctly - try this: (defun c:SelinPoly (/ es ob pts r ss) (if (and (setq es (entsel "\nSelect a polygon: ")) (= (cdr (assoc 0 (entget (car es)))) "LWPOLYLINE") ) (progn (setq ob (vlax-ename->vla-object (car es)) pts (vla-get-coordinates ob) pts (vlax-safearray->list (vlax-variant-value pts)) ) (while pts (setq r (cons (list (car pts) (cadr pts)) r) pts (cddr pts) ) ) (if (> (length r) 2) (progn (entdel (car es)) (setq ss (ssget "CP" r '((0 . "*POLYLINE")))) (entdel (car es)) (sssetfirst nil ss) ) (princ "\nSelected Polygon must be more than 2 points.") ) ) (princ "\nYou must select a Polygon.") ) (princ) ) 1 Quote
BIGAL Posted December 13, 2024 Posted December 13, 2024 Using VLAX can save a couple of lines when getting pline points. (setq r (vlax-get ob 'coordinates)) I tend to use this, I think it was a suggestion by Lee-Mac. (setq plent (entsel "\nPick rectang")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) 2 Quote
Akanezuko Posted December 14, 2024 Author Posted December 14, 2024 11 hours ago, BIGAL said: Using VLAX can save a couple of lines when getting pline points. (setq r (vlax-get ob 'coordinates)) I tend to use this, I think it was a suggestion by Lee-Mac. (setq plent (entsel "\nPick rectang")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) 18 hours ago, pkenewell said: @Akanezuko If I'm interpreting you correctly - try this: (defun c:SelinPoly (/ es ob pts r ss) (if (and (setq es (entsel "\nSelect a polygon: ")) (= (cdr (assoc 0 (entget (car es)))) "LWPOLYLINE") ) (progn (setq ob (vlax-ename->vla-object (car es)) pts (vla-get-coordinates ob) pts (vlax-safearray->list (vlax-variant-value pts)) ) (while pts (setq r (cons (list (car pts) (cadr pts)) r) pts (cddr pts) ) ) (if (> (length r) 2) (progn (entdel (car es)) (setq ss (ssget "CP" r '((0 . "*POLYLINE")))) (entdel (car es)) (sssetfirst nil ss) ) (princ "\nSelected Polygon must be more than 2 points.") ) ) (princ "\nYou must select a Polygon.") ) (princ) ) Thank you!!! 1 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.