multiple entity instertion routine

RickNichols

Usenet Archive
Joined
Jul 29, 2003
Messages
3
Reaction score
0
I am looking for a routine that will allow me to insert multiple autocad points into a drawing at block insertion points by a window method. Does that make sense? Basically I want to insert a bunch of points at the exact location a bunch of blocks were inserted, and I want to do this by selecting these insertion points globally or by a window. I figured that this routine has been done many times by others or should at least be pretty easy to create by someone who knows what they are doing. If there is anyone who can help please let me know. Thanks in advance.

Rick
 
How about somethin' like this.....

; create a point entity on the current layer
; at the insertion point of each seleted insert.
(defun c:insPts (/ ss i)
(setq ss (ssget '((0 . "INSERT"))))
(if ss
(progn
(setq i -1)
(repeat (sslength ss)
(entmake
(list
'(0 . "POINT")
(cons 8 (getvar "clayer"))
(cons 10 (cdr (assoc 10 (entget (ssname ss (setq i (1+ i))))))) ) ) ) ) ) (princ)
)

RickNichols said:
I am looking for a routine that will allow me to insert multiple autocad points into a
drawing at block insertion points by a window method. Does that make sense? Basically I want to insert a bunch of points at the exact location a bunch of blocks were inserted, and I want to do this by selecting these insertion points globally or by a window. I figured that this routine has been done many times by others or should at least be pretty easy to create by someone who knows what they are doing. If there is anyone who can help please let me know. Thanks in advance.
 
....er how about

; create a point entity on the current layer
; at the insertion point of each seleted insert.
(defun c:insPts (/ ss i)
(setq ss (ssget '((0 . "INSERT"))))
(if ss
(progn
(setq i -1)
(repeat (sslength ss)
(entmake
(list
'(0 . "POINT")
(cons 8 (getvar "clayer"))
(assoc 10 (entget (ssname ss (setq i (1+ i)))))
)
)
)
)
)
(princ)
)
 
Thanks Jason. It did just what I wanted. Thanks for sharing your lisp knowledge.

Rick
 
They operate the same, just less code.

The first one
(cons 10 (cdr (assoc 10 (entget (ssname ss (setq i (1+ i)))))))

can be simplified to
(assoc 10 (entget (ssname ss (setq i (1+ i)))))

and you are welcome.
 
hehehe....

Oh well...

(defun c:cap (/ ss c)
(setq ss (ssget "x" '((0 . "insert"))))
(setq c -1)
(while
(entmake
(list (cons 0 "POINT")
(cons 10
(cdr (assoc 10 (entget (ssname ss (setq c (1+ c))))))
)
)
)
)
(princ)
)
 

Latest threads

Back
Top