skg123 发表于 2021-6-23 21:57:42

(defun C:tt ()
(setq in_point(getpoint "\n请选择标注点:"))       
        (setq high (getstring "\n输入点号"))
(gxl-cs:gcd in_point high 0.5)
        (princ)
)
;;;by Gu_xl
(defun gxl-cs:gcd (inspt height scale / pt blkdef obj);展高程点函数(inspt:插入点,heitht:高程值,scale:缩放比例,xsws:高程注记位数)
(setvar "CMDECHO" 0)
(command "layer" "m" "ZDH" "c" "3" "" "L" "CONTINUOUS" """")
(if height
    (setq height high);
    (setq height "")
)
(regapp "SOUTH")

;;;检查字体 "HZ" 是否存在
(if (not (tblobjname "style" "HZ"))
    (command "style" "HZ" "rs.shx,hztxt.shx" 0 1 0 "" "" "")
)
;;;检查是否存在高程点图块定义
(if (not (tblobjname "block" "DH200"))
    (progn
          (entmake (list '(0 . "POINT")
                                                                               '(100 . "AcDbEntity")
                                                                               '(100 . "AcDbPoint")
                                                        '(62 . 3)
                                            (cons 10 inspt)
                                    )
          )
                        (setq ENDBLK (entmake (entget (entlast))))
    )
)
;;;插入块
(entmake (list
             '(0 . "INSERT")
             '(100 . "AcDbEntity")
             '(100 . "AcDbBlockReference")
             '(66 . 1);;;属性跟随标志,1跟随,0不跟随
            (cons 2 "DH200")
            (cons 10 inspt)
            (cons 41 scale)
            (cons 42 scale)
            (cons 43 scale)
            (list -3 '("SOUTH" (1000 . "202101")))
         )
)
;;;插入属性
(entmake (list
             '(0 . "ATTRIB")
             '(100 . "AcDbEntity")
             '(100 . "AcDbText")
            (cons 10 (setq pt (polar inspt 0 (* 1.0 scale))))
            (cons 40 (* 2.0 scale))
            (cons 50 0)
            (cons 41 0.8)
            (cons 51 0)
            (cons 1 height)
            (cons 7 "HZ")
            (cons 62 1)
            (cons 72 0)
            (cons 11 pt)
            '(100 . "AcDbAttribute")
            (cons 2 "height")                                               
            (cons 700)
            (cons 74 2)
         )
   )
   
       
   ;;;结束标志
   (entmake '((0 . "SEQEND")))
   (princ)
)
页: 1 [2]
查看完整版本: 用Entmake创建属性块时碰到问题!搞测绘的有没有?请教个问题【已解决】