Author Topic: Why is this lisp not working with Annotative block?  (Read 1550 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1422
Why is this lisp not working with Annotative block?
« on: May 09, 2011, 10:16:12 AM »
Code: [Select]
(defun c:InsPC (/ ent blk blkang blkangD blkins blkinsX blkinsY blkinsZ
      ThisOne InsList
      pt inspt insptX insptY insptZ insblk) ;pBe
 
  (setq ent     (entget (car (entsel))))
  (setq blk     (tblobjname "block" (cdr (assoc 2 ent))))
  (setq blkang  (cdr (assoc 50 ent)))
  (setq blkangD (/ (* blkang 180.0) pi))
  (setq blkins  (cdr (assoc 10 ent)))

  (if (not (tblsearch "block" "Point-0"))
    (progn
      (command "insert" "C:/EC-Menu/Blocks/EC-Coord.dwg" '(0.0 0.0 0.0) "1" "1" "0")
      (command "erase" "last" "")
      ))
 
  (while
    (setq blk (entnext blk))
    (if (and
(eq (cdr (assoc 0 (setq ThisOne (entget blk)))) "INSERT")
(eq (cdr (assoc 2 (setq ThisOne (entget blk)))) "PileSymbol")
)
      (setq InsList (cons (list (cdr (assoc 2 ThisOne))
(cdr (assoc 10 ThisOne))) InsList))))
  (foreach pt InsList
    (progn
      (setq inspt (trans (cadr pt)1 0))
      (setq insblk (entmakex (list (cons 0 "INSERT")
  (cons 2 "Point-0")
          (cons 10 (list (+ (nth 0 (trans (cadr pt)1 0)) (nth 0 (cdr (assoc 10 ent))))
(+ (nth 1 (trans (cadr pt)1 0)) (nth 1 (cdr (assoc 10 ent))))
(+ (nth 2 (trans (cadr pt)1 0)) (nth 2 (cdr (assoc 10 ent))))
))
          (cons 41 0.25)
  (cons 42 0.25)
  (cons 43 0.25))))
      (command "._rotate" "last" "" blkins blkangd)
      )
    )
  (princ)
  )