jesset Posted February 17, 2017 Share Posted February 17, 2017 hey guys! So i'm trying to build a lisp that will prompt the user to select some objects, filter out which ones are polylines and resize the width of the polylines. I am able to get it to iterate through the selection but I am having a hard time with getting it to filter out polylines. Any and all help is appreciated! (I have ;;; where my attempt was to figure it out on my own) (defun c:test (/) (setq a (ssget)) (setq counter 0) ;;;(setq b (ssname a counter)) (while (< counter (sslength a)) ;;;add of object is not a polyline, skip ;;;(setq blist (entget b)) ;;;(setq bname (cdr(assoc 0 (ssname b counter)))) ;;;(if (= (cdr(assoc 0 (b))) "POLYLINE") ;;;(progn (command "pedit" (ssname a counter) "width" 1 "") (setq counter (+ counter 1)) ;;;;end progn ;;;(setq counter (+ counter 1)) ;;;;end if );;end while );;end defun Quote Link to comment Share on other sites More sharing options...
jesset Posted February 17, 2017 Author Share Posted February 17, 2017 I haven't error checked my code or done the variable list at the start yet, was saving it until I've figured out this piece of the code. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 17, 2017 Share Posted February 17, 2017 I would suggest filtering at the ssget prompt so that the user is aware which objects will be processed by the program. Here are some resources to assist you: http://lee-mac.com/ssget.html http://www.afralisp.net/autolisp/tutorials/selection-sets.php http://www.afralisp.net/autolisp/tutorials/selection-set-filters.php Quote Link to comment Share on other sites More sharing options...
1958 Posted February 18, 2017 Share Posted February 18, 2017 Try this version of your program test.LSP Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 18, 2017 Share Posted February 18, 2017 An example of directly changing a pline width rather than use pedit. (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline")))) (val-put-constantwidth obj val) ; val is the width of the pline Quote Link to comment Share on other sites More sharing options...
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.