注册 登录
桥头堡 返回首页

zml84的个人空间 https://www.bridgehead.com.cn/?25302 [收藏] [复制] [分享] [RSS]

日志

2010-04-07桥梁通砸开标注尝试复原

热度 1已有 1261 次阅读2010-8-17 11:45 |个人分类:acad|

2010-04-07桥梁通砸开标注尝试复原.LSP ;;;功能:桥梁通炸开的标注,复原。;;;日期:zml84 于 2010-04-07(defun c:tt ( / ss i lst_hand en ent pt10 pt11 lst_jg lst_new) (if (setq ss (ssget '((0 . "line") (8 . "3")))) (progn ;;找出长度满足要求的对象 (setq i 0 lst_hand '() ) (repeat (sslength ss) (setq en (ssname ss i) ent (entget en) ) (setq pt10 (cdr (assoc 10 ent)) pt11 (cdr (assoc 11 ent)) ) (if (<= 4.9 (distance pt10 pt11) 7.1) (setq lst_hand (cons (cdr (assoc 5 ent)) lst_hand) ) ) (setq i (1+ i)) ) ;;根据句柄排序 (setq lst_hand (vl-sort lst_hand (function (lambda (e1 e2) (or (< (strlen e1) (strlen e2)) (< e1 e2) ) ) ) ) ) ;;尺寸线成对提取(原则为:句柄相邻) (setq lst_jg '()) (mapcar '(lambda (e1 e2) (if (= (- (test-test e2) (test-test e1)) 1) (setq lst_jg (cons (list e1 e2) lst_jg)) ) ) lst_hand (cdr lst_hand) ) ;;进一步找出标注文字(方法1:在尺寸线句柄向后找;方法2:在尺寸线附近找) ;;先采用方法2 (setq lst_new '()) (foreach n lst_jg (setq ent1 (entget (handent (car n))) ent2 (entget (handent (cadr n))) pt10 (cdr (assoc 10 ent1)) pt11 (cdr (assoc 11 ent2)) pt_tmp1 (polar pt11 (angle pt10 pt11) (* 1.5 (distance pt10 pt11)) ) pt_tmp2 (polar pt10 (angle pt11 pt10) (* 1.5 (distance pt11 pt10)) ) ) ;;; (command "_.line" "non" pt10 "non" pt11 "") (if (or ;;先尝试在尺寸线中间位置找 (setq ss2 (ssget "c" pt10 pt11 '((0 . "TEXT") (8 . "3"))) ) ;;如果不成功,再扩大范围 (setq ss2 (ssget "c" pt_tmp1 pt_tmp2 '((0 . "TEXT") (8 . "3")) ) ) ) ;;(if (= (sslength ss2) 1) (setq en (ssname ss2 0) ent (entget en) hand (cdr (assoc 5 ent)) lst_new (cons (list (car n) (cadr n) hand) lst_new) ) ;;) ) ) ;;重新标注 (foreach n lst_new (setq en1 (handent (car n)) ;_尺寸界线LINE en2 (handent (cadr n)) ;_尺寸界线LINE en3 (handent (caddr n)) ;_标注文字TEXT ent1 (entget en1) ent2 (entget en2) ent3 (entget en3) ) (setq pt10 (cdr (assoc 10 ent1)) pt11 (cdr (assoc 11 ent1)) pt20 (cdr (assoc 10 ent2)) str (cdr (assoc 1 ent3)) pt_tmp1 (polar pt10 (angle pt10 pt11) (* 0.5 (distance pt10 pt11)) ) ) (command "_.DIMALIGNED" "non" pt10 "non" pt20 "t" str "non" pt_tmp1) ) ) ) (princ) ) ;;;=========================================== ;;;功能:通用函数 ;;;功能:16进制转换为10进制(字符串转换为数值) (defun test-test (str / LST NUM I STR_I) (setq str (strcase str t)) (setq lst '(("0" 0) ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("a" 10) ("b" 11) ("c" 12) ("d" 13) ("e" 14) ("f" 15) ) ) (setq num 0 i 0 ) (repeat (strlen str) (setq str_i (substr str (strlen str)) str (substr str 1 (1- (strlen str))) ) (if (assoc str_i lst) (setq num (+ num (* (cadr (assoc str_i lst)) (expt 16 i)))) ) (setq i (1+ i)) ) ;;返回 num )

全部作者的其他最新日志

发表评论 评论 (1 个评论)

回复 hestiv 2011-3-10 09:43
请问楼主,这个是让桥梁通标注复原的LSP文件么??那就不客气啦。照单全收

facelist doodle 涂鸦板

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

 
 
  • QQ:56984982
  • 点击这里给我发消息
    电话:13527553862
    站务咨询群桥头堡站务咨询桥梁专业交流群:
    中国桥梁专业领袖群
    工作时间
    8:00-18:00