Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Globally subtract 1 from all numbers

  1. #1
    Member
    Join Date
    2016-01
    Posts
    43
    Login to Give a bone
    0

    Default Globally subtract 1 from all numbers

    Does someone have a routine that they'd be willing to share that will enable you to globally subtract 1 from all numbers selected.

    Basically, my whole site got dropped by a foot and I need to revise a whole bunch of elevation callouts. I'm using AutoCAD 2005.

    Any help would be much appreciated.

    Thanks

    Steve

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Quote Originally Posted by Stephen.Walz
    . . . numbers selected. . .
    text, mtext,dim or ?

    : ) Happy computing !

    kennet

  3. #3
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Hi Stephen,
    Your question not clear,what are you looking for?
    please more detail or post here a sample drawing.

    Quote Originally Posted by Stephen.Walz
    Does someone have a routine that they'd be willing to share that will enable you to globally subtract 1 from all numbers selected.

    Basically, my whole site got dropped by a foot and I need to revise a whole bunch of elevation callouts. I'm using AutoCAD 2005.

    Any help would be much appreciated.

    Thanks

    Steve

  4. #4
    Member
    Join Date
    2016-01
    Posts
    43
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Sorry for the confusion everyone...I wanted to modify mtext number values...I found this routine elsewhere.

    Thanks

    Steve



    Code:
    (defun MakeX (entname)
      (vlax-ename->vla-object entname)
    )
    
    (defun GetX (object prop)
      (vlax-get object prop)
    )
    
    (defun PutX (object prop val)
      (vlax-put object prop val)
    )
    Code:
    (defun c:AddText (/ txt1 txt2 cnt1 ent1 pec1)
    
    (command "_.undo" "_end")
    (command "_.undo" "_group")
    (vl-load-com)
    (setq txt1 (getreal "\nEnter value to increase by (if decreasing, add a minus sign before). "))
    (setq cnt1 0)
    (if txt1
      (progn
        (if (not *pec1)
          (setq *pec1 3)
        )
        (setq pec1 (getreal (strcat "\nHow many decimal places [" (itoa *pec1) "]? ")))
        (if pec1
          (setq *pec1 (fix pec1))
        )
        (setq ss (ssget '((0 . "*TEXT"))))
        (while (/= cnt1 (sslength ss))
          (setq ent1 (MakeX (ssname ss cnt1)))
          (setq txt2 (GetX ent1 'TextString))
          (MakeSureNum txt2 ent1)
          (setq cnt1 (1+ cnt1))
        )
      )
    )
    (prompt "\n  May get rounding-off if new decimal is less then existing decimal places!!")
    (command "_.undo" "_end")
    (princ)
    )
    
    ;==============
    Code:
    (defun MakeSureNum (txt3 ent1 / cnt1 cnt2 txt4 txt5 txt6 txt7)
    
    (setq cnt1 0
      cnt2 1
    )
    (if (and (>= (ascii (substr txt3 1 1)) 65) (/= (ascii (substr txt3 1 1)) 32))
      (while (>= (ascii (substr txt3 1 1)) 65)
        (if txt4
          (setq txt4 (strcat txt4 (substr txt3 1 1)))
          (setq txt4 (substr txt3 1 1))
        )
        (setq txt3 (substr txt3 2 (strlen txt3)))
      )
    )
    (while (= (substr txt3 1 1) " ")
      (setq txt4 (strcat txt4 " "))
      (setq txt3 (substr txt3 2 (strlen txt3)))
    )
    (if (< (ascii (substr txt3 1 1)) 65)
      (while (and (<= (ascii (substr txt3 1 1)) 65) (/= (ascii (substr txt3 1 1)) 0) (/= (ascii (substr txt3 1 1)) 32))
        (if txt5
          (setq txt5 (strcat txt5 (substr txt3 1 1)))
          (setq txt5 (substr txt3 1 1))
        )
        (setq txt3 (substr txt3 2 (strlen txt3)))
      )
    )
    (setq txt5 (atof txt5))
    (setq txt6 (+ txt5 txt1))
    (setq txt7
      (if txt4
        (strcat txt4 (rtos txt6 2 *pec1) txt3)
        (strcat (rtos txt6 2 *pec1) txt3)
      )
    )
    (PutX ent1 'Textstring txt7)
    
    )
    Last edited by Opie; 2007-02-20 at 06:54 PM. Reason: [CODE] tags added

  5. #5
    All AUGI, all the time Mlabell's Avatar
    Join Date
    2004-12
    Location
    Toledo, OH
    Posts
    513
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    I all the code suppsed to be one lisp? Or seperate? I could use something like this also. I have only a routine which does whole numbers.

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Quote Originally Posted by marklabell
    I all the code suppsed to be one lisp? Or seperate? I could use something like this also. I have only a routine which does whole numbers.
    I separated the code to make it more readable. It was not originally in code tags.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Quote Originally Posted by marklabell
    I all the code suppsed to be one lisp? Or seperate? I could use something like this also. I have only a routine which does whole numbers.
    You can put it all in one lisp file, and then just load that one lisp file. Then you would type 'AddText' to use it. It is one I posted before somewhere else.

  8. #8
    All AUGI, all the time Mlabell's Avatar
    Join Date
    2004-12
    Location
    Toledo, OH
    Posts
    513
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Got it. Thanks guys!

  9. #9
    Member
    Join Date
    2007-04
    Posts
    7
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    I'm looking for a routine that will open my drawing, increase a certain text value by one, save, close the drawing and then go on to the next drawing and do the same thing. Suchas increasing the drawing number from 50 to 51 in the first drawing and 51 to 52 in the next drawing for example. I have 250 drawings that have one piece of mtext that must be increased by one. Thanks!
    Last edited by KMiller.138083; 2007-04-20 at 08:00 PM.

  10. #10
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Globally subtract 1 from all numbers

    Welcome to this forum KMiller,

    More info would be nice like layer, size, xyz, font, text . . . .
    then it would be easier to identify the Mtext object.
    if we are lucky there is only one Mtext that have some parameters in common.


    : ) Happy Computing !

    kennet

Page 1 of 2 12 LastLast

Similar Threads

  1. Comment numbers in clash report don't match numbers in image
    By rsloyer in forum NavisWorks - General
    Replies: 0
    Last Post: 2010-06-18, 07:13 PM
  2. Add .17 to text numbers globally
    By ss_66ss396 in forum AutoLISP
    Replies: 9
    Last Post: 2008-12-11, 01:06 AM
  3. Ability to have letters as well as numbers in as revision sequence numbers
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2007-10-01, 01:07 PM
  4. Translate nVidia installer numbers to driver numbers
    By Andre Baros in forum Revit - Hardware & Operating Systems
    Replies: 4
    Last Post: 2007-02-14, 05:08 PM
  5. Mirroring globally and uncostraining globally
    By WolffG in forum Revit Architecture - General
    Replies: 4
    Last Post: 2004-07-19, 10:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •