Jump to content

Lisp for text multiply


CAD USER

Recommended Posts

multiply text... mmm , copy command? Multiply how?

 

 

Just maybe I have a routine thats does what you want : http://www.cadtutor.net/forum/showthread.php?93900-VT-atrribute-amp-text-editor-RLX

 

 

Once up and running you can click on a text and then you can use the copy option to copy the string to other text's or attributes. Even if the attributes in a block are empty you can still copy the string to them.

gr. Rlx

Link to comment
Share on other sites

DEAR RLX,

 

I DOWNLOAD LISP FROM GIVEN LINK, BUT IT'S GIVING ERROR MESSAGE,

; error: bad character

read (octal): 1

 

 

Never heard that one before? Did you rename vt.lsp to vt.vlx and then load it with (load "vt.vlx") ? Or was the download itself corrupted? I also posted the souce (lsp and dcl) in a separate thread so you can try that one too but I thought it would be better to have one file (dcl and lsp in one).

 

 

gr. Rlx

Link to comment
Share on other sites

Yes, i rename it, it's work great...

Thanks, rlx...

Thanks for sharing such a good thing.....

 

 

You're welcome , isn't that the meaning of life... sharing :-)

 

 

gr. Rlx

Link to comment
Share on other sites

Please try to provide me simple lisp routine...

 

 

well in that case you will have to be a little bit more specific in what you are looking 4 , what exactly do you mean by multiply text?

 

 

Have you ever looked at the site from Lee Mac? He has lots of examples of little and big programs , maybe what you seek is allready there.

 

 

gr. Rlx

Link to comment
Share on other sites

MathText.lsp

 

Find it here.....http://cadtips.cadalyst.com/notestext/run-calculations-numerical-text-and-mtext

 

You need to brush up on your search skills.

Link to comment
Share on other sites

No problem , save your routine as sum2 or something and make the following changes :

 

 

on line 10 change (setq sum 0.) to (setq sum 1) and in line 27 change the + sign in * , et voila...

 

 

gr.Rlx

Link to comment
Share on other sites

anybody can help me please...

 

 



(defun C:STM (/ 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 1)
 ;; 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 STM")
(princ)


  • Like 1
Link to comment
Share on other sites



(defun C:STM (/ 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 1)
 ;; 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 STM")
(princ)


 

Dear rlx , THANKS

 

THIS LISP EXACTLY THE SAME, IT'S PERFECT LISP

THANKS ONCE AGAIN....

Link to comment
Share on other sites

Dear rlx , THANKS

 

THIS LISP EXACTLY THE SAME, IT'S PERFECT LISP

THANKS ONCE AGAIN....

 

Glad 2b able 2 help :-) Actualy like this function , thinking bout building it in my VT app.

 

Gr. Rlx

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