PDA

View Full Version : [help] lisp newbie. nil message...


francesco panzeri
01-17-2005, 11:04 AM
Hi! i've written a little lisp to understand my level but it doesn't work
and i'm not able to understand why.
My lisp draw a circle of 1000units diameter from the insert point of any
block called "blok".
Is anybody out there able to help me?

Thnk a lot

Franz



(defun c:cc ()
;;;;;;;;;;;;;;;;;;;;;;;;;fa un cerchio di 10 un intorno al p di ins dei
blocchi
(command "_UNDO" "_BE"
"expert" "5")
(setq
act_os (getvar "OSMODE")
act_la (getvar "CLAYER")
)
(command

"_VIEW" "_S" "START"
"-LAYER" "S" "0" ""
"OSMODE" "0" "_ucs" "w")
(princ "\nSeleziona oggetti: ")
(setq my_sel (ssget)
m_s_l (sslength my_sel)
count 0
van_blk (ssadd)
)
(setq act_ent (ssname my_sel count)
)
(if (and
(= "INSERT"
(cdr (assoc 0 (setq act_list (entget act_ent))))
)
(= "BLOK"
(cdr (assoc 2 act_list))
)
)
(setq van_blk (ssadd act_ent van_blk)
count (1+ count)
)
)
(setq
v_b_l (sslength van_blk)
count_b 0
)

(while (< count v_b_l)
(setq
tr_obj (ssname van_blk count)
act_ent tr_obj
count_b (1+ count_b)
p_ins (cdr (assoc 10 (entget tr_obj)))
)
)

(command

"_circle" p_ins "" 1000 "")
(command "_ucs"
"_P"
"_UNDO"
"_END"
)
(command "_VIEW" "_R" "START"
"OSMODE" "act_os"
"CLAYER" "act_la"
)

)

Tom Berger
01-17-2005, 11:32 AM
Am Mon, 17 Jan 2005 20:04:13 +0100 schrieb francesco panzeri:
Hi! i've written a little lisp to understand my level but it doesn't work and i'm not able to understand why. My lisp draw a circle of 1000units diameter from the insert point of any block called "blok". Is anybody out there able to help me?

;; help function to translate a pickset to a list of entities:
(defun ss_s2e (sset / eset counter)
(setq counter 0)
(if (= 'PICKSET (type sset))
(repeat (sslength sset)
(setq eset (cons (cdr (assoc -1 (entget (ssname sset counter))))
eset)
counter (1+ counter)
)
)
)
eset
)

;; Now, the function

(defun c:cc ()
(if (setq sset (ss_s2e (ssget "X" '((0 . "INSERT")))))
(mapcar (function (lambda (en)
(command "._circle" (trans (cdr (assoc 10 (entget en))) 0 1) 500)
)
sset
)
(princ "\nno blocks inserted")
)
(prin1)
)

Good luck
Tom Berger

--
ArchTools: Architektur-Werkzeuge für AutoCAD (TM)
ArchDIM - Architekturbemaßung und Höhenkoten
ArchAREA - Flächenermittlung und Raumbuch nach DIN 277
Info und Demo unter http://www.archtools.de


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service