Jump to content

Elevation level marker


bigmaz

Recommended Posts

Hi

 

I am looking for a lisp that you would use for a building elevation, and click each level to insert a predefined block with the building level on it. Something similar to this lisp http://www.cadlispandtips.com/2011/10/lisp-elevation-marker.html. But that lisp creates the block within the lisp, I want to be able to use my companies default block for it. Anyone got a lispo for this? :)

 

Thanks in advance

Link to comment
Share on other sites

In the said routine just comment out the part responsible for block creation and use the name of your company block for insertion. Cannot help you more since I don't see the download option on that site (it may not be compatible with my browser).

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
i need same as funcion vertical scale

 

insert block at invert level by typing

on keyboard

hi hp dewali . can you provide a drawing/image to explain?

Link to comment
Share on other sites

I think what he wants is pick a point on a drain line and get its elevation, I have some lisps that does this you pick datum first work out rl it may have text also the pick datum line and pick point it returns text value usefull when amending a line on a cross or long section. you can modify this to add block rather than text.

 

;Calculates level of a point in cross or long sections



(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

Link to comment
Share on other sites

thank you BIGAL for sharing. i think the idea is same just maybe OP needs to put in his attrib block?

By manually, if positive value i think dimordinate with prefix , my 0.02 :)

Link to comment
Share on other sites

hi

 

this is correct but. no need click point. just typing

on keyboard based on invert level.

my datum is 594, invert level is 600.23, on station 0+321 , y axis

in need to place circle or block.

Link to comment
Share on other sites

hi

 

this is correct but. no need click point. just typing

on keyboard based on invert level.

my datum is 594, invert level is 600.23, on station 0+321 , y axis

in need to place circle or block.

you should provide your block reference, otherwise we just attempting.

so this just simple other concept, just place text (which does not parse the string like Lee Mac's did)

 

Invert Level Marker by keyboard input

[color="red"][EDIT] in red[/color]

*IL:shx* *IL:user* ;global variables

(defun c:[color="red"]ILM[/color] (/ *error* v var p0 u1 u2 tmp shx f ip sz [color="red"]str[/color]); [color="red"]Invert level[/color] elevation marker
;hanhphuc 25/10/2014
(if (not(findfile (setq shx (strcat(getvar "tempprefix") "IL.shx"))))
(progn  (setq f (open (setq tmp (strcat(getvar "tempprefix") "IL.shp")) "W"))
(foreach x 
'("*1,42,IL"
"4,250,4,4,3,107,3,37,3,28,002,9,(0,0),001,9,(64,111),(-127,0),(-1,0),(64,-111),(0,0),002,9,(0,0),001,4,28,4,37,4,107,3"
"4,3,250,0")
(write-line x f))
(close f)
(command "compile" tmp)
)
); if

(if (and (not *IL:shx* ) shx)
(setq *IL:shx* (vl-cmdf "load" shx)))
 
(mapcar 'set '( v str *error*  var)
(list '( "osmode" "cmdecho" "dimzin")'("\nRef. station?" "Datum?" "Textsize?" )
'((msg) (if(not (wcmatch (strcase msg) "*CANCEL*,*EXIT*"))
     	(princ (strcat "\nError: " msg)))(princ))		   
    		(mapcar 'getvar v )))

(foreach x v (setvar x 0))
 
[color="gray"];;;  OP's quoted : " my datum is 594, invert level is 600.23, on station 0+321 "[/color] [color="gray"]so set as default value..
[/color]
(setq *IL:user* (if (vl-every 'not *IL:user*) '((0. [color="blue"]594.[/color] 1.) ([color="blue"]321. 600.23[/color])) (list (car *IL:user*) (cadr *IL:user*))))		 
(if (and (setq p0 (getpoint "\nPick reference point.."))
 (setq u1 (hp# 'getreal '(0 0 6) str (car *IL:user*)))
 ) ;_ end of and
(progn
(prompt
(vl-string-translate "?" ":"
(apply 'strcat (mapcar ''((a b )(strcat a (rtos b 2 2))) str (car *IL:user*)))))
(textpage)
(while (if (and	(setq u2 (hp# 'getreal '(0 0) '("\nInput STA?" "Invert Level?") (cadr *IL:user*)))
	(setq *IL:user* (list u1 u2))
	(setq ip (mapcar '+ p0 (mapcar '- u2 u1)))
	) ;_ end of and
 (progn
         (setq sz (caddar *IL:user*))
   (vl-cmdf "shape" "IL" ip sz 0.0)
	(entmakex (list	'(0 . "TEXT")
			(cons 1 (strcat "IL" (rtos (cadadr *IL:user*) 2 2)))
			(cons 40 sz )
			(cons 10 (polar ip (/ pi 4.) (* 1.4121 sz )))
			) ;_ end of list
		  ) ;_ end of entmakex
	) ;_ end of progn
 ) ;_ end of if
) ;_ end of while
 )
 ) ;_ end of if
 (mapcar 'setvar v var)
 (princ)
)

;; courtesy of the author's of "Inside AutoLisp"		
;; for rel. 10 published by New Riders Publications 		
;; Referenced to the concept of UREAL UKWORD,			
;;;HP# ; user prompt for numbers  by hanhphuc 2014
 (defun hp# (_f _ini _msg _def  / usr l)
 (if (and(member _f '(getreal getint getdist))
         (vl-every '(lambda (x) (= (type x) 'INT)) _ini )
  )
   (progn (setq usr (mapcar '(lambda (i a b) (initget i) ((eval _f) (strcat a " < "(rtos b 2 2) " > : ")))
		     _ini
		     _msg
		     _def
		     ) ;_ end of mapcar
	 ) ; setq
   (while usr
     (setq l (cons (if (null (car usr))
			(car _def)
			(car usr)
			) ;_ end of if
		      l
		      ) ;_ end of cons
	   usr	(cdr usr)
	   _def	(cdr _def)
	   ) ;_ end of setq
     l
     ) ;_ end of while
   (reverse l)
   ) ;_ end of progn
   ) ;_ end of if
 ) ;_ end of defun

step:

command: [color="red"]ILM[/color]
Pick reference point..    [color="red"]; [Pick point at datum in the screen][/color]
Ref. station? < 0.00 > :  [color="red"]; [ENTER][/color]
Datum? < 594.00 > :    [color="red"]; [ENTER][/color]
Textsize? < 1.00 > :   [color="red"]; [ENTER][/color]

Ref. station:0.00 | Datum:594.00 | Textsize:1.00 [color="red"] ;<--- Display last input parameters[/color]

Input STA? < 321.00 > :  120.
Invert Level? < 600.23 > : 690.50

Input STA? < 120.00 > :  [color="red"];<-- echo last input value[/color]
...
...

**repeating**

[ESC] to end

Edited by hanhphuc
rename c:ILM, variable str, code tag, comments
Link to comment
Share on other sites

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