Change multiple values by same amount

Change multiple values by same amount

Anonymous
Not applicable
558 Views
10 Replies
Message 1 of 11

Change multiple values by same amount

Anonymous
Not applicable

Good Morning,

 

I was wondering if there is a shortcut or LISP that would enable me to change multiple values by the same amount. 

The example is I want to drop a site by say 300mm therefore I want 100 values to drop by 0.3. I am trying to avoid doing this manually.

 

Thanks in advance.

0 Likes
559 Views
10 Replies
Replies (10)
Message 2 of 11

hak_vz
Advisor
Advisor

@Anonymous 

How your elevation texts are created. as a text entity or block?

Are they placed in single or multiple layers. Do you want to pick texts one by one or automatically select all text (mtext) entities in particular layer?

If you want lisp solution post your request in Visual Lisp, AutoLISP and General Customization forum.

Attach sample drawing (dwg) to help make code easier, without need for many additional questions.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 11

Anonymous
Not applicable

Morning,

 

They are on the same layer and in blocks. I would want to select the ones to change as not all will.

What is the best way going forward. I have included a dwg with the blocks in it.

 

Dan

0 Likes
Message 4 of 11

hak_vz
Advisor
Advisor

I'll make a script for your particular case. Since I'm currently at work I'll work on it during a break.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 5 of 11

Anonymous
Not applicable

Thats very kind of you. Is there somewhere I can learn to write scripts/LISPs?

0 Likes
Message 6 of 11

hak_vz
Advisor
Advisor

You can read about  autolisp and visual lisp in Autocad help, check site like AfraLisp 

and you have autolisp forum link in previous post.

I'll have to postpone my answer for later today since your level attribute values are not consistent. In some of them you have value like "102.5x" , so code will be a bit longer, and I'm flooded with work. 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 7 of 11

Anonymous
Not applicable

Ignore the ones with x, they are existing and therefore will never change. Sorry I forgot about those

0 Likes
Message 8 of 11

jrreid
Advocate
Advocate

You can use Express Tool Block ATTOUT,

Open the TXT file into Excel.

Sort the file and remove the ones with X's.

Then use a formula to subtract.

The use Express Tool Block ATTIN. 

Done.

See Attached.

 

Hope this helps.

 

JRR.

0 Likes
Message 9 of 11

hak_vz
Advisor
Advisor

@Anonymous wrote:

Ignore the ones with x, they are existing and therefore will never change. Sorry I forgot about those


Take care about this. 

 

OP has accepted solution at Visual lisp forum 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 10 of 11

john.uhden
Mentor
Mentor

Somewhere in this vast repository of donated code is my EDITNUM.lsp, for which I once charged a bundle but nowadays everyone wants the same for free.  So search and enjoy.  I think it handles most kinds of textstrings, but maybe mtext formatting will not provide desired results.  I don't remember.

John F. Uhden

0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

This is quick and dirty.

; adjust level 1 attribute block if more atts need to look at tag name
; By AlanH NOV 2021


(defun c:add2att ( / lay ss num val x)
(setq num (getreal "\nEnter change "))

(setq lay (cdr (assoc 8 (entget (car (entsel "\nPick a block for layer "))))))
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 8 lay)(cons 410 "Model"))))

(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(if (= (Vla-get-EffectiveName obj) "ACE-EL-POINT_LEVEL")
  (progn
  (foreach att (vlax-invoke  obj 'getattributes)
    (setq val (vla-get-textstring att))
    (if (or (wcmatch val "*x*")(wcmatch val "*X*" ))
    (princ "\nmiss existing")
    (progn
    (setq val (+ num (atof val)))
    (vla-put-textstring att (rtos val 2 2))
    )
   )
  )
)
)
)
(princ)
)