立即注册 登录
晓东CAD家园-论坛 返回首页

eachy的个人空间 http://bbs.xdcad.net/?14 [收藏] [复制] [分享] [RSS]

日志

[转贴]:MakeBlock

已有 438 次阅读2013-5-6 18:10 |个人分类:Lisp

代码:

; *** MakeBlock [Version 1.0] 4/28/95 ***
;
;Copyright 1995 Manu-Soft Computer Services
;
; ***************************************
; **** Author: Owen Wengerd ****
; **** ****
; **** Manu-Soft Computer Services ****
; **** P.O. Box 84 ****
; **** Fredericksburg, OH 44627 ****
; **** (330) 695-5903 ****
; **** Compu-Serve ID: 71324,3252 ****
; ***************************************
;
;
; This program takes selected objects, defines an anonymous block,
; then inserts the block at the original location.

(defun C:MAKEBLOCK

(/ tmp ss ip errexit mbx BLAYER)


;**************************************************************************

;Layer For Block Placement:
(setq BLAYER nil) ; "XXXX" = Place on layer XXXX
; nil = Use current layer

;**************************************************************************


(defun errexit (s)
(princ "\nError: ")
(princ s)
(restore)
)

(defun mbx ()
(setvar "CMDECHO" (car oldvar))
(setq *error* olderr)
(princ)
)

;*** Main Program ***
(setq T (not nil))
(setq olderr *error*
restore mbx
*error* errexit
)
(setq oldvar
(list
(getvar "CMDECHO")
)
)
(setvar "CMDECHO" 0)
(terpri)
(if BLAYER
(command "._LAYER"
(if (tblsearch "LAYER" BLAYER) "_S" "_M")
BLAYER
""
)
)
(if
(and
(setq ip (getpoint "Pick Insertion Point (<0,0,0>): "))
(setq ss (ssget))
)
(progn
(entmake (list
(cons '0 "BLOCK")
(cons '2 "*U")
(cons '70 1)
(cons '10 ip)
))
(setq cnt (sslength ss))
(while (>= (setq cnt (1- cnt)) 0)
(setq tmp (ssname ss cnt))
(entmake (setq el (entget tmp)))
(if (> (cdr (assoc 66 el)) 0)
(while
(/= "SEQEND"
(cdr
(assoc 0
(entmake (setq el (entget (entnext (cdr (assoc -1 el))))))
)
)
)
)
)
(entdel tmp)
)
(setq tmp (entmake (list (cons '0 "ENDBLK"))))
(entmake (list
(cons '0 "INSERT")
(cons '2 tmp)
(cons '10 ip)
))
)
)
(restore)
)

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-29 02:31 , Processed in 0.242354 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部