Jump to content

Recommended Posts

Posted

I want Required lisp Selected Text As Chainage Format

 

Example. 100.00

Required 0+100.00

 

or See Attachment Image

sample.jpg

Posted

Good time to learn lisp rather than relying on every one else to give up their time. Anyway you can change the text using entmod or a vlisp put you also need to just check the first character if 0 use the Substr function. Here in Aus we would accept 01234.456 as a chainage.

 

Here something though to get you started.

;Adds a fixed amount to a number
(Alert "TO USE JUST TYPE A2LM")
(DEFUN c:A2LM ()

(setvar "cmdecho" 1)
(setq olddimzin (getvar "Dimzin"))
(setvar "dimzin" 0)
(setq v2 (getreal "\nEnter ht adjustment "))
(setq ss (ssget (list (cons 0 "Text"))))
(setq len (sslength ss))
(setq x 0)
(repeat len
(setq en1 (ssname ss x))
       (setq el1 (entget en1))
       (setq v1 (atof (cdr (assoc 1 el1))))
       (setq a (+ v1 v2))
       (setq b (rtos a 2 3))
       (setq el (subst (cons 1 b) (assoc 1 el1) el1))
       (entmod el)
(setq x (+ x 1))
     
) ; repeat

(setq el nil)
(setq en nil)
(setq a nil)
(setq v1 nil)
(setq ss nil)
(setvar "cmdecho" 1)
(setvar "dimzin" olddimzin)
(princ)
); END DEFUN

Posted
Good time to learn lisp rather than relying on every one else to give up their time. Anyway you can change the text using entmod or a vlisp put you also need to just check the first character if 0 use the Substr function. Here in Aus we would accept 01234.456 as a chainage.

 

Here something though to get you started.

;Adds a fixed amount to a number
(Alert "TO USE JUST TYPE A2LM")
(DEFUN c:A2LM ()

(setvar "cmdecho" 1)
(setq olddimzin (getvar "Dimzin"))
(setvar "dimzin" 0)
(setq v2 (getreal "\nEnter ht adjustment "))
(setq ss (ssget (list (cons 0 "Text"))))
(setq len (sslength ss))
(setq x 0)
(repeat len
(setq en1 (ssname ss x))
       (setq el1 (entget en1))
       (setq v1 (atof (cdr (assoc 1 el1))))
       (setq a (+ v1 v2))
       (setq b (rtos a 2 3))
       (setq el (subst (cons 1 b) (assoc 1 el1) el1))
       (entmod el)
(setq x (+ x 1))
     
) ; repeat

(setq el nil)
(setq en nil)
(setq a nil)
(setq v1 nil)
(setq ss nil)
(setvar "cmdecho" 1)
(setvar "dimzin" olddimzin)
(princ)
); END DEFUN

 

 

 

 

 

Thanks for reply, your lisp was added values in selected text. I need "+" sign value in selected text.

 

Thank you

Posted
Good time to learn lisp
the code posted was a starting point for you not an answer to the exact request.

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