The code below will place a block on a point, but I cannot get it to work for both "View" and "world"
Can the option be added??
Cheers
Allan
(defun c:nt2blk( / *error* echohold attreqhold KorR ss len ct e pt)
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); end if
(setvar 'attreq attreqhold)
(command "_.undo" "_end")
(setvar 'cmdecho echohold)
(princ)
); defun
(command "_.undo" "_begin")
(setq
echohold (getvar 'cmdecho)
attreqhold (getvar 'attreq)
); setq
(setvar 'cmdecho 0)
(setvar 'attreq 0)
(initget 1 "Keep Remove")
(setq KorR (getkword "\nKeep or Remove point objects [K/R]: "))
(prompt "\nSelect Block name from list, then pick OK.")
(princ)
(initdia)
(command "_.insert" (getvar 'viewctr) "_.erase" "_last" ""); establishes default Block name
(princ "\nSelect point objects:")
(setq ss (ssget '((0 . "POINT"))))
(if ss
(progn ; then
(setq len (sslength ss) ct 0)
(while (< ct len)
(setq
e (ssname ss ct)
ct (+ ct 1)
pt (cdr (assoc 10 (entget e)))
); setq
(command "_insert" "" "_none" pt "" "" "")
(if (= KorR "Remove") (command "_.erase" e "")); remove Point if requested
); while
(prompt (strcat "\nInserted " (itoa len) " Blocks on current Layer."))
); progn
(princ "\nNo point objects selected."); else
); if
(setvar 'attreq attreqhold)
(command "_.undo" "_end")
(setvar 'cmdecho echohold)
(princ)
)