- UID
- 783614
- 积分
- 1087
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2019-1-15
- 最后登录
- 1970-1-1
|
- 插件名称 : 修改图块的插入点
- 作 者 : odelywp
- 运行环境 :不限
- 发布时间 :2019-03-14
- 命令名称 :basc
- 插件介绍 :有些人做图块时不注意块的插入点,甚至插入点在图块外很远的地方. 本程序用于修改插入点到选定点处
- 备 注 : (点击图片可以放大)
插件详细内容
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 王鹏_pBZlo 于 2019-7-5 13:57 编辑
命令:BASC;源码回复可见(defun c:basc( / blk pt blk2 blk41 blk42 blk50 blk10 temposm lin sset bnum npt blkpro)
(defun point(pbase sx sy) (list (+ (car pbase) sx)(+ (cadr pbase) sy))) (defun ass (num entity / tempvalue)
(setq tempvalue (cdr (assoc num (entget entity))))
(if (and (= 62 num) (null tempvalue)) (setq tempvalue 256))
(if (and (= 6 num) (null tempvalue)) (setq tempvalue "Bylayer"))
(setq tempvalue tempvalue))
(command "undo" "be")
(setq blk(car (entsel "\n选择需调整插入点的块:")))
(command "ucs" "")
(setq pt (getpoint "\n新的插入点:"))
(setq blkpro (entget blk))
(setq blk2 (cdr (assoc 2 blkpro)))
(setq blk41 (cdr (assoc 41 blkpro)))
(setq blk42 (cdr (assoc 42 blkpro)))
(setq blk50 (cdr (assoc 50 blkpro)))
(setq blk10 (cdr (assoc 10 blkpro)))
(setq temposm (getvar "osmode"))
(setvar "osmode" 0)
(command "line" blk10 pt "")
(setq lin (entlast))
(if (/= blk50 0.0) (command "rotate" lin "" blk10 (* -180.0 (/ blk50 pi))))
(setq pt (list (/ (- (nth 0 (ass 11 lin)) (nth 0 blk10)) blk41) (/ (- (nth 1 (ass 11 lin)) (nth 1 blk10)) blk42)))
(command "erase" lin "")
(command "bedit" blk2)
(command "move" "all" "" pt (list 0 0))
(command "bclose" "")
(setq sset (ssget "x" (list (cons 0 "INSERT")(cons 2 blk2))))
(setq bnum 0)
(while (setq blk (ssname sset bnum))
(setq blk10 (ass 10 blk))
(setq npt (point blk10 (* (ass 41 blk) (nth 0 pt)) (* (ass 42 blk) (nth 1 pt))))
(command "line" blk10 npt "") (setq lin (entlast))
(if (/= (setq blk50 (ass 50 blk)) 0.0) (command "rotate" lin "" blk10 (* 180.0 (/ blk50 pi))))
(command "move" blk "" blk10 (ass 11 lin))
(command "erase" lin "")
(setq bnum (1+ bnum))
)
(setvar "osmode" temposm)
(command "undo" "e")
(princ)
)
|
-
-
-
basc.zip
1.49 KB, 下载次数: 75, 下载积分: D豆 -1 , 活跃度 1
|