乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 69|回复: 0

[编程交流] 链测长度表示法

[复制链接]

2

主题

9

帖子

7

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 08:22:20 | 显示全部楼层 |阅读模式
大家好
 
不久前,我在一个lisp文件上得到了一些帮助,该文件使我能够以7+200.00的形式表示链测长度。通常,我以20m的恒定间隔表示链测长度。尽管有时我需要表示20个间隔之间的链测长度。我发现其中一些链测长度的误差为1.00,例如当链测长度应为7+235.67时,lisp文件将其作为7+236.67放置在图形上。我似乎不明白为什么。编辑的lisp文件部分如下所示:
 
  1. ;; ********** Miscellaneous Entries **********
  2. ; Alternative GROUND LEVEL, PIPE INVERT LEVEL, PIPE DEPTH AND CHAINAGE entry
  3. (defun C:GROUND ( )
  4.            (points)
  5.            (lines)
  6.            (texts)
  7. )
  8. ; Entry points for Ground Level and Pipe Invert Level
  9. (defun points ( )
  10.            (setq glp (getpoint "\nEnter Ground Level (endpoint):  ")  ; Ground Level Entry
  11.                     plp (getpoint "\nEnter Pipe Invert Level (intersection):  "))  ;Pipe Invert Level Entry
  12. )
  13. ;Vertical lines sub-routine
  14. (defun lines ( )
  15. ; ground level
  16.            (setq lingl1 (list (nth 0 glp) (nth 1 ptth1))
  17.                    lingl2 (list (nth 0 glp) (nth 1 ptgl1)))
  18.            (command "line" lingl1 lingl2 "")
  19. ; pipe invert and depth of pipe
  20.           (setq linpinv (list (nth 0 plp) (nth 1 ptgl1))
  21.                    lindep (list (nth 0 plp) (nth 1 ptdep1)))
  22.            (command "line" linpinv lindep "")
  23. ; chainage
  24.           (setq linch1 (list (nth 0 glp) (nth 1 ptdep1))
  25.                    linch2 (list (nth 0 glp) (nth 1 ptch1)))
  26.            (command "line" linch1 linch2 "")
  27. )
  28. (defun texts  ( / _AddSta)
  29. (defun _AddSta (num /)
  30. (if (>= num 1000.0)
  31.    (strcat ((lambda (s)
  32.               (substr s 1 (- (strlen s) 3))
  33.              )
  34.              (vl-string-left-trim "+0" (_AddSta (fix (/ num 1000.0))))
  35.            )
  36.            (vl-string-left-trim "0" (_AddSta (rem num 1000.0)))
  37.    )
  38.    (strcat ((lambda (s)
  39.               (while (< (strlen s) 5) (setq s (strcat s "0")))
  40.               s
  41.             )
  42.              (vl-string-translate ",." "++" (rtos (/ num 1000.0) 2 3))
  43.            )
  44.            ((lambda (s)
  45.               (if (eq s "")
  46.                 (setq s ".00")
  47.                 (while (< (strlen s) 3) (setq s (strcat s "0")))
  48.               )
  49.               s
  50.             )
  51.              (vl-string-left-trim "0" (rtos (rem num 1.0) 2 2))
  52.            )
  53.    )
  54. )
  55. )
  56. ;; Level/Chainage texts
  57. (setq glvl   (rtos (/ (cadr glp) 10) 2 2) ; Ground level
  58.        plvl   (rtos (/ (cadr plp) 10) 2 2) ; Pipe invert level
  59.        deplvl (rtos (/ (- (cadr glp) (cadr plp)) 10) 2 2) ; Depth of pipe invert
  60.        ch     (_AddSta (car glp)) ; Chainage
  61. )
  62. ;; Text co-ordinates
  63. (setq psnglvl (list (- (car glp) 0.75) (+ (cadr ptgl1) 0.5)) ; co-ordinate position for ground level text
  64.        psnplvl (list (- (car plp) 0.75) (+ (cadr ptinv1) 0.5)) ; co-ordinate position for pipe invert level text
  65.        psndep  (list (- (car plp) 0.75) (+ (cadr ptdep1) 0.5)) ; co-ordinate position for depth of pipe text
  66.        psnch   (list (- (car glp) 0.75) (+ (cadr ptch1) 0.5)) ; co-ordinate position for chainage text
  67. )
  68. ;; Labelling levels and chainages
  69. (command "text" psnglvl 5.0 90.0 glvl)
  70. (command "text" psnplvl 5.0 90.0 plvl)
  71. (command "text" psndep 5.0 90.0 deplvl)
  72. (command "text" psnch 5.0 90.0 ch)
  73. )
  74. ; ***** HGL *****
  75. (defun C:HGL ( )
  76.           (dim)
  77.           (hglslope)
  78. )
  79.             
  80. (defun hglslope ( )
  81. (setq  ar1 (getpoint "\nEnter LHS point  :")   ;User input for arrow line, ar1
  82.         ar2 (getpoint "\nEnter RHS point  :"))   ;User input for arrow line, ar2
  83. (setq xdiff (* (- (car ar2) (car ar1) ) 1)
  84.         ydiff (/ (- (cadr ar2) (cadr ar1) ) 10) )
  85. (setq grad1 (/ ydiff xdiff))
  86. (setq hglvltxt (rtos grad1 2 3) )
  87. (setq ar11 (list (car ar1) (cadr pthyd1))
  88.           ar21 (list (car ar2) (cadr pthyd1)))
  89. (setq ar1x (/ (+ (car ar1) (car ar2) ) 2)
  90.         ar1y (/(+(cadr ptgeo1) (cadr pthyd1) ) 2))
  91. (setq ar31 (list ar1x ar1y))
  92. (command "dim" "hor" ar11 ar21 ar31 hglvltxt "" "exit")
  93. (setq lin2 (list (nth 0 ar1) (nth 1 ptgeo1))
  94.                lin3 (list (nth 0 ar1) ( nth 1 pthyd1)) )
  95.        (command  "line" lin2 lin3 "" )
  96. (setq gl1 ( rtos (/ (cadr ar1) 10) 2 2) ) ; Hydraulic Gradient Level
  97.          (setq psnhgl (list (- (car ar1) 0.75) (+ (cadr pthyd1) 0.5) ) ) ; coordinate of the HGL text
  98.           (command "text" psnhgl 2.2 90.0 gl1)
  99. (setq lin2 (list (nth 0 ar2) (nth 1 ptgeo1))
  100.                lin3 (list (nth 0 ar2) ( nth 1 pthyd1)) )
  101.        (command  "line" lin2 lin3 "" )
  102. (setq gl1 ( rtos (/ (cadr ar2) 10) 2 2) ) ; Hydraulic Gradient Level
  103.          (setq psnhgl (list (- (car ar2) 0.75) (+ (cadr pthyd1) 0.5) ) ) ; coordinate of the HGL text
  104.           (command "text" psnhgl 2.2 90.0 gl1)
  105. )
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-9 08:12 , Processed in 0.328841 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表