Results 1 to 3 of 3

Thread: lisp for for sum text number before a specific alphabet character

  1. #1
    Member
    Join Date
    2014-03
    Posts
    5
    Login to Give a bone
    0

    Post lisp for for sum text number before a specific alphabet character

    Could any body help me to create a lisp for for sum text number before a specific alphabet character
    Example,

    5*M16*35
    2*M16*40
    4*M16*45

    4*M16*35
    3*M16*40
    6*M16*45

    M16*35
    M16*40
    M16*45


    result

    M16*35 =10
    M16*40=6
    M16*45=11

    First number indicates number of pieces,So like that texts have so many in a drawing.
    I need a lisp to calculate each type how many have in that drawings and give me in csv file or in a table in the same drawing.

    If there is no number in front of M16..it should take it as 1 piece
    Please help me any body.

    Thanks

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: lisp for for sum text number before a specific alphabet character

    Where does

    5*M16*35
    2*M16*40
    4*M16*45

    4*M16*35
    3*M16*40
    6*M16*45

    M16*35
    M16*40
    M16*45

    come from? Is it a list of strings? It would help if you could post it in whatever form the lisp will need to process it. Will M16* always be the start of what you are counting?

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: lisp for for sum text number before a specific alphabet character

    Quote Originally Posted by Tom Beauford View Post
    Will M16* always be the start of what you are counting?
    I believe that this is a list of metric bolts. You will need a list of all possible bolt sizes used and iterate the list of strings for each bolt size. Without knowing where the strings come from, you could make this problem modular. Create a function just for iterating the strings and leave the selection process for another function that calls the summing function.

    So, Anjan, the logic would go something like this:

    Code:
    The function starts by accepting a list of bolts as an argument.
    Then for each bolt in another list of stock bolt sizes,
         For each string in the list of strings
              get a substring to check the string to see if it is the right bolt size
                   if it is, then get a substring of the quantity and add it to a variable for that bolt size
         Process next string
    Process next bolt size
    Format a list of strings of the quantities for each bolt size
    Output as text ents
    Last edited by Ed Jobe; 2014-03-04 at 03:55 PM.
    C:> ED WORKING....

Similar Threads

  1. Replies: 11
    Last Post: 2013-04-02, 05:27 AM
  2. View Title: Label Read first character of Detail Number Only?
    By BSaunders in forum Revit Architecture - General
    Replies: 2
    Last Post: 2010-10-20, 11:24 PM
  3. Prefix Filenames with Project Number - Change Character
    By bradg in forum Project Navigator
    Replies: 0
    Last Post: 2008-11-13, 09:08 PM
  4. Replies: 13
    Last Post: 2007-03-19, 11:37 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
  •