Results 1 to 10 of 10

Thread: adding one

  1. #1
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Question adding one

    Is there a lisp routine out there that can add "1" to the selected numbers you choose?

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: adding one

    you can search for text increment in the augi forums, that may do what you need

  3. #3
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: adding one

    Thank you. I already have something similar to that.
    My real question is, once you have 62 numbers on the drawing, if you missed a device address between 4 and 5, can you add one to numbers 5-62 to make it 6-63 since I missed a number which happens to be number 5 in this example.

    Wow, I hope that made sense.

  4. #4
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: adding one

    Quote Originally Posted by prose View Post
    Thank you. I already have something similar to that.
    My real question is, once you have 62 numbers on the drawing, if you missed a device address between 4 and 5, can you add one to numbers 5-62 to make it 6-63 since I missed a number which happens to be number 5 in this example.

    Wow, I hope that made sense.
    Are they attributes, mtext or text?

  5. #5
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: adding one

    Quote Originally Posted by BoKirra View Post
    Are they attributes, mtext or text?
    Just regular text.

  6. #6
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: adding one

    The lisp function (1+) will do it.

    Code:
    
    ;;;Example
    (setq k 5)
    (1+ k)
    ;;; returns 6
    ;;; Notice that there is no space between 1 and +
    ;;;
    ;;;
    ;;; You could also use this
    (+ 1 k)
    
    
    
    R.K. McSwain | CAD Panacea |

  7. #7
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: adding one

    Okay, I have tried many ways, and still no luck.
    Here is one of the many ways I have tried.

    Code:
    (defun c:add1 ()
    (setq ns (ssget))
    (+ 1 ns)
    )
    Any ideas as what I am doing wrong.

  8. #8
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: adding one

    I have tried this as well
    Code:
    (defun c:add ()
    (setq nb (getint "Enter Number to add:"))
    (setq ns (ssget '((-4 . "<OR")
                        (0 . "MTEXT")
                        (0 . "TEXT")
                        (-4 . "OR>")
                       )
               )
    )
    (+ ns nb)
    )
    but I keep getting an error like this
    Code:
    Select objects:
    ; error: bad argument type: numberp: <Selection set: 1586a>

  9. #9
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: adding one

    Read the HELP files for these functions.

    (ssget) returns a selection set, and (+) and (1+) expect a number.

    To do what you are trying to do, you need to extract the *value* of each item in the selection set, and then convert that to a number, and then add the value that you want to add, and then update each item with this new value.

    There is a version of what you are trying to do in this ZIP file.
    http://www.sybex.de/download/Aec.zip
    R.K. McSwain | CAD Panacea |

  10. #10
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: adding one

    Quote Originally Posted by rkmcswain View Post
    Read the HELP files for these functions.

    (ssget) returns a selection set, and (+) and (1+) expect a number.

    To do what you are trying to do, you need to extract the *value* of each item in the selection set, and then convert that to a number, and then add the value that you want to add, and then update each item with this new value.

    There is a version of what you are trying to do in this ZIP file.
    http://www.sybex.de/download/Aec.zip
    I will do that, thanks.

Similar Threads

  1. 2011: Adding Spaces
    By mls04d312778 in forum AMEP General
    Replies: 3
    Last Post: 2011-05-06, 01:28 AM
  2. Adding C3D SAP to a deployment?
    By DWS44 in forum AutoCAD Civil 3D - General
    Replies: 0
    Last Post: 2009-12-10, 03:32 PM
  3. Adding 3D symbol
    By jdkehl in forum ACA General
    Replies: 2
    Last Post: 2008-08-29, 08:47 PM
  4. Adding Kerb ....
    By moshira_hassan in forum Revit Architecture - General
    Replies: 9
    Last Post: 2008-07-31, 12:14 PM
  5. Adding Attributes
    By michael.viscetto65572 in forum AutoLISP
    Replies: 33
    Last Post: 2007-08-20, 11:10 AM

Posting Permissions

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