Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

lisp for calculating vertical distance between lines 2

Status
Not open for further replies.

roberttx

Civil/Environmental
Aug 30, 2002
73
Hi,

I have to calculate the vertical distance between two lines or plines and account for ranges (0-2, 2-4, 4-6, etc). Is there a way to do this in lsp?

Thanks,

Roberttx
 
Replies continue below

Recommended for you

Does not sound too hard, but what do you mean exactly? Two horizontal lines and the distance between them in the Y direction? Are the lines parallel, vertical, horizontal?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Hi, borgunit:

These lines are not parell, are somehow horizontal. I have to calculate the difference in vertical profile for ground elevation and proposed sewer line, but both changes in slope and the calculation is depths of 0-2 feet, 2-4 feet and so on. We used to do it manually for few lines, but it's cumbersome with dozens of lines. Any pointers?

Thank you,
Roberttx
 
Doesn't the DIST command do what you want ?
it gives you the :
Distance, Angle in XY Plane, Angle from XY Plane
Delta X, Delta Y, & Delta Z
 
Here is a snippet...

(defun GetVertDist
(/ DIST END LINL PT1 PT1X PT1Y PT2Y PTA PTB PTC PTD START)
(setq PT1 (getpoint "\nSelect Point On First Line:")
PT1X (car PT1)
PT1Y (cadr PT1)
PTA (list PT1X 0.0)
PTB (list PT1X 1.0)
)
(while (not (setq LIN2 (entsel "\nSelect Second Line:"))))
(setq LINL (entget (car LIN2))
START (assoc 10 LINL)
END (assoc 11 LINL)
PTC (list (cadr START) (caddr START))
PTD (list (cadr END) (caddr END))
)
(setq PT2Y (cadr (inters PTA PTB PTC PTD nil))
DIST (rtos (abs (- PT1Y PT2Y)) 2 3)
)
(prompt (strcat "\nVertical Distance: " DIST)
)
)

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor