Jump to content

Draw Vertical Alignment IP's


Recommended Posts

Posted (edited)

Dear all;

 

Lisp to draw (as shown in Image) in autocad data collecting from text file as shown

cad tutor.jpg

 

thanks

Siva

cad tutor1.jpg

Edited by sivapathasunderam
spelling error
Posted

You have 2 elements draw a grade line and draw a vertical curve, if a lisp existed then it would be pretty easy to do a type it in as 1st go. Reading the file is a lot more work. You would only need two functions. C:GRADE C:VC there is more that creeps into this like horizontal and vertical scale.

Screen Shot 12-08-16 at 01.00 PM.PNG

Posted
You have 2 elements draw a grade line and draw a vertical curve..

ymg3 parabola

lisps grade levels

Posted

Here's simple concept to draw vertical alignment, but please bare in mind that the ACAD Arc geometry is NOT equal to the vertical alignment parabola.

 

1. User need to draw the alignment (polyline) base on xy coordinates only ie: VIP CH =X & VIP Level=Y format "xy.csv"

2. Invoke command VC

3. Pick the VC LWPolyline

4. Prompt user input for each VIP VCL (vertical curve length)

 

Just for testing, no error handling & not for UCS etc..

(defun c:VC (/ o en g m ip vcl n c z l n)
;vertical curve example by hanhphuc 09.12.2016
 (setq o (getvar 'osmode))
 (setvar 'osmode 0)
 (if (and (setq en (car (entsel "\nPick Polyline.. ")))
   (= (cdr (assoc 0 (entget en))) "LWPOLYLINE")
   (setq l (mapcar 'cdr (vl-remove-if ''((x) (/= (car x) 10)) (entget en))))
   (>= (setq c (length l)) 3)
   ) 
   (progn (setq vcl (while (not vcl)
	       (setq n 0)
	       (repeat c
		 (if (progn (initget 7)
			    (setq a (getdist (strcat "\nEnter #" (itoa (setq n (1+ n))) " VCL: ")))
			    ) 
		   (setq vcl (cons a vcl))
		   )
		 ) 
	       ) 
	 
	 l   (vl-sort l ''((a b) (<= (car a) (car b))))
	 
	 g   (mapcar ''((x y) (/ 1. (apply '/ (mapcar ''((a b) (if (zerop(setq z(- b a)))(+ z 1e-9)z)) x y)))) l (cdr l))
	 m   (mapcar ''((a b c) (list (car a) (+ (cadr a) (* (* b 100.) (/ c 800.)))))
		     (setq ip (cdr (vl-remove (last l) l)))
		     (mapcar '- (cdr g) g)
		     vcl
		     ) 
	 ) 
   (mapcar '(lambda (a b c) (vl-cmdf "arc" a b c))
	   (mapcar ''((a b c) (list (- (car a) b) (- (cadr a) (* c b))))
		   ip
		   (mapcar ''((x) (/ x 2.)) vcl)
		   g
		   ) 
	   m
	   (mapcar ''((a b c) (list (+ (car a) b) (- (cadr a) (* (- c) b))))
		   ip
		   (mapcar ''((x) (/ x 2.)) vcl)
		   (cdr g)
		   ) 
	   ) 
   ) 
   ) 
 (if o
   (setvar 'osmode o)
   ) 
 (princ)
 ) 

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...