明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: 陈亚娣

[讨论] 用Entmake创建属性块时碰到问题!搞测绘的有没有?请教个问题【已解决】

[复制链接]
发表于 2021-6-23 21:57:42 | 显示全部楼层
  1. (defun C:tt ()
  2.   (setq in_point(getpoint "\n请选择标注点:"))       
  3.         (setq high (getstring "\n输入点号"))
  4.   (gxl-cs:gcd in_point high 0.5)
  5.         (princ)
  6. )
  7. ;;;by Gu_xl
  8. (defun gxl-cs:gcd (inspt height scale / pt blkdef obj);展高程点函数(inspt:插入点,heitht:高程值,scale:缩放比例,xsws:高程注记位数)
  9.   (setvar "CMDECHO" 0)
  10.   (command "layer" "m" "ZDH" "c" "3" "" "L" "CONTINUOUS" ""  "")
  11.   (if height
  12.     (setq height high);
  13.     (setq height "")
  14.   )
  15.   (regapp "SOUTH")
  16.   
  17.   ;;;检查字体 "HZ" 是否存在
  18.   (if (not (tblobjname "style" "HZ"))
  19.     (command "style" "HZ" "rs.shx,hztxt.shx" 0 1 0 "" "" "")
  20.   )
  21.   ;;;检查是否存在高程点图块定义
  22.   (if (not (tblobjname "block" "DH200"))
  23.     (progn
  24.           (entmake (list '(0 . "POINT")
  25.                                                                                  '(100 . "AcDbEntity")
  26.                                                                                  '(100 . "AcDbPoint")
  27.                                                           '(62 . 3)
  28.                                               (cons 10 inspt)
  29.                                     )
  30.           )
  31.                         (setq ENDBLK (entmake (entget (entlast))))
  32.     )
  33.   )
  34.   ;;;插入块
  35.   (entmake (list
  36.              '(0 . "INSERT")
  37.              '(100 . "AcDbEntity")
  38.              '(100 . "AcDbBlockReference")
  39.              '(66 . 1);;;属性跟随标志,1跟随,0不跟随
  40.               (cons 2 "DH200")
  41.               (cons 10 inspt)
  42.               (cons 41 scale)
  43.               (cons 42 scale)
  44.               (cons 43 scale)
  45.               (list -3 '("SOUTH" (1000 . "202101")))
  46.            )
  47.   )
  48.   ;;;插入属性
  49.   (entmake (list
  50.              '(0 . "ATTRIB")
  51.              '(100 . "AcDbEntity")
  52.              '(100 . "AcDbText")
  53.               (cons 10 (setq pt (polar inspt 0 (* 1.0 scale))))
  54.               (cons 40 (* 2.0 scale))
  55.               (cons 50 0)
  56.               (cons 41 0.8)
  57.               (cons 51 0)
  58.               (cons 1 height)
  59.               (cons 7 "HZ")
  60.               (cons 62 1)
  61.               (cons 72 0)
  62.               (cons 11 pt)
  63.               '(100 . "AcDbAttribute")
  64.               (cons 2 "height")                                                 
  65.               (cons 70  0)
  66.               (cons 74 2)
  67.            )
  68.    )
  69.    
  70.        
  71.    ;;;结束标志
  72.    (entmake '((0 . "SEQEND")))
  73.    (princ)
  74. )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-16 18:50 , Processed in 0.154765 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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