Results 1 to 5 of 5

Thread: Select case by integer - Restrict integer value to one

  1. #1
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Select case by integer - Restrict integer value to one

    What I am doing is:
    I am selecting a block, finding the first empty value and using it's integer number in a "select case" procedure
    Code:
     
    Select Case i
    Case 2 - attval (i) = "A" 
    Case 4 - attval (i) = "B"
     etc.
    This is done within a "For each" procedure. The second time the "For each" procedure enters the block, the block attribute has been filled, wich makes the integer increase. The result is, that my block is completely filled. I would like it if only the first empty integer would be used as the criterium by wich the Select....End Select procedure fills the block.

    I tried doing this by putting a counter within the procedure that would only allow the macro to run if the counter value was 1. No luck, I don't quite understand why. Then I thought perhaps I could change the integer to a constant somehow, but the integer did not want to be changed. I'm running out of ideas, so does anyone have some other ideas?

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Select case by integer - Restrict integer value to one

    So you are saying that the values with which you are populating the attribute references are static? And I presume the attribute tags are known?

    I would use a scripting dictionary in that case to store the static data and then iterate thru the attribute references populating only the attribute references with no value based on the data in the scripting dictionary. The keys in the dictionary would be the tag strings so that makes it easy to get the data.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Default Re: Select case by integer - Restrict integer value to one

    Thanks for the quick response. I'm not so familiar with the dictionary variable, so I stuck to what I'm more at home in. But I did take a similar route by converting the integer values to strings and splitting them into an array. From that array, I used the first value as the criterium for editing the attributes. That works quite nicely.

    I am left with one challenge though. Now that I have set 1 value as the pointer for editing the attributes, attribute values on a higher position in blocks with the same name are overwritten. I'll have to adapt this procedure so it resets its value on every block, but thats a puzzle for a different day. Good night for now, and thank you very much for thinking along with me!

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Select case by integer - Restrict integer value to one

    Quote Originally Posted by darfnuggi View Post
    Thanks for the quick response. I'm not so familiar with the dictionary variable, so I stuck to what I'm more at home in. But I did take a similar route by converting the integer values to strings and splitting them into an array. From that array, I used the first value as the criterium for editing the attributes. That works quite nicely.

    I am left with one challenge though. Now that I have set 1 value as the pointer for editing the attributes, attribute values on a higher position in blocks with the same name are overwritten. I'll have to adapt this procedure so it resets its value on every block, but thats a puzzle for a different day. Good night for now, and thank you very much for thinking along with me!
    That's why I would use a scripting dictionary. You can store the data by the tag string rather than hoping an index number holds the correct data.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  5. #5
    100 Club
    Join Date
    2007-07
    Posts
    104
    Login to Give a bone
    0

    Thumbs up Re: Select case by integer - Restrict integer value to one

    I really have to experiment more with the dictionary variable, I've understood it's faster than an array and a collection too, so it needs my attention. As for now I solved the last issue by redimming the integer i, the string of integers, and the array. But I'm sure that is less elegant than the dictionary solution you mentioned.

Similar Threads

  1. Real or Integer value
    By avinash patil in forum VBA/COM Interop
    Replies: 4
    Last Post: 2011-09-14, 10:49 AM
  2. How can we know that value is real of Integer
    By avinash00002002 in forum AutoLISP
    Replies: 17
    Last Post: 2008-09-23, 12:07 AM
  3. Whole Integer values.
    By archjake in forum Revit Architecture - General
    Replies: 8
    Last Post: 2008-05-15, 11:13 PM
  4. integer parameter problem
    By steedlei in forum Revit Architecture - Families
    Replies: 10
    Last Post: 2007-10-24, 03:27 PM
  5. Blanking out an integer
    By J. Grouchy in forum Revit Architecture - General
    Replies: 3
    Last Post: 2005-03-03, 02:28 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
  •