天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 65|回复: 0

[源码] 导线型号及档距标注

[复制链接]
  • TA的每日心情
    开心
    5 天前
  • 签到天数: 49 天

    [LV.5]常住居民I

    185

    主题

    150

    回帖

    1695

    积分

    管理员

    积分
    1695
    发表于 2024-4-8 21:47:42 | 显示全部楼层 |阅读模式
    1. (defun C:bzdj(/)
    2.        
    3.         (prompt "\n请选择多段线进行标注")
    4.         (setq dotlen (getint " \n请输入小数位数(直接跳过默认为0):"))
    5.         (setq texthigh (getreal " \n请输入字高(直接跳过默认为3):"))
    6.         (setq textcolor (getint " \n请输入颜色代码(直接跳过默认为3[绿色]):"))

    7.         (if (= nil dotlen) (setq dotlen 0))
    8.         (if (= nil texthigh) (setq texthigh 3))
    9.         (if (= nil textcolor) (setq textcolor 3))

    10.         (dxbz "m" texthigh textcolor dotlen)
    11. )

    12. (defun C:bzxh(/)
    13.        
    14.         (prompt "\n请选择多段线进行标注")
    15.         (setq linename (getstring " \n请输入导线型号(直接跳过默认为LGJ-25):"))
    16.         (setq texthigh (getreal " \n请输入字高(直接跳过默认为3):"))
    17.         (setq textcolor (getint " \n请输入颜色代码(直接跳过默认为3[绿色]):"))
    18.        
    19.         (if (= "" linename) (setq linename "LGJ-25"))
    20.         (if (= nil texthigh) (setq texthigh 3))
    21.         (if (= nil textcolor) (setq textcolor 3))

    22.         (dxbz linename texthigh textcolor 0)
    23. )


    24. (defun dxbz (text texthigh textcolor dotlen / ent lis);多段线每段线中心标注本段线长

    25.         (setq sset nil)
    26.         (while (equal sset nil)
    27.                 (setq sset (ssget (list
    28.                                                                                                 (cons 0 "LWPOLYLINE" )
    29.                                                                                                 ;(cons 62 7 );过滤条件颜色为白色
    30.                                                                                         )))
    31.         )
    32.   ;(setq FontStyle (GetFontStyle "XX-宋体"))
    33.   (setq FontStyle "XX-宋体")
    34.         (setq i -1)
    35.        
    36.         (while (setq ent (ssname sset (setq i (1+ i))))
    37.                 (mapcar '
    38.                         (lambda (x)
    39.                                 (if (= "m" text) (setq textvalue (strcat (car x) "m")) (setq textvalue linename))
    40.                                 (if (> (atof (car x)) 5.0)
    41.                                                                         (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText")
    42.                                                                          (cons 7 FontStyle)
    43.                                                                          (cons 1 textvalue)
    44.                                                                          (cons 10
    45.                                                                                  (polar (cadr x) (+ (last x) (*(if (= "m" text) -1 1) (/ pi 2))) (/ texthigh 2)))
    46.                                                                          (cons 71 (if (= "m" text) 2 8))
    47.                                                                          (cons 62 textcolor)
    48.                                                                          (cons 40 texthigh)
    49.                                                                          (cons 11 (cadr x))
    50.                                                                          (cons 50 (last x))))       
    51.                                 )
    52.                         )
    53.                         (mapcar '
    54.                                 (lambda (x)
    55.                                         (list
    56.                                                 (rtos (distance (car x) (cadr x)) 2 dotlen)
    57.                                                 (mapcar '* '(0.5 0.5) (mapcar '+ (car x) (cadr x)))
    58.                                                 (angle (car x) (cadr x))
    59.                                                 ;(- (rem (+ (angle (car x) (cadr x)) (* 0.25 pi)) pi) (* 0.25 pi))
    60.                                         ))
    61.                                 (mapcar 'list (setq lis (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget ent)))) (cdr lis))
    62.                         ))
    63.                 (princ)
    64.         )
    65. )
    复制代码

     

     

     

     

    [源码] 导线型号及档距标注
    哎...膜结构车棚,签到来了1...
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网_中国空间膜结构协会

    GMT+8, 2024-5-16 09:56 , Processed in 0.056725 second(s), 21 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表