prodromosm 发表于 2022-7-6 02:00:30

Level lines -calculate height

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)
 
- selectlevel lines (polilynes with angle of inclination) and calculate the beween elevetions (photo2)
 
Thanks

prodromosm 发表于 2022-7-6 02:05:21

Can any one Help !

ReMark 发表于 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?

prodromosm 发表于 2022-7-6 02:11:29

I need a lisp to do two things
1) if i have two points with elevetion textclick the first elevetion text then the second elevetion text and when i clickbetween 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?

ReMark 发表于 2022-7-6 02:15:20

I believe the first one could be done but I don't know about the second.

pBe 发表于 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? , 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?

prodromosm 发表于 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 发表于 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.

prodromosm 发表于 2022-7-6 02:27:15

 
Here is a sample drawing
contous.dwg

pBe 发表于 2022-7-6 02:32:03

 
Here is a simple code for item number 1. Not sure it'll work as you wanted>
 

(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

(defun c:LLCH (/ dxf txt np p1 p2 nld low high zhp zlptag 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))
页: [1] 2
查看完整版本: Level lines -calculate height