# Intersections Between Lines at different Elevations

## Recommended Posts

Hi

There is a situation

what I need is a lisp routine or vba script to find the elevations between lines or polylines at the intersection points of them to better reflect my query I post an image.

I thank you in advance for the help provided.

Edited by Jaru

##### Share on other sites

ok, here is the drawing with a sample of the work that i have to do

Thanks a lot for your helpsample.dwg

##### Share on other sites

Well there is a simple answer as your trying to add a splitter island to a road design, not only would you get the levels but you can add say a kerb template, so your cross sections would reflect all the kerbs. 3d modelled roads drive along etc. Roundabouts, kerb returns and so much more.

Yes it is a commercial add on to Briscad, Autocad or Civ3D there are lots of Utube tutorials

For what you want its draping a alignment on a design surface.

Edited by BIGAL
##### Share on other sites

You can use the following simple vlisp program with your 2D drawing.  You are prompted to specify two points and their elevation then a thrid for which you want the elevation.

```(defun c:elbetween (/)
; determine the elevation of a point given two points
; and their elevations.
(setq p1 (getpoint "\nSpecify elevation point #1."))
(setq el1 (getreal "\nEnter the elevation at point #1."))
(setq p2 (getpoint "\nSpecify elevation point #2."))
(setq el2 (getreal "\nEnter the elevation at point #2."))
(setq p (getpoint "\nSpecify point for interpolation."))
(setq d (distance p1 p2))
(setq s (distance p1 p))
(setq el (+ el1 (* (/ s d) (- el2 el1))))
(setq el (rtos el))
(princ "\nInterpolated point elevation = ")
(princ el)
(princ)
)```

##### Share on other sites

I thought I posted this earlier today, pick lowest level 1st needs a swap routines for random pick hi/lo.

```(defun c:intlev ( / num txt1 txt2 c1 c2 dist1 dist2 diff ht )
(setvar "textstyle" "Punto Nivel")
(setq num (getint "\nPick how many each time eg 1 2 "))
(while (setq txt1 (atof (cdr (assoc 1 (entget (car (entsel "\nPick text 1")))))))
(setq c1 (cdr (assoc 10 (entget (car (entsel "\nPick circle 1"))))))
(setq txt2 (atof (cdr (assoc 1 (entget (car (entsel "\nPick text 2")))))))
(setq c2 (cdr (assoc 10 (entget (car (entsel "\nPick circle 2"))))))
(setq diff (- txt1 txt2))
(setq dist1 (distance c1 c2))
(repeat num
(setvar 'osmode 4)
(setq c3 (cdr (assoc 10 (entget (car (entsel "\nPick circle"))))))
(setq dist2 (distance c1 c3))
(setq ht (* (/ dist2 dist1) diff))
(if (<= 0.0 ht)
(setq ht (+ txt1 ht))
(setq ht (- txt1 ht))
)
(setvar 'osmode 0)
(command "text" (mapcar '+ c3 '(0.5 0.0 0.)) 0.0 (rtos ht 2 3) )
)
(setvar 'osmode 512)
)
(princ)
)
```

##### Share on other sites

@BIGAL  Nice and easy to use!  I think all you need to do to fix the order of selection restriction is to replace the if statement:

```(if (<= 0.0 ht)
(setq ht (+ txt1 ht))
(setq ht (- txt1 ht))
)```

with

`(setq ht (- txt1 ht))`

and you can pick the two points in any order without regard to which is lower.

##### Share on other sites

Hello good morning:

I tried the program and it is according to how I need it, since I have circles at the intersections, that those are done with a Lee lisp that locates points at those intersections and then I converted them with another lisp called P2C.vlx

Thanks a lot, for your help

## 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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
×
• Create New...