Jump to content

Recommended Posts

Posted

Hello everybody§,

Please help me correct this lisp.

(defun c:TEST (/ layername)

;; FUNCTION FILTER SELECTION OF OBJECT ON SPECIFIC LAYER BY LINE TYPE

(setq ent (car (entsel "\nSelect object to get its layer name : ")));

 

(setq layername (cdr (assoc 8 (entget ent))))

(setq layerinf (tblsearch "LAYER" l_name))

(setq layerltype (cdr (assoc 6 layerinf)))

 

(setq lay (list (cons 0 "*LINE")(cons 8 layername)(cons 6 layerltype))) ;; MAKE THE SELECTION SELECTION THEN ENTER AND OBJEST HIGHLIGHTED

(princ)

)

Posted

What do you want to achieve with that? Select an item, get his layer and after select all lines/polylines from that layer that have their linetype directly associated?

 

Meantime, please add code tags to your excerpt.

Posted

i want to selest objects on one layer filtered by linetype.

Some objests drawn by lines with "Continuous" linetype.and not by "DASHED" for example

Posted

I have made some corrections to your code:

(defun c:TEST ( / ent layername layerinf linetype lay index  )
;; FUNCTION FILTER SELECTION OF OBJECT ON SPECIFIC LAYER BY LINE TYPE
(if (setq ent (car (entsel "\nSelect object to get its layer name : ")))
 (progn
  (setq layername (cdr (assoc 8 (entget ent))))
  (setq layerinf (tblsearch "LAYER" layername))
  (setq linetype (cdr (assoc 6 layerinf)))

  ;; MAKE THE SELECTION SELECTION THEN ENTER AND OBJEST HIGHLIGHTED
  (if (setq lay (ssget "_X" (list '(0 . "*LINE") (cons 8 layername) (cons 6 linetype))))
   (progn
    (setq index 0)
    (repeat (sslength lay)
     (redraw (cdr (assoc -1 (entget (ssname lay index))))  3)
     (setq index (1+ index))
    )
   )
  )
 )
)
(princ)
)

Posted

True, simpler and more efficient! Especially when user intend to access the selection set outside his routine. I always forget about this function, maybe is time to stick it on the side of my display...

Posted

@MSasu,

 

Consider:

 

(defun c:test ( / en la )
   (if (setq en (car (entsel)))
       (progn
           (setq en (entget en)
                 la (tblsearch "LAYER" (cdr (assoc 8 en)))
           )
           (sssetfirst nil (ssget "_X" (list '(0 . "*LINE") (assoc 8 en) (assoc 6 la))))
       )
   )
   (princ)
)

Posted

Thank you not working .

select objects filtered by linetype on specific layer and keep them hightlighted to allow me make some modifications.

Posted
Thank you not working.

Have you tried the one proposed by Lee Mac?

Or may change the one changed by me considering Lee's observation.

Posted

(defun [color="red"]namedfunction[/color]( / ss_lay cnt i nm ent lt nlt)
(setq ss_lay (ssget "X" (list (cons 0 "LINE")(cons 8 "[color="red"]layer name[/color]"))))
(if ss_lay
  (progn
     (setq Cnt (sslength ss_lay))
(setq i 0)
(repeat Cnt
   (setq NM (ssname ss_lay i))
   (setq ENT (entget NM))
          (setq LT (cdr (assoc 6 ent)) NLT "Continuous")
          (while (< i cnt)
             (if (= LT NLT)
             ([color="red"]what ever you want to do with the lines[/color])
             );if
          );while
      (setq i (+ i 1))
      );repeat 
  );progn
);if
);defun

Posted
Thank you not working .

select objects filtered by linetype on specific layer and keep them hightlighted to allow me make some modifications.

 

If the wrong objects are being selected, or nothing is selected then you will need to better describe the conditions for what needs to be selected.

Posted (edited)

Hello,

 

Here again my code with more comments ,Please help me correct it.

Edited by fathihvac

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...