awnil Posted November 16, 2023 Posted November 16, 2023 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: Thank you! Quote
BIGAL Posted November 17, 2023 Posted November 17, 2023 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 1 Quote
awnil Posted November 17, 2023 Author Posted November 17, 2023 Thank you! And thank you for the scale selection. I have tested and it works very fine. Have a look. It worked perfectly with a 100 scale. Big hugs. legatura -transversale pt lsp.dwg Quote
awnil Posted December 6, 2023 Author Posted December 6, 2023 Suchlike, I would like to find a point from the reference up, with the distance I need. I attach the drawing. legatura -transversale pt lsp.dwg Quote
BIGAL Posted December 6, 2023 Posted December 6, 2023 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. Quote
Recommended Posts
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.