Jump to content

(Help) Draw polyline with leader and Drawing L Sections Road From Excel with AUTOLISP


Recommended Posts

Posted

Hi there.

Plz help me. Im newbie with AUTOLISP.

I have problem about topography existing road. I want drawing centerline polyline existing road with leader point number STA and x, y coordinate (excel File), and drawing existing L sections from value z.

 

Please Help Me.

Many Thx

 

Planning TARGET PLAN.dwg

Data XYZ DATA.xls

Posted

I get this code, please correct, how to edit string to draw value z.

 

 

(defun c:poligon ()
 
;====== Input Data ! ====================
; ! STA !       X (m)     !       Y (m)     !
; !  (10)    !       (15)      !       (15)      !
;=================================================
; disimpan di C:\procad\data\*.prn

 
; ++++ INPUT FROM KEY BOARD ++++
(setq fnam1 "C:/Procad/Data/")
(setq fnam2 "*.prn")
(setq fnam3 "/procad/DFILE/CROSS/")

(setq lastLL 2
     lastRR 5
)
(setq f    (getstring
     (strcat "\nFile Input Polygon Data c:/procad/data/ < " fnam2 " > ? : ")
   )
)
(if (/= f "")
 (setq fnam2 f)
)
(setq fnam (strcat fnam1 fnam2))
(setq check (findfile fnam))
(while (= check nil)
 (prompt "\nNo File Found .....! ")
 (setq    f (getstring
       (strcat "\nFile Input Polygon Data c:/procad/data/ < " fnam2 " > ? : ")
     )
 )
 (if (/= f "")
   (setq fnam2 f)
 )
 (setq fnam (strcat fnam1 fnam2))
 (setq check (findfile fnam))
)                    ; while

; ====== OUTPUT DATA sudut poligon
(setq filout0 (getstring "\nFile Output Polygon Angle < *.txt > ? : "))
(setq filout (strcat "c:/procad/data/" filout0))
(setq foo (open filout "w"))

; ====== BACA DATA
(setq fp (open fnam "r"))
(setq file (read-line fp))
(if (= file "") (setq file nil))
(if (= file nil) (setq stop 1) (setq stop 0))
(setq file (read-line fp))

(setq patok0 (substr file 1 7))        ; STA
(setq PX0 (atof (substr file 11 15)))    ; koordinat x1
(setq PY0 (atof (substr file 26 15)))    ; koordinat y1
(setq p0 (list PX0 PY0))

(setq file (read-line fp))
(setq patok1 (substr file 1 7))        ; STA
(setq PX1 (atof (substr file 11 15)))    ; koordinat x1
(setq PY1 (atof (substr file 26 15)))    ; koordinat y1
(setq p1 (list PX1 PY1))
(command "color" 20 "-linetype" "s" "dashdot" "")
(command "pline" p0 p1 "")

;==== plot garis poligon
(while (= stop 0)
 (setq file (read-line fp))
 (setq patok2 (substr file 1 7))        ; STA
 (setq PX2 (atof (substr file 11 15)))    ; koordinat x1
 (setq PY2 (atof (substr file 26 15)))    ; koordinat y1
 (setq p2 (list PX2 PY2))
 (command "color" 20)
 (command "line" p1 p2 "")
 (command "color" 2)
 (command "point" p1)
 (command "color" 7)
 (command "text" p1 "3" "45" patok1 "")
 (setq sdtp1p0 (angle p1 p0))        ;sudut p1-p0 (radian)
 (setq sdtp1p2 (angle p1 p2))        ;sudut p1-p0 (radian)
 (setq sdt20 (- sdtp1p0 sdtp1p2))
(setq sdt20a (/ (* sdt20 180.0) pi))    ;sudut1 dalam derajad
(setq sdt20aa (* (- 360.000 sdt20a) 0.50))        ;sudut1 dalam derajad

;===== tulis data sudut di file output
(setq data (strcat patok1 "   " (rtos sdt20aa 2 3)))
(write-line data foo)

 (setq p0 p1)
 (setq p1 p2)
 (setq patok1 patok2)
 (if (= file "")
   (setq file nil)
 )
 (if (= file nil)
   (setq stop 1)
   (setq stop 0)
 )
)                    ;while

(close fp)
 (close foo)
 );defun
 

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