Jump to content

Filtering out objects in ssget


jesset

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...