# Level lines -calculate height

## Recommended Posts

Nice idea GP

Here's another concept to play with:

(defun c:sample ( / a b e i l p q s v x z )
(if
(and
(setq p (getpoint "\nSpecify 1st point: "))
(setq q (getpoint "\nSpecify 2nd point: " p))
(setq s (ssget "_F" (list p q) '((0 . "LWPOLYLINE"))))
(repeat (setq i (sslength s))
(setq e (entget (ssname s (setq i (1- i))))
z (cdr (assoc 38 e))
v (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) e))
l
(append l
(vl-remove nil
(mapcar
'(lambda ( a b / x )
(if (setq x (inters p q a b))
(list (car x) (cadr x) z)
)
)
v (cdr v)
)
)
)
)
)
)
(progn
(entmake '((0 . "POLYLINE") (70 . ))
(foreach x
(vl-sort l
(function
(lambda ( a b )
(<  (distance p (list (car a) (cadr a)))
(distance p (list (car b) (cadr b)))
)
)
)
)
(entmake (list '(0 . "VERTEX") '(70 . 32) (cons 10 x)))
)
(setq p (cdr (assoc 330 (entget (entmakex '((0 . "SEQEND")))))))
(while (/= 5 (car (setq x (grread t 13 0)))))
(setq x (vlax-curve-getclosestpointtoprojection p (cadr x) '(0.0 0.0 1.0)))
(setq e
(cons -1
(entmakex
(list
'(0 . "TEXT")
'(72 . 1)
'(73 . 2)
(cons 10 x)
(cons 11 x)
(cons 40 (getvar 'textsize))
(cons 01 (rtos (last x)))
)
)
)
)
(while (= 5 (car (setq x (grread t 13 0))))
(if (setq x (vlax-curve-getclosestpointtoprojection p (cadr x) '(0.0 0.0 1.0)))
(entmod (list e (cons 11 x) (cons 1 (rtos (last x)))))
)
)
)
)
(princ)
)

Edited by Lee Mac

• Replies 33
• Created

• 12

• 11

• 3

• 3

#### Posted Images

Good code, pBe

This is my attempt for item number 2.

Thanks dude but you guys beat me for item number two.

Nice idea GP

Here's another concept to play with:

Wow! you guys been busy

Initially my thought process is the same as LM's but using undo in lieu of the grread function [X2 on GP's idea]

The idea that is still stuck in my head is generating points much like Civil 3D where the user is ask for number of interval or distance from.

Great job guys

@Least

I posted another code to work on both TEXT and ATTRIBUTES at post # 10

##### Share on other sites

pBe and Lee Mac nice try. Is it possible to have the osnap on because some times i have same specific points and i need to calculate the elevetion there.

##### Share on other sites

pBe and Lee Mac nice try. Is it possible to have the osnap on because some times i have same specific points and i need to calculate the elevetion there.

Are you meaning to say that there are existing point entities?

##### Share on other sites

Is it possible to have the osnap on because some times i have same specific points and i need to calculate the elevetion there.

Unfortunately Object Snap (and indeed, all other standard drawing aids such as Orthomode, Tracking etc.) is not available when using a grread loop to monitor user input; the posted program is more of a concept program to share an idea and would probably be impractical for commercial use due to the lack of Object Snap.

##### Share on other sites

Are you meaning to say that there are existing point entities?

I don't know if it possible to have the osnap on (the node for exale)

And something else.When i pick one point the lisp routine stops. Is possible to pick more points?

##### Share on other sites

@Least

I posted another code to work on both TEXT and ATTRIBUTES at post # 10

that works great, very useful thanks!

##### Share on other sites

...another concept to play...

...by night?

Thanks dude

pBe and Lee Mac nice try...

##### Share on other sites

...by night?

BST here (GMT+01:00) so 12:46am, but yes, can't sleep when I have an idea for a program...

##### Share on other sites

Stop munching on them popcorn and start coding

##### Share on other sites

Stop munching on them popcorn and start coding

Given the OP's gratitude I wonder if it's worth it.

##### Share on other sites

Given the OP's gratitude I wonder if it's worth it.

Indeed you're right GP_

##### Share on other sites

The word "gratitude" is not in the OP's vocabulary. Some people will take all that you offer and still not be satisfied. They'll even come back and ask for more and see nothing wrong with doing so. I'm afraid you guys are victims of your own largesse. It's a cold, cruel world out there. Brrrrrrrrrrrrr.

##### Share on other sites

nice job my friends thank you all

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.