home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
GR
/
GR505.ZIP
/
LSP.EXE
/
IMINSERT.LSP
< prev
next >
Wrap
Text File
|
1989-03-01
|
3KB
|
95 lines
; IMINSERT V 1.2 for use with INSERT MANAGER
; COPYRIGHT 1989 CADD Masters
; ALL RIGHTS RESERVED
; REVISION RECORD:
; VER 1.2 - (setvar "snapbase" (setq vc (getvar "viewctr")))
; CHANGED TO:
; (setvar "snapbase" (list (nth 0 (setq vc (getvar "viewctr"))) (nth 1 vc)))
; VIEWCTR REL 10 IS 3D
(defun c:iminsert (/ p1 err acaderr s sldcoords obj tar pt xs ys rot strpos getcoord sld blk ce snpbs snp scl vc vcx vcy pt ptx pty x y coord)
(defun err (msg)
(command "undo" 2)
(princ (strcat "\nerror:" msg "or invalid and/or null pick. Please try again."))
(setq *error* acaderr)
(prin1)
)
(defun strpos (obj tar / lobj ltar pos)
(setq lobj (strlen obj))
(setq ltar (strlen tar))
(setq pos 1)
(while (and (<= pos ltar) (/= obj (substr tar pos lobj)))
(setq pos (+ pos 1))
)
(if (> pos ltar)
(setq pos 0)
)
pos
)
(setq ce (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq acaderr *error*)
(setq *error* err)
(setq sld (strcase (getstring (strcat "\nMatrix file name: <" (getvar "dwgprefix") ">"))))
(if (/= (setq postn (strpos "." sld)) 0)
(setq sld (substr sld 1 (- postn 1)))
)
(if (and (setq b (open (strcat sld ".DAT") "r")) (setq s (open (strcat sld ".sld") "r")))
(progn
(close s)
(setq snpbs (getvar "snapbase"))
(setq snp (getvar "snapunit"))
(setq snpmd (getvar "snapmode"))
(setvar "snapunit" (list (setq scl (/ (getvar "viewsize") 11.0)) (/ (getvar "viewsize") 11.0)))
(setvar "snapbase" (list (nth 0 (setq vc (getvar "viewctr"))) (nth 1 vc)))
(setq vcx (nth 0 vc) vcy (nth 1 vc))
(setq coord (read-line b))
(while coord
(setq blk (read-line b))
(setq sldcoords (cons (list coord blk) sldcoords))
(setq coord (read-line b))
)
(close b)
(command "vslide" sld)
(command "setvar" "snapmode" 1)
(setq pt (getpoint "Choose (enter to end):"))
(while pt
(setq ptx (nth 0 pt) pty (nth 1 pt))
(setq x (/ (- ptx vcx) scl) y (/ (- pty vcy) scl))
(setq blk (nth 0 (cdr (assoc (strcat (rtos x 2 1) " " (rtos y 2 1)) sldcoords))))
(write-line blk)
(redraw)
(setvar "snapmode" 0)
(setvar "orthomode" 1)
(prompt "\nInsertion point:")
(command "insert" blk pause 1.0 1.0 0.0)
(terpri)
(prompt "\nX scale factor:")
(command "scale" "last" "" (setq p1 (getvar "lastpoint")) pause)
(setq xscl (cdr (assoc 41 (entget (entlast)))))
(terpri)
(entdel (entlast))
(setvar "cmdecho" 1)
(command "insert" blk p1 xscl pause pause)
(setvar "cmdecho" 0)
(command "vslide" sld)
(command "setvar" "snapmode" 1)
(setq pt (getpoint "Choose (return to end):"))
)
(setvar "snapmode" snpmd)
(setvar "snapunit" snp)
(setvar "snapbase" snpbs)
(redraw)
)
(prompt (strcat "File(s): " sld ".DAT and/or " sld ".SLD not found!"))
)
(setvar "cmdecho" ce)
(prin1)
)