Jump to content

Recommended Posts

Posted

I have one drawing with above 1000 ground level. I need to add a common value with that levels . any lisp for that calculation. Please help me. I attached that sample drawing. Please help me.

Eg. 269.222+0.253

269.235 + 0.253

279.325+0.253 Etc......... I got one lisp for that but one problem, if iam using that lisp, i need to select all numbers one by one. so pls help for me adding that value at one time.............

new block.dwg

Posted

Hi my friends! :)

 

I'd like to sum numbers with comma.

e.g 320,10+320,11=640,21

 

Thank in advance

  • 10 months later...
Posted

:shock: the code is just great, Thanks a lot.

 

WJ chen from Muscat, Oman

Posted

Thanks Fixo.

 

Great Code.

 

 

WJ Chen

 

Muscat

Oman:shock::shock:

  • 3 years later...
  • 2 years later...
Posted
On 8/12/2008 at 10:53 PM, fixo said:

 

Do not agreed with you

The Earth is so small, take a look on map -

just 5-6 thousand of miles or so :)

 

Here is edited version

This will create the new text entity with

the same properties as the first selected

text has

 

 


(defun C:STX (/ cpent elist en ip newtxt pt ss sum sumtxt txt)
(princ "\n\t\t>>>  Select text to get summ >>>")
(if
;;select texts/mtexts on screen :
(setq ss (ssget '((0 . "*TEXT"))))
;; if selected then :
(progn
 ;; store the first text entity for using 'em further :
(setq cpent (ssname ss 0))
 ;; set initial sum to zero :
 (setq sum 0.)
 ;; loop trough selected texts/mtexts :
 (while
   ;; get the first text in selection :
   (setq en (ssname ss 0))
   ;; get entity list of them :
   (setq elist (entget en))
   ;; get the textstring by key 1 from entity list :
   (setq txt (cdr (assoc 1 elist)))
   ;; create output string :
   (setq sumtxt
   ;; concatenate strings :
   (strcat
     ;; convert digits to string :
     (rtos
       ;; add to summ the digital value of text :
       (setq sum (+ (atof txt) sum))
       ;; 2 is for metric units (3 for engineering) :
       2
       ;; set precision by current :
       (getvar "dimdec")))
  )
   ;; delete entity from selection set :
   (ssdel en ss)
   )
 ;; display message in the command line:
 (princ (strcat "\nSumm=" sumtxt))
 (setq pt (getpoint "\nSpecify the new text location: "))
 ;; get the insertion point of stored entity :
 (setq ip (cdr (assoc 10 (entget cpent))))
 ;; copy text entity to the new destination point :
 (command "_copy" cpent "" ip pt)
 ;; get the last created entity :
 (setq newtxt (entlast))
 ;; get entity list of them :
 (setq elist (entget newtxt))
 ;; modify entity list with new text string :
 (entmod (subst (cons 1 sumtxt)(assoc 1 elist) elist))
 ;; update changes :
 (entupd newtxt)
 )
)
(princ)
 )
(princ "\nStart command with STX...")
(princ)
 

hi , good evening or night there , i tried this lisp and it is pretty good , just please if u could help me , that would be so kind from u  ,.... i wanna delete the selected texts after being added 

thanks in advance

best regards  

 

~'J'~

 

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