Can't figure out what is wrong with this LISP

Can't figure out what is wrong with this LISP

Anonymous
Not applicable
2,291 Views
22 Replies
Message 1 of 23

Can't figure out what is wrong with this LISP

Anonymous
Not applicable

hi, everyone,

I wrote a lisp myself but the lisp telling bad ssget list. how to resolve it. I was trying so much time but i can't figure out my problem. could anyone solve me?

thanks advance to everyone

hussain

 

(defun c:cl ()
(setq ss (ssget '((0 "insert"))))
(setq slen (sslength ss))
(setq index 0)
(repeat slen
(setq ab (entget (ssname ss index)))
(setq ac (cdr (assoc 10 ab)))
(setq p1 (getpoint ss))
(setq p2 (getpoint "\nenter another point: "))

(setq ang (angle p1 p2))
(command "line" p1 p2 "c" "")
(setq index (1+ index))
)
(princ)
)

 

 

0 Likes
Accepted solutions (3)
2,292 Views
22 Replies
Replies (22)
Message 21 of 23

Anonymous
Not applicable

hi beekeecz

kindly reply to me for my queries

0 Likes
Message 22 of 23

ВeekeeCZ
Consultant
Consultant
Accepted solution

Ok, but be aware that's the last one from me. Not going to be your personal programmer. 

If you find the routine helpful, consider to make the effort and learn at least some basics. That's all you need to write such a routine. And yes, neither I am a programmer.

 

(defun c:OffConnect (/ ss p1 p2 pt ag o12)
  
  (setq ss (ssget '((0 . "INSERT"))))
  (setq i -1)
  (repeat (1- (sslength ss))
    (setq i (1+ i))
    (setq p1 (trans (cdr (assoc 10 (entget (ssname ss i)))) 0 1))
    (setq p2 (trans (cdr (assoc 10 (entget (ssname ss (1+ i))))) 0 1))
    (setq ag (angle p1 p2))
    
    (if (equal (rem ag (/ pi 2)) 0. 0.1)
      (command "_.pline"
               "_none" (setq pt p1)
               "_none" (setq pt (polar pt (+ ag (/ pi 3)) 0.8))
               "_none" (polar pt ag (- (distance p1 p2) 0.8))
               "_none" p2
               "")
      (progn
        (setq p12 (list (car p1) (cadr p2))
              ag (angle p1 p12))
        (command "_.pline"
                 "_none" (setq pt p1)
                 "_none" (setq pt (polar pt (+ ag (/ pi 3)) 0.8))
                 "_none" (polar pt ag (- (distance p1 p12) (+ 0.4 (sqrt 0.48))))
                 "_none" (polar p2 (+ ag (* pi (/ -5 6.))) 0.8)
                 "_none" p2
                 ""))))
  (princ)
  )
0 Likes
Message 23 of 23

Anonymous
Not applicable

@ВeekeeCZ wrote:

Ok, but be aware that's the last one from me. Not going to be your personal programmer. 

If you find the routine helpful, consider to make the effort and learn at least some basics. That's all you need to write such a routine. And yes, neither I am a programmer.

 

(defun c:OffConnect (/ ss p1 p2 pt ag o12)
  
  (setq ss (ssget '((0 . "INSERT"))))
  (setq i -1)
  (repeat (1- (sslength ss))
    (setq i (1+ i))
    (setq p1 (trans (cdr (assoc 10 (entget (ssname ss i)))) 0 1))
    (setq p2 (trans (cdr (assoc 10 (entget (ssname ss (1+ i))))) 0 1))
    (setq ag (angle p1 p2))
    
    (if (equal (rem ag (/ pi 2)) 0. 0.1)
      (command "_.pline"
               "_none" (setq pt p1)
               "_none" (setq pt (polar pt (+ ag (/ pi 3)) 0.8))
               "_none" (polar pt ag (- (distance p1 p2) 0.8))
               "_none" p2
               "")
      (progn
        (setq p12 (list (car p1) (cadr p2))
              ag (angle p1 p12))
        (command "_.pline"
                 "_none" (setq pt p1)
                 "_none" (setq pt (polar pt (+ ag (/ pi 3)) 0.8))
                 "_none" (polar pt ag (- (distance p1 p12) (+ 0.4 (sqrt 0.48))))
                 "_none" (polar p2 (+ ag (* pi (/ -5 6.))) 0.8)
                 "_none" p2
                 ""))))
  (princ)
  )

hi beekeecz

thank you so much really. i did not take the really personal programmer you. kindly understand. don't be mind.

first, i try myself if it is not working that lisp then asking help whose help me.

i have been learning AutoLISP for 6 months. next time Insha Allah, I will try to rectify my mistake of lisp myself.

your help's so amazing.i appreciate your help  

thanks advance 

hussain

0 Likes