Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp for calculating elevation by given % of Slope ( ±) and elevated point.

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
aazam.k995
1174 Views, 16 Replies

Lisp for calculating elevation by given % of Slope ( ±) and elevated point.

Hi everyone, this is the first post I am having a hard time calculating proposed levels by given Slope(±), distance, and existing level in elevated point. if someone has a lisp for this it will save my huge time.

I am attaching a drawing as well.

Tags (1)
16 REPLIES 16
Message 2 of 17
aazam.k995
in reply to: aazam.k995

 I want to click the elevated point and then, give the slope then by the next click another elevated point to be created with the text through lisp is it possible?

Message 3 of 17
Sea-Haven
in reply to: aazam.k995

Did you google there are many slope lisps out there should be on that matches what you want.

 

new point grade distance lisp autocad

Message 4 of 17
aazam.k995
in reply to: Sea-Haven

I TRIED BUT COULD NOT FIND YET

Message 5 of 17
_Tharwat
in reply to: aazam.k995

Why did you waste my time yesterday with your phone call, messages and email then now you are here begging for help ?

Message 6 of 17
aazam.k995
in reply to: _Tharwat

My Dear, I posted this before I call you, and I was going to make a video for you. You are judging very fastly 

Message 7 of 17
calderg1000
in reply to: aazam.k995

Regards @aazam.k995 

The formula you show us is true, as long as the distance was horizontal. If it is tilted, the formula will change. Please confirm...


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 8 of 17
Sea-Haven
in reply to: aazam.k995

A couple of roughies.

 

(defun c:GX ( / pt g pt2 dist ht)
(setq pt (cdr (assoc 10 (entget (car (entsel "\nPick a 3d point "))))))
(setq g (getreal "\nEnter grade 1: "))
(setq pt2 (getpoint pt  "\nSelect 2nd point"))
(setq dist (distance pt2 (list (car pt)(cadr pt))))
(setq ht (/ dist g))
(Command "point" (list (car pt2)(cadr pt2)(+ (caddr pt) ht)))
(princ)
)

(defun c:G% ( / pt g pt2 dist ht)
(setq pt (cdr (assoc 10 (entget (car (entsel "\nPick a 3d point "))))))
(setq g (getreal "\nEnter grade % "))
(setq pt2 (getpoint pt  "\nSelect 2nd point"))
(setq dist (distance pt2 (list (car pt)(cadr pt))))
(setq ht (* dist (/ g 100.0)))
(Command "point" (list (car pt2)(cadr pt2)(+ (caddr pt) ht)))
(princ)
)
Message 9 of 17
aazam.k995
in reply to: Sea-Haven

Thank you sir really appreciated, now it's going to save my a lot of time. 

 

I am wondering if we could have the 3d point value within the attribute text.

 

Thank you once again. 

Attribute Sample.jpg

Message 10 of 17
aazam.k995
in reply to: calderg1000

Thanks for your time to reply, below lisp by Mr.  Sea-Haven is the solution that I looking for.
Message 11 of 17
aazam.k995
in reply to: aazam.k995

Attribute for this lisp only

(defun c:G% ( / pt g pt2 dist ht)
(setq pt (cdr (assoc 10 (entget (car (entsel "\nPick a 3d point "))))))
(setq g (getreal "\nEnter grade % "))
(setq pt2 (getpoint pt "\nSelect 2nd point"))
(setq dist (distance pt2 (list (car pt)(cadr pt))))
(setq ht (* dist (/ g 100.0)))
(Command "point" (list (car pt2)(cadr pt2)(+ (caddr pt) ht)))
(princ)
)
Message 12 of 17
calderg1000
in reply to: aazam.k995

Dear @aazam.k995 

I understand that you have a Solution answer. But I have a query. Why does it require a formula? But it has no effect on the final result.
The following code does the same thing without the formula. Maybe there's something I'm missing...?

(defun c:test (/ pt)
  (setq pt (cdr (assoc 10 (entget (car (entsel "\nPick a 3d point "))))))
  (vl-cmdf "point" (getpoint pt "\nSelect 2nd point"))
)

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 13 of 17
Sea-Haven
in reply to: calderg1000

1st point has say Z=12 2nd pt has a height difference of say 3% for a distnace away from pt1 so Z=12.345

 

2nd point does not exist need to make.

Message 14 of 17
calderg1000
in reply to: Sea-Haven

Thank you @Sea-Haven  for your reply.
The calculation of the difference in height (Dv) is correct, as long as the distance (Dh) is horizontal, then if Dv=m%Dh is fulfilled. 

But if the OP agrees to work with the sloped distance. You may have your reasons.

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 15 of 17
Sea-Haven
in reply to: calderg1000

This is a common task in CIVIL design and the distance is always implied as horizontal, if a slope distance is to be used yes a different calc.

Message 16 of 17
aazam.k995
in reply to: calderg1000

I am working on a landscape project, we have an existing 1st point with a "z" value, we need to create a second point with a "z" value by given slope  & distance.

 

I am attaching CAD file for your reference. 

 

Thanks for your time.

Message 17 of 17
devitg
in reply to: aazam.k995

@aazam.k995 

As I can see you just have such values , each point is not a point, it is a block reference , with the level or TOK at LEVELS1 attribute ,  the distance between them is in millimeter , and the level in Meter . 

devitg_0-1655730715113.png

all you need is to show the  LEVELS1 at the block reference green box 

devitg_1-1655730802934.png

I put Both 3.13 and 3.51 text , as reference 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report