A lisp code not working in some of the drawings

A lisp code not working in some of the drawings

Yuvaraju.Dhananjay
Enthusiast Enthusiast
914 Views
2 Replies
Message 1 of 3

A lisp code not working in some of the drawings

Yuvaraju.Dhananjay
Enthusiast
Enthusiast

hello,

 

Can anyone tell me the whats meaning of the following code? So that I can modify the code for the different drawings.

I need each words description.

 

 


(setq
js_pole (ssget "_+.:E:S" '((0 . "INSERT") (67 . 0) (410 . "Model") (8 . "CHR_IKE_POLES") (2 . "POLE-TEL,`*U10")))
)

(setq
js_consu (ssget "_+.:E:S" '((0 . "INSERT") (67 . 0) (410 . "Model") (8 . "CHR_IKE_SUB_SYMBOLS") (2 . "SUBSCRIBER,`*U3")))
)

 

0 Likes
Accepted solutions (1)
915 Views
2 Replies
Replies (2)
Message 2 of 3

john.uhden
Mentor
Mentor
Accepted solution
(setq
js_pole ;; this is a symbol name the author makes up
;; from the next line we can see that the symbol represents a selection set
(ssget ;; This is an AutoLisp function to perform getting a user's selection of entities
"_+.:E:S" ;; This represents a selection method where :E means everything within the pickbox
;; and :S means a single pick, unlike a window or crossing
;; The following line represents the filter list to include selecting only entities that
;; meet the crieria for every item in the list
'((0 . "INSERT") (67 . 0) (410 . "Model") (8 . "CHR_IKE_POLES") (2 . "POLE-TEL,`*U10")))
)
;; Let's break down the filter list: Note each item is a dotted pair which is a special kind of list.
;; The first item in each dotted pair is the DXF code for the entity's property.
;; The second or subsequent items in the dotted pair represent the name or numeric value of the DXF code
'(
(0 . "INSERT") ;; The entity type must be an insert (block reference)
(67 . 0) ;; The entity must reside in model space (1 would be paper space)
(410 . "Model") ;; The entity must reside in the model space layout tab (redundant in this example)
(8 . "CHR_IKE_POLES") ;; The entity's layer must be "CHR_IKE_POLES"
(2 . "POLE-TEL,`*U10") ;; The insert's block name must be either "POLE-TEL" or "*U10"
;; The reason for the reverse quote "`*U10" is to specify that the following character
;; is to be treated literally and not as a wild card. Any block named "*U##" is called an anonymous block.
;; An anonymous block can have all the properties of a regular block except that if all its references
;; are deleted, it does not have to be purged after saving. The first anonymous block in a drawing AutoCAD
;; names "*U1" and the second "*U2" and so on.
;; I'm not sure if you can rename an anonymous block.
;; NOTE that filter lists can be much more complex, consisting of comparative, logical, and bitwise operators
;; and numeric values including 2D or 3D point values.
;; Using (entget) on an entity name will reveal all the DXF codes representing an entity's properties.

)

 I hope that helps to answer your question.  Of course the AutoCAD help is much more explanatory.

Look up ssget and Selection Set Filtering.

John F. Uhden

Message 3 of 3

john.uhden
Mentor
Mentor

To respond to your topic statement, " A lisp code not working in some of the drawings"

 

I presume you mean that the code doesn't successfully select any objects.  That would be because none of the objects the user tried to select matched all the filter criteria, as in object type (insert) or layer name.  It is likely that many of your drawings do not have any of those named inserts, or that your users (maybe yourself) are picking other things like circles or polylines or text, none of which satisfies the filter criteria.

 

Please read my previous post to learn about selection set methods and filtering.

John F. Uhden

0 Likes