乐筑天下

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

[编程交流] Level lines -calculate height

[复制链接]

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 02:00:30 | 显示全部楼层 |阅读模式
Hi to everyone
 
Does anyone have or know of a LISP application that
 
will making the selection of a group of level lines, it is possible to click freely among them, and the application calculates (and writes in the drawing) the height by interpolation of the two pairs of points closer to the adjacent level curves.
 
- select Pair of points (two texts) and calculate the beween elevetions (photo1)
 
- select  level lines (polilynes with angle of inclination) and calculate the beween elevetions (photo2)
 
Thanks
030036ldnclhcrriorh5oi.jpg
030038ezdfwjszfqbqsabb.jpg
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 02:05:21 | 显示全部楼层
Can any one Help !
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 02:09:23 | 显示全部楼层
You're looking for a lisp routine that will calculate and input a spot elevation based upon a random point you select that falls between two contours.  Does that accurately describe it?
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 02:11:29 | 显示全部楼层
I need a lisp to do two things
1) if i have two points with elevetion text  click the first elevetion text then the second elevetion text and when i click  between them like the (photo 1) to caclulate the elevetion and write the text
2) if i have contours (polylines ith elevetion)  to select them all and when i pick to any point writes me the correct elevetion
 
Is it possible?
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 02:15:20 | 显示全部楼层
I believe the first one could be done but I don't know about the second.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 02:18:21 | 显示全部楼层
 
I believe the same logic applies to both, for number 1) are the points elevated to correspond with the text value? are these attribute values? [bTW, i dont see any point entity on the snapshot], for number 2), yes, but whats confusing is the "select them all" part, or do you mean two at a time regardless if its adjacent to each other or not?
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 02:21:49 | 显示全部楼层
 
1) From the first (Pick the endpoints of the line)
2) I don't know what is possible (to select them all or two at a time)
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 02:24:39 | 显示全部楼层
 
There lies the problem prodromosm.
 
 
 
The first two statements pointing to the TEXT string as the source now you're saying its the Endpoints of the line?
 
To write an effective code you need the distance between two points. so can we assume if it is indeed the text entity the "point" will be the insertion point?
 
How about posting a sample drawing file to clear the confusion.
回复

使用道具 举报

107

主题

615

帖子

575

银币

中流砥柱

Rank: 25

铜币
521
发表于 2022-7-6 02:27:15 | 显示全部楼层
 
Here is a sample drawing
contous.dwg
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 02:32:03 | 显示全部楼层
 
Here is a simple code for item number 1. Not sure it'll work as you wanted>
 
  1. (defun c:LLCH (/ dxf txt np p1 p2 nld low high zhp zlp) (vl-load-com) (setq dxf (lambda (x e) (cdr (assoc x (entget e))))) (foreach itm '("High" "Low")   (while     (not(and (setq txt            (car (entsel (Strcat "\nSelect " itm " String Value")))     )     (eq (dxf 0 txt) "TEXT")     (numberp (setq zv (read (dxf 1 txt))))     (setq pt (if (zerop (dxf 72 txt))            (dxf 10 txt)(dxf 11 txt))))     )      (princ "\nInvalid selection, Try again")   )   (set (read itm) (list pt zv txt)) ) (if (and(setq p1 (list (caar low) (cadar low))      p2 (list (caar high) (cadar high)))(< (setq zlp (cadr low))   (setq zhp (cadr high)))     )   (while (setq np (getpoint "\nPoint for new Mark: "))     (setq hld        (- zhp zlp)    d1        (+ (distance p1 np)(distance p2 np))    d2        (distance p1                  (list (car np) (cadr np))        )     )     (vla-move(progn  (vla-put-textstring    (setq nstr (vla-copy (vlax-ename->vla-object (last low))))    (rtos (+ (* (/ hld d1) d2) zlp) 2 3)  )  nstr)(vlax-3d-point (car low))(vlax-3d-point np)     )   )   (princ "\n") ) (princ))
 
As for item number 2. Still doable, i still think its the same logic, say, what about upgrading to Civil 3D?
 
EDIT: For attribute or text  
  1. (defun c:LLCH (/ dxf txt np p1 p2 nld low high zhp zlp  tag typ) (vl-load-com) (setq dxf (lambda (x e) (cdr (assoc x (entget e))))) (foreach itm '("High" "Low")   (while     (not(and (setq txt            (car (nentsel (Strcat "\nSelect " itm " String Value")))     )     (setq typ (Car (member (dxf 0 txt) '("TEXT" "ATTRIB"))))     (numberp (setq zv (read (dxf 1 txt))))     (setq       pt (if (eq typ "ATTRIB")            (vlax-get (setq txt        (vla-ObjectIdToObject                                  (vla-get-ActiveDocument                                    (vlax-get-acad-object)                                  )                                  (vla-get-OwnerId                                    (setq atb (vlax-ename->vla-object                                                txt                                              )                                    )                                  )                                )                      )                      'Insertionpoint            )            (if        (zerop (dxf 72 txt))              (dxf 10 txt)              (dxf 11 txt)            )          )     ))     )      (princ "\nInvalid selection, Try again")   )   (set (read itm) (list pt zv txt)) ) (if (and(setq p1 (list (caar low) (cadar low))      p2 (list (caar high) (cadar high)))(< (setq zlp (cadr low))   (setq zhp (cadr high)))     )   (progn     (setq target     (if (and atb (setq att (eq (type (last low)) 'Vla-object)))       (last low)       (vlax-ename->vla-object (last low))     )     ) (while (setq np (getpoint "\nPoint for new Mark: "))      (setq hld        (- zhp zlp)            d1        (+ (distance p1 np) (distance p2 np))            d2        (distance p1                          (list (car np) (cadr np))                )      )      (vla-move        (progn          (setq        nstr (vla-copy target ))          (vla-put-textstring            (if        att              (progn                (setq tag (vla-get-tagstring atb))                (vl-some '(lambda (x)                            (if        (eq (vla-get-tagstring x) tag)                              x                            )                          )                         (vlax-invoke nstr 'Getattributes)                )              )              nstr            )            (rtos (+ (* (/ hld d1) d2) zlp) 2 3)          )          nstr        )        (vlax-3d-point (car low))        (vlax-3d-point np)      )    )     )   (princ "\n") ) (princ))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 21:16 , Processed in 0.938946 second(s), 75 queries .

© 2020-2025 乐筑天下

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