Message 1 of 8
AutoLISP help - Convert ENTGET to SSGET

Not applicable
08-12-2021
05:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Could please someone help me in converting a lisp command from entget to ssget.
This is original lisp function
(defun zso ()
(setq e (entsel "\nPokazi liniju..."))
(setq pt1 (cadr e) a (entget (car e)))
(if (and (/= pt1 nil) (or (= (cdr (assoc 0 a)) "LWPOLYLINE") (= (cdr (assoc 0 a)) "ARC")))
(zso1)
)
(if (and (/= pt1 nil) (= (cdr (assoc 0 a)) "LINE"))
(progn
(cond ((= bl "DS") (setq mro (* 0.1 fx)))
((or (= bl "GS") (= bl "OS")) (setq mro (* 2 fx)))
((or (= bl "CS") (= bl "VS")) (setq mro fx))
((= bl "BS") (setq mro (* 1.5 fx)))
((= bl "ZS") (setq mro (* 2.5 fx)))
((= bl "BGS") (setq mro (* 7.5 fx)))
)
(setq pt2 (cdr (assoc 10 a)) pt3 (cdr (assoc 11 a)))
(setq d (distance pt2 pt3))
(cond ((> d (* 2 rog)) (zso1))
((and (<= d (* 2 rog)) (>= d mro)) (zso2))
((< d mro) (prompt "\nDuzina fronta je manja od TZ"))
)
))
)
On basis of my almost zero in Autolisp knowledge I managed to change it to the below code.
(defun zsoMultiple ()
(setq sselection (ssget))
(repeat (setq e (sslength sselection))
(setq pt1 (cadr e) a (entget (car e)))
(if (and (/= pt1 nil) (or (= (cdr (assoc 0 a)) "LWPOLYLINE") (= (cdr (assoc 0 a)) "ARC")))
(zso1)
)
(if (and (/= pt1 nil) (= (cdr (assoc 0 a)) "LINE"))
(progn
(cond ((= bl "DS") (setq mro (* 0.1 fx)))
((or (= bl "GS") (= bl "OS")) (setq mro (* 2 fx)))
((or (= bl "CS") (= bl "VS")) (setq mro fx))
((= bl "BS") (setq mro (* 1.5 fx)))
((= bl "ZS") (setq mro (* 2.5 fx)))
((= bl "BGS") (setq mro (* 7.5 fx)))
)
(setq pt2 (cdr (assoc 10 a)) pt3 (cdr (assoc 11 a)))
(setq d (distance pt2 pt3))
(cond ((> d (* 2 rog)) (zso1))
((and (<= d (* 2 rog)) (>= d mro)) (zso2))
((< d mro) (prompt "\nDuzina fronta je manja od TZ"))
)
))
)
)
But this LISP is not working as expected, Could please someone help me in solving this issue.
Thanks in advance !