rodrigo_sjc_sp Posted October 8, 2012 Posted October 8, 2012 How do I list it can be with a print or alert, all polylines that have not been closed within my DWG? Quote
Tharwat Posted October 8, 2012 Posted October 8, 2012 Try this and it would highlight the open polylines . (defun c:test (/ ss x sn lst l) (vl-load-com) (if (setq ss (ssget "_x" (list '(0 . "*POLYLINE") (cons 410 (getvar 'ctab))) ) ) (repeat (setq x (sslength ss)) (setq sn (ssname ss (setq x (1- x)))) (if (not (vlax-curve-isclosed sn)) (setq lst (cons sn lst)) ) ) ) (setq l (ssadd)) (sssetfirst nil (foreach x lst (ssadd x l))) (princ) ) Quote
pBe Posted October 9, 2012 Posted October 9, 2012 (defun c:hipl nil (sssetfirst nil (ssget "_X" '((0 . "*POLYLINE,SPLINE") (-4 . "<NOT")(-4 . "<OR") (70 . 1) (70 . 9)(70 . 129) (-4 . "OR>")(-4 . "NOT>") ) ) )(princ) ) Quote
BearDyugin Posted October 9, 2012 Posted October 9, 2012 If we take the code Tharvat, and assume that it is sometimes not correctly closed polylines (same start and end), here: (defun c:test (/ ss x sn lst l) (vl-load-com) (if (setq ss (ssget "_x" (list '(0 . "*POLYLINE") (cons 410 (getvar 'ctab))) ) ) (repeat (setq x (sslength ss)) (setq sn (ssname ss (setq x (1- x)))) (if (or (vlax-curve-isclosed sn) (equal (vlax-curve-getStartPoint sn) (vlax-curve-getEndPoint sn) ) ) (ssdel sn ss) ) ) ) (sssetfirst nil ss) (princ) ) Quote
pBe Posted October 9, 2012 Posted October 9, 2012 hmmmn makes me wonder what the OP is planning to do with the selected plines perhaps this: (defun c:hipl ( / p b e) (vl-load-com) (if (setq p (ssget "_X" '((0 . "*POLYLINE,SPLINE") (-4 . "<NOT")(-4 . "<OR") (70 . 1) (70 . 9)(70 . 129) (-4 . "OR>")(-4 . "NOT>") ) ) ) (repeat (setq b (sslength p)) (setq e (ssname p (setq b (1- b)))) (if (equal (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e)) (vla-put-closed (vlax-ename->vla-object e) :vlax-true) ) ) ) (princ) ) Closes plines with the same start and end point. Quote
Lee Mac Posted October 9, 2012 Posted October 9, 2012 (defun c:selectopenpolylines ( ) (sssetfirst nil (ssget "_X" '((0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&=") (70 . 1) (-4 . "NOT>")))) (princ) ) Quote
gS7 Posted October 9, 2012 Posted October 9, 2012 (Defun C:ChkPl(/ old_var plcntr pllen ssnme ent) (setq old_var(Getvar "CMDECHO")) (setvar "CMDECHO" 0) (if (setq plset(ssget "x" '((0 . "POLYLINE")))) (progn (setq plcntr 0) (setq pllen(sslength plset)) (repeat pllen (setq ssnme(ssname plset plcntr)) (setq Ent (entget ssnme)) (if (/= (cdr (assoc 70 ent)) 9) (Vl-Cmdf "CHPROP" ssnme "" "C" "1" "") ) (setq plcntr(1+ plcntr)) ) ) (princ "\nNo POLYLINES Found in Drawing!:") ) (setvar "CMDECHO" old_var) (princ) ) Happy Computing Quote
rodrigo_sjc_sp Posted October 10, 2012 Author Posted October 10, 2012 Thank you all for the help 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.