Here is the content of the lisp routine as the attachment on my last post
is not available to this discussion.
*******************************************************************
;;;-------------------------------------------------------------------------
--;
;;;
;;; PNT2BLK.LSP
;;;
;;; July 2001
;;;
;;;-------------------------------------------------------------------------
--;
;;;
;;; DESCRIPTION
;;;
;;; Place a block object in the location of selected point objects.
;;;
;;;-------------------------------------------------------------------------
--;
;;;*************************************************************************
;;; Function: C:TXT2BLK
;;;
;;; function to convert point objects to blocks.
;;; block must be defined in the current drawing
;;; blocks including attdefs will not address the attributes
;;; if the block references attdefs with default or constant values, these
will be populated.
;;;*************************************************************************
(defun c:pnt2blk( / ss ct len e eb bname pt attreqhold echohold)
;;;get command echo setting and store it
(setq echohold (getvar "CMDECHO"))
;;;set command echo off
(setvar "CMDECHO" 0)
;;;get attribute request setting and store it
(setq attreqhold (getvar "ATTREQ"))
;;;set attribute request off
(setvar "ATTREQ" 0)
;;;get name of block to insert
(setq bname (getstring "\nBlock name: "))
;;;check that the block is defined in the current drawing
(if (tblsearch "block" bname)
(progn
;;;prompt for point selection
(princ "\nSelect point objects:")
(setq ss (ssget))
;;;filter selection to only point objects
(if ss (ssget "p" (list (cons 0 "POINT"))))
;;;if point objects were selected
(if ss
(progn
;;;walk through point objects
(setq len (sslength ss))
(setq ct 0)
(while (< ct len)
;;;for each point
(setq e (ssname ss ct))
(setq ct (+ ct 1))
(setq eb (entget e))
;;;get insert point
(setq pt (cdr (assoc 10 eb)))
;;;insert block
(command "_insert" bname pt "" "" "")
)
)
(princ "\nNo point objects selected.")
)
)
(princ "\nInvalid, block not defined in drawing.")
)
;;;restore command echo setting to stored value
(setvar "CMDECHO" echohold)
;;;restore attribute request setting to stored value
(setvar "ATTREQ" 0)
(princ)
)
*******************************************************************
"Will Crichton" wrote in message
news:BA3FB8375FFA4A6FAA1AB93E0DD0BC17@in.WebX.maYIadrTaRb...
> Hey Pat,
>
> If you still need something to cycle throug a set of point objects and
place
> a block insert at each point, here is a lisp routine for you.
>
> Use appload to load the attached file into AutoCAD Map. Type "pnt2blk" at
> the command line, enter the name of the block and select the points to
> process.
>
> Cheers,
> Will
>
>
----------------------------------------------------------------------------
----
;;;-------------------------------------------------------------------------
--;
;;;
;;; PNT2BLK.LSP
;;;
;;; July 2001
;;;
;;;-------------------------------------------------------------------------
--;
;;;
;;; DESCRIPTION
;;;
;;; Place a block object in the location of selected point objects.
;;;
;;;-------------------------------------------------------------------------
--;
;;;*************************************************************************
;;; Function: C:TXT2BLK
;;;
;;; function to convert point objects to blocks.
;;; block must be defined in the current drawing
;;; blocks including attdefs will not address the attributes
;;; if the block references attdefs with default or constant values, these
will be populated.
;;;*************************************************************************
(defun c:pnt2blk( / ss ct len e eb bname pt attreqhold echohold)
;;;get command echo setting and store it
(setq echohold (getvar "CMDECHO"))
;;;set command echo off
(setvar "CMDECHO" 0)
;;;get attribute request setting and store it
(setq attreqhold (getvar "ATTREQ"))
;;;set attribute request off
(setvar "ATTREQ" 0)
;;;get name of block to insert
(setq bname (getstring "\nBlock name: "))
;;;check that the block is defined in the current drawing
(if (tblsearch "block" bname)
(progn
;;;prompt for point selection
(princ "\nSelect point objects:")
(setq ss (ssget))
;;;filter selection to only point objects
(if ss (ssget "p" (list (cons 0 "POINT"))))
;;;if point objects were selected
(if ss
(progn
;;;walk through point objects
(setq len (sslength ss))
(setq ct 0)
(while (< ct len)
;;;for each point
(setq e (ssname ss ct))
(setq ct (+ ct 1))
(setq eb (entget e))
;;;get insert point
(setq pt (cdr (assoc 10 eb)))
;;;insert block
(command "_insert" bname pt "" "" "")
)
)
(princ "\nNo point objects selected.")
)
)
(princ "\nInvalid, block not defined in drawing.")
)
;;;restore command echo setting to stored value
(setvar "CMDECHO" echohold)
;;;restore attribute request setting to stored value
(setvar "ATTREQ" 0)
(princ)
)