Jump to content

Recommended Posts

Posted

Hello guys!

I am trying to get the distance from one point to another, then add it to the given reference as part of a text in the drawing. (The text format is "Ref. 364.80", for example).

I have searched over the other topics and this is what I found:

and

 

 

Also, my drawings are all scaled 1:100, so the distance must be divided by 10 before adding the reference cote.

 

Here is the screenshot:

bFRWSO7.png

 

Thank you!

Posted

This is what you want it is metric.

 

;Calculates level of a point in cross or long sections
; BY alanh 2014


(setvar "cmdecho" 0)

(princ "\n To run just type SRL")

;;-------------------=={ Parse Numbers }==--------------------;;`
;;                                                            ;;
;;  Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  s - String to process                                     ;;
;;------------------------------------------------------------;;
;;  Returns:  List of numerical values found in string.       ;;
;;------------------------------------------------------------;;

(defun LM:ParseNumbers ( s )
  (
    (lambda ( l )
      (read
        (strcat "("
          (vl-list->string
            (mapcar
              (function
                (lambda ( a b c )
                  (if
                    (or
                      (< 47 b 58)
                      (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
                      (and (= 46 b) (< 47 a 58) (< 47 c 58))
                    )
                    b 32
                  )
                )
              )
              (cons nil l) l (append (cdr l) (list nil))
            )
          )
          ")"
        )
      )
    )
    (vl-string->list s)
  )
)


(defun c:SRL ()
(setq olddimzin (getvar "dimzin"))
(setvar "dimzin" 0)
(if (= dwgscale nil)
(setq dwgscale (/ 1000.0 (getreal "\n enter vertical scale ")))
)
;(setq datum (getreal "\n Enter datum level "))
(setq datum (car (LM:ParseNumbers (cdr (assoc 1 (entget (car (entsel "\nPick datum text"))))))))



(setq test 1)
(setq pt1 (cadr (getpoint "\npick datum")))
(while (= test 1)

(setq pt2 (cadr (getpoint "\npick point")))

(setq dist (/(abs (- pt1 pt2)) dwgscale))

      (setq en1 (car (entsel "\nSelect text number:" )))
      (if (/= en1 nil)
        (progn
        (setq tent (entget en1))
        (setq a (+ dist datum))
        (setq a (rtos a 2 3))
        (setq el (subst (cons 1 a) (assoc 1 tent) tent))
        (entmod el)
	  );progn
       (princ "\nplease pick again"); else
     );if
); while t

(setq el nil
 en nil
a nil
en1 nil
test nil)

(setvar "cmdecho" 1)
(setvar "dimzin" olddimzin)
(princ)
)	;ends main defun
  

 

  • Like 1
  • 3 weeks later...
Posted

Look at the code and make a new function, you know the datum XY and RL 133.0 you know the scale so the distance is add to datum the difference * scale etc, if you enter a chainage can work out a X offset point from say 0.0 line. You have the Y value so draw circle etc. 

 

Have a think about the select sequence,

datum point

datum rl text

0.0 line maybe use as datum point

Need Hor and Ver scales.

 

Have a go a good learning exercise the Surface rl.lsp has all the code you need. Make a copy of it and start there. 

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