Jump to content

increase or decrease value of attdef...help


Recommended Posts

Posted

hello:

Now I find myself in another situation.

 

I have an attdef group 

I would like to be able to make a selection in a window

and that the numbering is increased or decreased by a desired amount.

maintaining the numbering format with zeros examplse (001,020,999)

example:

image.thumb.png.5ad02789efa5c61d6e2d68cc8774cf7d.png

 

 

any help you can provide, thanks.

Drawing2.dwg

Posted

Load VT , start with VT (or C:VT)

Click on one of the attdef's , you get the main dialog

Click on setup (bottom right) and change difference to 5 , click on ok to return to main dialog

Finaly click on Renum and select all attdefs , enter, done...

 

VT uses grread in a constant loop so exit with escape, cancel or spacebar that will get you in quick menu and you can escape / Quit / cancel from there.

Not all buttons will work because some are company specific like revision but for now it should get you what you need.

 

🐉

vt_main_dialog.jpg

vt_setup_dialog.jpg

VT.LSP

  • Like 2
  • Thanks 1
Posted (edited)

 

This post is like option 2 of this post. Is there an option 3 ? Will answer last question in other post. Suggest keep all in one post.

 

Give this a try does both requests.

(defun c:addval ( / lst lst2 att cnt lst3)
(setq inc (getreal "\nEnter increment + or - "))
(setq ss (ssget '((0 . "TEXT,ATTDEF"))))
(setq lst '() tnum 0 tatt 0)
(repeat (setq x (sslength ss))
 (setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x)))))
 (setq objname (vlax-get obj 'objectname))
 (if (= objname "AcDbText")
  (progn 
   (vlax-put obj 'textstring (rtos (+  (atof (vlax-get obj 'textstring)) inc) 2 0))
   (setq tnum (1+ tnum))
  )
  (progn
   (vlax-put obj 'tagstring (rtos (+  (atof (vlax-get obj 'tagstring)) inc) 2 0))
   (setq tatt (1+ tatt))
  )
 )
)
(alert (strcat (rtos tnum 2 0) " text changed \n" (rtos tatt 2 0) " tags Changed"))
(princ)
)

If you introduce more objects may need a cond rather than using IF.

Edited by BIGAL

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