;|
1.pick point
2.block
name
3.select
point
|;
(defun
c:pt2blk (/ ss scale idx n entname edata)
(command
"undo" "begin")
(setq
old_cmdecho (getvar "cmdecho"))
(setq
old_osnap (getvar "osmode"))
(setvar
"cmdecho" 0)
(setvar
"osmode" 37) ;1+4 1=endpoint 4=center 32= intersection
(while
(setq pt (getpoint "\nPick Point : "))
(command
"_point" pt)
)
(setq
blktemp (getstring (strcat "\nBlock Name <" (cond (blk)
("Point1")) ">: "))
blk
(cond ((/= blktemp "") blktemp) (blk) ("Point1"))
);
setq
(setvar
"osmode" 0)
(if
(setq ss (ssget '((0 . "POINT"))))
(progn
(setq
idx 0)
(setq
n (sslength ss))
(repeat
n
(setq
entname (ssname ss idx))
(setq
edata (entget entname))
(entmake
(list
(cons 0 "INSERT")
(cons
2 blk)
(assoc
10 edata);;point
(cons
50 0)
)
)
(entdel
entname)
(setq
idx (1+ idx))
)
)
)
(setvar
"cmdecho" old_cmdecho)
(setvar
"osmode" old_osnap)
(command
"undo" "end")
(princ)
);end
(prompt
"\nEnter PT2BLK to start. ")
ไม่มีความคิดเห็น:
แสดงความคิดเห็น