明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1088|回复: 3

注记比高点

[复制链接]
发表于 2014-10-31 23:18 | 显示全部楼层 |阅读模式

(defun c:bgd( / pzx xzp) ;注记比高点
(vl-load-com) ;将 Visual LISP 扩展功能加载到 AutoLISP
  (regapp "SOUTH")
(setq blc (getint "\n请输入比例尺1:"))
  (setvar 'userr1 blc);设置比例尺
(setq scale (* 0.001 blc));缩放比例
;;;by Gu_xl
(defun gxl-cs:gcd (inspt height scale / pt blkdef obj);展高程点函数(inspt:插入点,heitht:高程值,scale:缩放比例,xsws:高程注记位数)
  (setvar "CMDECHO" 0)
  (command "layer" "m" "GCD" "c" "1" "" "L" "CONTINUOUS" ""  "")
  (if height
    (setq height (rtos height 2 3));3为高程注记位数
    (setq height "")
  )
  (regapp "SOUTH")
  
  ;;;检查字体 "HZ" 是否存在
  (if (not (tblobjname "style" "HZ"))
    (command "style" "HZ" "rs.shx,hztxt.shx" 0 1 0 "" "" "")
  )
  ;;;检查是否存在高程点图块定义
  (if (not (tblobjname "block" "GC200"))
    (progn
      (setq blkdef (vla-Add (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-3D-point '(0 0 0)) "GC200"))
      (setq obj
        (vla-AddPolyline
           blkdef
           (vlax-make-variant
              (vlax-safearray-fill
                 (vlax-make-safearray vlax-vbdouble (cons 0 5))
                 '(-0.2 0 0 0.2 0 0)
              )
           )
        )
      )
      (vla-SetBulge obj 0 1) (vla-SetBulge obj 1 1)
      (vla-put-Closed obj :vlax-true)
      (vla-put-ConstantWidth obj 0.4)
    )
  )
  ;;;插入块
  (entmake (list
             '(0 . "INSERT")
             '(100 . "AcDbEntity")
             '(100 . "AcDbBlockReference")
             '(66 . 1);;;属性跟随标志,1跟随,0不跟随
              (cons 2 "GC200")
              (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.2 scale))))
              (cons 40 (* 2.0 scale))
              (cons 50 0)
              (cons 41 0.8)
              (cons 51 0)
              (cons 1 height)
              (cons 7 "HZ")
              (cons 72 0)
              (cons 11 pt)
              '(100 . "AcDbAttribute")
              (cons 2 "height")
              (cons 70  0)
              (cons 74 2)
           )
   )
   ;;;结束标志
   (entmake '((0 . "SEQEND")))
   (princ)
)



(setq pzx (nth 3 (assoc 10(entget (car (entsel ))))))
(setq xzp (nth 3 (assoc 10(entget (car (entsel ))))))

(gxl-cs:gcd (getpoint) (- pzx xzp) scale)

  )
发表于 2015-4-2 18:45 | 显示全部楼层
实用,好东西谢谢
发表于 2015-6-26 07:04 | 显示全部楼层
学习了               。
发表于 2015-6-26 20:34 | 显示全部楼层
谢谢分享
试用了一下,是根据坎上下的高差计算出比高点的注记值
其实一般到分米位即可
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-26 17:45 , Processed in 0.441542 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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