Jump to content

Recommended Posts

Posted

Hello everyone, 

 

I'm new here !! 

My name is Luka, English is not my native language.

I live and work in a small country in the southeast of Europe, specifically the Balkans.

I'm graduating from the Faculty of Geodesy and Geoinformatics, I've been working on the highway project for 2 years. I'm a field worker, I'm not in the office much.
I got the opportunity to be in the office as well, and since I need knowledge of Civil 3D, I would need some advice, specifically the LISP commands that my boss used, and I can't find them on the Internet.

 

In a short video I will show you exactly what I need (LISP for Offset-Distance from Centerline and elevation ).

 

If anyone has one, I would greatly appreciate it if you could send it to me.

 

Thanks in advance !

 

Posted
5 minutes ago, SLW210 said:

Welcome to CADTutor Luka!

 

I moved your thread to the AutoLISP, Visual LISP & DCL Forum

 

Are you able to contact your boss to at least find out the names of the LISPs?

 

Sorry for inconvenience. 

 

I asked him one time, and he old me that is some kind of program which his friend gave him. But he didn't wan to share this. :')

Posted

Pozdrav kolega, mladi mjerniče

You need to be much more specific in what you have in the first place and what you want as result, the video doesn't explain much. Also very good thing would be to upload the dwg.

Posted
35 minutes ago, lastknownuser said:

Pozdrav kolega, mladi mjerniče

You need to be much more specific in what you have in the first place and what you want as result, the video doesn't explain much. Also very good thing would be to upload the dwg.

 

Ooo junače, napokon malo i našeg jezika...

 

 

Essentially, I know that he took the reference to the height from the terrain, in this case on this profile H=299, and wrote "0" on the center line.
Then he just clicked on the desired place where needed, and automatically got the offset and height.

CROSSECTION_LEFT_SECTOR_1.dwg

Posted

Hi Luka,

A start with this?

(defun c:foo ( / ss dxf_line dxf_10 dxf_11 pt_ref z_ref pt)
  (princ "\nSelect axe line")
  (while (not (setq ss (ssget "_+.:E:S" '((0 . "LINE") (8 . "ENK_EKSEN"))))))
  (setq
    dxf_line (entget (ssname ss 0))
    dxf_10 (cdr (assoc 10 dxf_line))
    dxf_11 (cdr (assoc 11 dxf_line))
    pt_ref (list (car dxf_10) (min (cadr dxf_10) (cadr dxf_11)))
  )
  (princ "\nSelect comparaison plane text")
  (while (not (setq ss (ssget "_+.:E:S" '((0 . "TEXT") (8 . "ENK_KIYAS KOT"))))))
  (setq
    z_ref (atof (cdr (assoc 1 (entget (ssname ss 0)))))
  )
  (setvar "CLAYER" "kot-mes")
  (while (setq pt (getpoint "\nGive a point: "))
    (command
    "_.leader"
    pt
    "_none" pause
    "_annotation"
    (strcat
      (rtos (+ z_ref (- (cadr pt) (cadr pt_ref))) 2 3)
      "\\P"
      (rtos (- (car pt) (car pt_ref)) 2 3)
    )
    ""
    )
  )
  (prin1)
)

 

  • Like 1
Posted
14 hours ago, Tsuky said:

Hi Luka,

A start with this?

(defun c:foo ( / ss dxf_line dxf_10 dxf_11 pt_ref z_ref pt)
  (princ "\nSelect axe line")
  (while (not (setq ss (ssget "_+.:E:S" '((0 . "LINE") (8 . "ENK_EKSEN"))))))
  (setq
    dxf_line (entget (ssname ss 0))
    dxf_10 (cdr (assoc 10 dxf_line))
    dxf_11 (cdr (assoc 11 dxf_line))
    pt_ref (list (car dxf_10) (min (cadr dxf_10) (cadr dxf_11)))
  )
  (princ "\nSelect comparaison plane text")
  (while (not (setq ss (ssget "_+.:E:S" '((0 . "TEXT") (8 . "ENK_KIYAS KOT"))))))
  (setq
    z_ref (atof (cdr (assoc 1 (entget (ssname ss 0)))))
  )
  (setvar "CLAYER" "kot-mes")
  (while (setq pt (getpoint "\nGive a point: "))
    (command
    "_.leader"
    pt
    "_none" pause
    "_annotation"
    (strcat
      (rtos (+ z_ref (- (cadr pt) (cadr pt_ref))) 2 3)
      "\\P"
      (rtos (- (car pt) (car pt_ref)) 2 3)
    )
    ""
    )
  )
  (prin1)
)

 

Thank you for the effort, but can you make small video showing how this is working in AutoCad? 

 

Thank you in advance.

Posted (edited)

Welcome on-board.

 

Do you just want the labels 361.155/-28 to be created by pick point ?

 

I have something already that takes into account Datum RL and the Datum line pick 0.0 and get Y, taking into account vertical scale. So need to add X and horizontal scale.

 

Edited by BIGAL
  • Agree 1
Posted
5 hours ago, Young Surveyor said:

Thank you for the effort, but can you make small video showing how this is working in AutoCad? 

 

Thank you in advance.

My summary code should work in your example drawing, see video.

 

 

  • Like 1
Posted (edited)

Tsuky your code is doing what I suggested should have read it a bit closer, my bad, but it does not take into account Horizontal and Vertical scale. For example if we look at a cross section at 1:100 Hor 1:50 Ver for metric, if you look at the difference in the Y direction base line to new point the height needs to be;

 

(setq dwgscale (/ 1000.0 (getreal "\n enter vertical scale ")))

(setq dist (/ (- pt1 pt2) dwgscale))
(setq ht (+ dist datum))

 

 

Ps can use my Multi getvals.lsp for the Hor & Ver scale input.

Edited by BIGAL
  • Thanks 1
Posted

Here is my code using since 2023

;writen by eng motee malazi syria latakia 2023
;email motee.z222@gmail.com
(defun c:rsec (/ n e ang p0 nsecond thirdp nch)
  (setq clyr(getvar"clayer"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (defun objco ( enx )
    (cond
        ((cdr (assoc 62 enx)))
        ((abs (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 enx)))))))
    )
)
  (setq e(car(entsel"\n pick any line to get its color to apply on text")))
 (redraw e 3)
  (setq colrv (objco (entget e)))
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (if(null txth)
    (setq txth 1.25))
  (setq txthnew(getreal(strcat"\n enter text height<sc:1/1000-txth=2.5;sc:1/500-txth=1.25;sc:1/200-txth=0.5>:"
			      "<" (rtos txth 2 2)">:")))
(if txthnew(setq txth txthnew))
  (if(null scrt)
    (setq scrt 10))
  (setq scrtnew(getreal(strcat"\n enter scale ratio(vertical/horizental)"
			     "<" (rtos scrt 2 2)">:")))
(if scrtnew(setq scrt scrtnew))
  (setq factr(* 6.1 txth))	
  (if(null dh)
	(setq dh 0))
      (setq dhnew (getreal(strcat"\n enter datum level:""<"(rtos dh 2 0)">:")))
      (if dhnew(setq dh dhnew))
      (setq dh1(abs dh))
    (setq c0 0)  
  (initget 1)
  (setq p0 (getpoint "\click on intersection of center line and datum line"))
  (while
  (setq blp(getvar"blipmode"))
  (setq osmd (getvar"osmode"))
   ;(initget 1)
  (setq n (getpoint "\n choose apoint to write its elevation and chainage"))
  (setq nsecond(getpoint n"\n pick direction"))
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (if(< (cadr nsecond)(cadr n))
   (setq ang (/(* 3 pi)2))
  (setq ang (/ pi 2))
  )
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (setq nch(polar nsecond(- ang (* pi 0.5))txth))
  (setq thirdp(polar nsecond ang (* 6 txth)))
  ;;;;;;;;;;;;;;;;;;;added
 ;;;;;;;;;;;;;;;;;;;;;;;;ncreat ch at p
	     (entmakex (list '(0 . "TEXT")
                             '(100 . "AcDbEntity")
                             '(67 . 0)
                             '(8 . "p-Elevation")
                             '(100 . "AcDbText")
                             (cons 10 nsecond)
                             (cons 40 txth)
                             (cons 1 (rtos(+ dh(/(-(cadr n)(cadr p0))scrt))2 3))
                             (cons 50 ang)
                             '(41 . 1.0)
                             '(51 . 0.0)
			     (cons 62 colrv)
                             '(7 . "Standard")
                             '(71 . 0)
                             '(72 . 0)
                             ;(cons 11 (list 0.0 0.0 (last p)))
                             '(100 . "AcDbText")
                             '(73 . 0)
                       )
             )
      ;;;;;;;;;;;;mmmmmmmmmmmmmmmmmmmmmmmm
	     (entmakex (list '(0 . "TEXT")
                             '(100 . "AcDbEntity")
                             '(67 . 0)
                             '(8 . "chainagep")
                             '(100 . "AcDbText")
                             (cons 10 nch)
                             (cons 40 txth)
                             (cons 1 (strcat"c:"(rtos (+(-(car n)(car p0))c0) 2 2)))
                             (cons 50 ang)
                             '(41 . 1.0)
                             '(51 . 0.0)
			     (cons 62 7)
                             '(7 . "Standard")
                             '(71 . 0)
                             '(72 . 0)
                             ;(cons 11 (list 0.0 0.0 (last p)))
                             '(100 . "AcDbText")
                             '(73 . 0)
                       )
             )
      ;;;;;;;;;;;;mmmmmmmmmmmmmmmmmmmmmmmm
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(command "layer" "m" "dashi" "c" "8" "" "L" "continuous" "" "LW" "0.18" "" "")
(command"layer" "s" "dashi" "")

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (command"_pline" n nsecond thirdp"")
  (setvar"clayer"clyr)
  
  
  )) 

 

  • Like 1
Posted
3 hours ago, BIGAL said:

@Young Surveyor has left the building 😁


 Don't worry, I'm in the shadows reading and writing down what you say. 
😂
 

And yes, Thanks guys for 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.

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