Jump to content

LISP for displaying surface elevation with text next to it


anuj

Recommended Posts

Hi,

 

Today only I registered myself with CT, though I used to visit CT as a non-member.

I am using LDD 2007 and after creating surface I would like to label spot elevation with arrow and some text next to it for instance;

 

from surface I got spot elevation=5215.60, but i would like to display it as 15.60FL, where FL stands for flowline similarly I would be adding text like EX, BC, HP, LP.

 

At present I do this manually which takes lot of time.

 

thanks in advance

Link to comment
Share on other sites

Hi anuj,

and welcome on board!

 

I know nothing about LDD and spots but

in the common cases this should helps

I hope:

 


;;lbn.lsp
(vl-load-com)
(defun C:LabelSpots  (/ ls numeric p p1 p2 suffix sz txt z)
 (setq	suffix (getstring T
		  "\nEnter the suffix (or press Enter to set default) <FL> : "))
 (if (eq "" suffix)
   (setq suffix "FL"))
 (while
   (setq p1 (getpoint "\nPick node point (or press Enter to Exit): "))
    (setq z	   (caddr p1)
   sz	   (rtos z 2 (getvar "lunits"))
   ls	   (vl-string->list sz)
   numeric (vl-list->string
	     (member (nth (- (vl-position 46 ls) 2) ls) ls))
   txt	   (strcat numeric suffix)
   )
    (setq p2 (getpoint p1 "\nSpecify text insertion point: "))

    (command "_.qleader"
      p1
      p2
      ""
      (rtos (* (strlen txt) (getvar "textsize")) 2 0)
      txt
      ""
      "")
    )
 (princ)
 )
(defun C:LBS ()
 (C:LabelSpots)
 )
(princ "\n\t\t***\tStart command with LabelSpots or with LBS ...\t***")
(princ)

 

~'J'~

Link to comment
Share on other sites

Thanks for the solution. I tried this and works fine when you click on object with Z elevation but it doesnot interpolate. for eg.

If I am having two contours say Z elevation=1000 & 1010 respectively

when clicked on contours it does the job perfectly....but when i clicked somewhere in between these two it says 0 elevation. What I am looking for is it should give something like 1001 depending upon the where one clicked and display it as 01.00FL

I know there is option in LDD but that displays full z elevation but i want just the last two digit upto 2 decimal like it should display 1010 as 10.00FL

Link to comment
Share on other sites

Ah, sorry, my bad

I need to rewrite it

I see now, you want to retrieve the last

two digits before comma and next two

digits after

See you

 

~'J'~

Link to comment
Share on other sites

Try the following one instead

 

;;lbn.lsp
(vl-load-com)
(defun C:LabelSpots  (/ dz ls lu lup numeric osm p1 p2 suffix sz txt z)
 (setq lu (getvar "lunits"))
(setvar "lunits" 2)
(setq lup (getvar "luprec"))
(setvar "luprec" 4)
(setq dz  (getvar "dimzin")) 
(setvar "dimzin" 
(setq osm (getvar "osmode"))
(setvar "osmode" 1)
 (setq	suffix (getstring T
		  "\nEnter the suffix (or press Enter to set default) <FL> : "))
 (if (eq "" suffix)
   (setq suffix "FL"))


 (while
   (setq p1 (getpoint "\nPick node point (or press Enter to Exit): "))
    (setq z	   (caddr p1)
   sz	   (rtos z 2 3)
   ls	   (reverse (cdr (reverse (vl-string->list sz))))
   numeric (vl-list->string
	     (member (nth (- (vl-position 46 ls) 2) ls) ls))
   txt	   (strcat numeric suffix)
   )
    (setq p2 (getpoint p1 "\nSpecify text insertion point: "))

    (command "_.qleader"
      p1
      p2
      ""
      (rtos (* (strlen txt) (getvar "textsize")) 2 0)
      txt
      "")
    )
(setvar "osmode" osm)
(setvar "lunits" lu)
(setvar "luprec" lup)
(setvar "dimzin" dz)
(princ)
 )
;;shortcut:
(defun C:LBS ()
 (C:LabelSpots)
 )
(princ "\n\t\t***\tStart command with LabelSpots or with LBS ...\t***")
(princ)

 

~'J'~

Link to comment
Share on other sites

  • 1 year later...

Hi Dears,Please help to writting a lisp for to daraw a beam elevation beam elevations.Exmaple: Beam top reinforcement addl bar lenth is L/3 and bottom L/4 of clear span.I want a lisp when i will click two point of clear span of beam. it it will divide L/3 and L/4 of total lenth....Many thanks I learned so many thingsfor CADtutor.....

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