See the top rated post in this thread. Click here

Page 5 of 8 FirstFirst 12345678 LastLast
Results 41 to 50 of 72

Thread: Auto number attribute lisp fix

  1. #41
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    BTW, for those who can / want to add other custom formats, all you need do is create a lisp defun with the following:
    Code:
    (defun AINC:CUSTOM:YourFormatName (num dgt prec)
      ;;Whatever you need to do to convert the real value of num
      ;;to a string with dgt (minimum) numbers before the decimal
      ;;point and prec (exactly) numbers after.
      ;;The result MUST be a string, even an empty string is fine
    )
    The rest will handle it on its own, the dialog will show only the red marked portion of your defun's name in the drop-down (unfortunately only in capital letters though).
    Last edited by irneb; 2010-10-13 at 05:27 PM.

  2. #42
    Member
    Join Date
    2010-01
    Location
    Kunming China
    Posts
    28
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    thanks
    the new version is received,and all seem like good.And... I have some suggestion....later.
    Thanks!

  3. #43
    Member
    Join Date
    2009-06
    Location
    Florida
    Posts
    27
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    I download your lisp and found it very useful and it will save me tons of time. There is one thing I wish it could do a little easier.

    I have multiple items that need the same labels. Is there a way to make it keep labeling the same letter or number until the user pushes Enter? For example I would label 3 items "A" then hit enter, label the next 2 items "B" and hit enter and the next 4 would be "C" and so on. With the way it is now I could do this but there is a lot of back and forth with the window dialog as apposed to just clicking and Enter.

    Thanks.

  4. #44
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    Which of the 2 are you referring to? The AutoIncr or the older Increment? I can see changing the old one to this much more easily, as the later would need a bit of rewriting (don't really want to recode too much).

  5. #45
    Member
    Join Date
    2009-06
    Location
    Florida
    Posts
    27
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    I was refering to the older Increment one. If this could be done it would help a lot.

    Thanks

  6. #46
    Member
    Join Date
    2010-01
    Location
    Kunming China
    Posts
    28
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    Dear irneb:
    First of all I would like Pay tribute to you,"AutoIncr.0.23.LSP" is a best program.
    And Sorry to bother you,but I have a suggestion that is not so good.I've been thinking these days,but what is the "group"?
    Maybe "1,2,3,4......Infinity" is a group,or "1,3,5......Infinity".Sometimes I need a group like "1,5,2,6", This is a grouping of no rules. I would like to import one "rules" from outside , that's mean txt (Text format),We can Save the contents of grouping in that one,Including the number and content of the text.For example,I have one "1.txt",It
    includes the following information "2,3,4,5,6,7,8,9,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,39".
    So I can Re-grouping from 2 to 39 According to my rules, and Automatically end grouping at the right time when "39" Appears .In this process, I can Random end grouping,then Start the next grouping.
    I do not know whether to do, it seems very difficult,But I really needed it.Many guys also need it.
    Thank you,All the best regard to you.

  7. #47
    Member
    Join Date
    2010-01
    Location
    Kunming China
    Posts
    28
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    Quote Originally Posted by irneb View Post
    BTW, for those who can / want to add other custom formats, all you need do is create a lisp defun with the following:
    Code:
    (defun AINC:CUSTOM:YourFormatName (num dgt prec)
      ;;Whatever you need to do to convert the real value of num
      ;;to a string with dgt (minimum) numbers before the decimal
      ;;point and prec (exactly) numbers after.
      ;;The result MUST be a string, even an empty string is fine
    )
    The rest will handle it on its own, the dialog will show only the red marked portion of your defun's name in the drop-down (unfortunately only in capital letters though).
    I could not understand
    For example,one custom format like this"
    2,3,4,5,6,7,8,9,12,13,14,15,16,17,18,19,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,39".
    How Programming?
    Last edited by xiaxiang_2004512631; 2010-10-29 at 06:55 AM.

  8. #48
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    Sorry for the delay, was a bit busy

    You could do something like use the octal formatting with some changes in that one. E.g.:
    Code:
    (defun AINC:CUSTOM:Octal+2 (num dgt prec / str)
      ;; Get the normal Octal representation
      (setq str (AInc:Num2Base num (assoc "OCT" AInc#Types) prec))
      ;; Increment each digit by 2 and return
      (vl-string-translate "01234567" "23456789" str)
    )
    There's probably other ways of doing this as well

    If you've got this loaded, the settings dialog should show an option in the Custom format's drop-down called OCTAL+2 ... which should then use this function instead. Unfortunately it's not entirely correct, since you get the following list:
    ("2" "3" "4" "5" "6" "7" "8" "9" "32" "33" "34" "35" "36" "37" "38" "39" "42" "43" "44" "45" "46" "47" "48" "49" "52" "53" "54" "55" "56" "57" "58")
    So actually you only want the last digit to be translated to +2 ... thus:
    Code:
    (defun AINC:CUSTOM:Octal+2Last (num dgt prec / str)
      ;; Get the normal Octal representation
      (setq str (AInc:Num2Base num (assoc "OCT" AInc#Types) prec))
      ;; Increment last digit by 2 and return
      (strcat 
        (substr str 1 (1- (strlen str))) 
        (vl-string-translate "01234567" "23456789" (substr str (strlen str)))
      )
    )
    Which gives exactly what you wanted, i.e.
    ("2" "3" "4" "5" "6" "7" "8" "9" "12" "13" "14" "15" "16" "17" "18" "19" "22" "23" "24" "25" "26" "27" "28" "29" "32" "33" "34" "35" "36" "37" "38")

  9. #49
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    There was a slight error with my code, the custom format didn't update correctly in the dialog. Please see the revision 25 on the SVN: http://caddons.svn.sourceforge.net/v...r.LSP?view=log

    Also I've worked on a version which would use a file as the list from which it increments.
    Code:
    (defun AINC:CUSTOM:MyCustom_From_File (num dgt prec / MyCustom_From_File:Load)
      (defun MyCustom_From_File:Load (/ fn f str lst)
        (if (and (setq fn (findfile "MyCustomIncr.TXT"))
                 (setq f (open fn "r"))
            )
          (progn
            (while (setq str (read-line f))
              (setq lst (cons str lst))
            )
            (close f)
            (setq *MyCustom_From_File:List* (reverse lst))
          )
        )
      )
    
      (or *MyCustom_From_File:List* (MyCustom_From_File:Load))
    
      (if (not *MyCustom_From_File:List*)
        (itoa (fix num)) ;If there's no custom list just get an integer
        (nth (rem (fix num) (length *MyCustom_From_File:List*)) *MyCustom_From_File:List*)
      )
    )
    Then the file should be named MyCustomIncr.TXT and placed on your support path. It's simple a text file with each consecutive increment on a new line, e.g.
    Code:
    Zero'th
    First
    Second
    Third
    Fourth
    Fifth
    Sixth
    Seventh
    Eigth
    Ninth
    Tenth
    Eleventh
    Although it simply keeps on repeating the same sequence, so the 12th position would show as Zero'th.

  10. #50
    Member
    Join Date
    2010-01
    Location
    Kunming China
    Posts
    28
    Login to Give a bone
    0

    Default Re: Auto number attribute lisp fix

    Thanks ,let me try it.First of all thank you for your serious,While I have not fully read.
    Thanks!

Page 5 of 8 FirstFirst 12345678 LastLast

Similar Threads

  1. Auto Number in AutoCAD
    By congnvc370652 in forum Dot Net API
    Replies: 0
    Last Post: 2014-10-11, 09:06 AM
  2. 2011: Express Tools Auto Number - Skips Number in Multi-line Mtext
    By stusic in forum AutoCAD General
    Replies: 3
    Last Post: 2013-01-29, 02:38 PM
  3. Auto-Number with Grids
    By simon.perkins in forum AutoLISP
    Replies: 3
    Last Post: 2009-08-18, 10:48 AM
  4. auto number title blocks
    By lee.johnson in forum AutoLISP
    Replies: 5
    Last Post: 2009-04-20, 02:50 PM
  5. Auto Re-Number Door/Window Tag V9.0
    By Firmso in forum Revit Architecture - General
    Replies: 3
    Last Post: 2007-04-18, 04:05 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
  •