Engineer_Yasser Posted November 20, 2023 Posted November 20, 2023 (edited) (vl-cmdf "_.-boundary" "_a" "_i" "_n" "" "" "_non" (getpoint) "") How to write ( if boundary created ) change its colour to yellow without using (entlast) ================================ Also ================================ How to check if error using (vl-catch-all-error-p (vl-catch-all-apply For This ssget (ssget "_WP" (pac Poly_Ent) (list (cons 0 "TEXT") (cons 8 "Pr_layer")))) Check if there is a text (Layer "Pr_layer") inside the closed polyline Poly_Ent because I got error many times while running the code ( bad argument type: lselsetp nil ) (defun pac (e / l v d lst) (setq lst nil) (setq d (- (setq v (/ (setq l (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))) 100.)))) (while (< (setq d (+ d v)) l) (setq lst (cons (vlax-curve-getPointAtDist e d) lst)) ) ) Edited November 21, 2023 by Engineer_Yasser Quote
Engineer_Yasser Posted November 21, 2023 Author Posted November 21, 2023 @BIGAL @Tharwat @Lee Mac ===> Please Help Quote
rlx Posted November 21, 2023 Posted November 21, 2023 what is wrong with entlast? if you don't want entlast maybe you should use a window selection (getpoint + getcorner) and after selection set & bounday (lwpoly) is created , you create a second selection set using same points from getpoint / getcorner and substract selection set 1 from selection set 2 and whatever is left should be your boundary. Lots of stuf you should be able to find on this site or with googe but why go this path when entlast is the most direct way? unless you're a female human, like my wife ... she also defies all logic but that's probably just to irritate me haha Quote
Engineer_Yasser Posted November 21, 2023 Author Posted November 21, 2023 11 minutes ago, rlx said: what is wrong with entlast? if you don't want entlast maybe you should use a window selection (getpoint + getcorner) and after selection set & bounday (lwpoly) is created , you create a second selection set using same points from getpoint / getcorner and substract selection set 1 from selection set 2 and whatever is left should be your boundary. Lots of stuf you should be able to find on this site or with googe but why go this path when entlast is the most direct way? unless you're a female human, like my wife ... she also defies all logic but that's probably just to irritate me haha Because when using (entlast) and the boundary not created .. the Autocad will deal with the previous entity not the boundary .. so i need to check if boundary created or not first same like (if (ssget) ................. if you made selection the ( if ) will continue Quote
rlx Posted November 21, 2023 Posted November 21, 2023 (edited) it's not very pretty (unlike me haha) but maybe this could work for you (defun c:t1 ( / pt cmd fn oqa ocm fp i s) (setq fn (getvar 'logfilename)) (if (findfile fn) (vl-file-delete fn)) (setq s "" pt (getpoint "\nSelect internal point for boundary : ")) (setq cmd (list "logfileon" "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "" "_redraw" "logfileoff")) (setq oqa (getvar 'qaflags) ocm (getvar 'cmdecho)) (setvar 'qaflags 2)(setvar 'cmdecho 1) (vl-catch-all-apply 'vl-cmdf cmd) (gc)(gc) (if (setq fp (open fn "r")) (while (setq i (read-line fp)) (setq s (strcat s i)) ) ) (if fp (close fp)) (if (and s (wcmatch (strcase s t) "*boundary created*")) (progn (alert "boundary created") ;;; chprop + entlast bladiebla ) (alert "computer says no") ) (setvar 'qaflags oqa)(setvar 'cmdecho ocm) (princ) ) Edited November 21, 2023 by rlx 1 Quote
Engineer_Yasser Posted November 22, 2023 Author Posted November 22, 2023 9 hours ago, rlx said: it's not very pretty (unlike me haha) but maybe this could work for you (defun c:t1 ( / pt cmd fn oqa ocm fp i s) (setq fn (getvar 'logfilename)) (if (findfile fn) (vl-file-delete fn)) (setq s "" pt (getpoint "\nSelect internal point for boundary : ")) (setq cmd (list "logfileon" "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "" "_redraw" "logfileoff")) (setq oqa (getvar 'qaflags) ocm (getvar 'cmdecho)) (setvar 'qaflags 2)(setvar 'cmdecho 1) (vl-catch-all-apply 'vl-cmdf cmd) (gc)(gc) (if (setq fp (open fn "r")) (while (setq i (read-line fp)) (setq s (strcat s i)) ) ) (if fp (close fp)) (if (and s (wcmatch (strcase s t) "*boundary created*")) (progn (alert "boundary created") ;;; chprop + entlast bladiebla ) (alert "computer says no") ) (setvar 'qaflags oqa)(setvar 'cmdecho ocm) (princ) ) Nice Work .. Thanks for help Quote
Engineer_Yasser Posted November 22, 2023 Author Posted November 22, 2023 @rlx How to check if error using (vl-catch-all-error-p (vl-catch-all-apply For This (ssget "_WP" (pac Poly_Ent) (list (cons 0 "TEXT") (cons 8 "Pr_layer")))) Check if there is a text (Layer "Pr_layer") inside the closed polyline Poly_Ent because I got error many times while running the code ( bad argument type: lselsetp nil ) Quote
rlx Posted November 22, 2023 Posted November 22, 2023 totaly untested... (cond ((not (tblsearch "layer" "Pr_layer")) (princ "\nLayer 'Pr_layer' not present")) ((vl-catch-all-error-p (setq result (vl-catch-all-apply 'ssget (list "_WP" (pac Poly_Ent) (list (cons 0 "TEXT") (cons 8 "Pr_layer")))))) (alert (strcat "Computer says no :\n" (vl-catch-all-error-message result)))) (t (princ "\nNo errors detected")) ) Quote
Engineer_Yasser Posted November 22, 2023 Author Posted November 22, 2023 27 minutes ago, rlx said: totaly untested... (cond ((not (tblsearch "layer" "Pr_layer")) (princ "\nLayer 'Pr_layer' not present")) ((vl-catch-all-error-p (setq result (vl-catch-all-apply 'ssget (list "_WP" (pac Poly_Ent) (list (cons 0 "TEXT") (cons 8 "Pr_layer")))))) (alert (strcat "Computer says no :\n" (vl-catch-all-error-message result)))) (t (princ "\nNo errors detected")) ) Not success ... all I want to (ssget (list (cons 0 "TEXT") (cons 8 "Pr_layer"))) inside selected closed polyline and if (> sslength 1) delete the selected closed polyline .. in case of error skip and continue 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.