Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Join Date
    Oct 2009
    Posts
    904
    Joe:

    You may want to look at using a combination of Hashes & Arrays. Unlike other languages, Ruby's hashes can store any object(s): other arrays, hashes, strings, numbers, etc (mix and match). The keys can be numbers or descriptive strings which makes it quite useful to organize and store data like this & you don't need to remember index numbers.

    You may be aware but thought others interested should also be aware of the options? It's a matter of preference. BTW -- Chief is aware of the short comings mentioned. Just wondering if their paying attention to the actual users of their product?
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  2. #17
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    Gerry,

    I don't have to remember index numbers. I match the room name with the $DeckNames to get the index and then use that automatically to coordinate with the corresponding $DeckAreas data.

    I could also use just a single array $Decks and store sub-arrays but that gets a little more difficult to code. I don't know if you were aware that Ruby Arrays can have mixed data types.

    I should probably look at Hashes but since I've never used them before it would take a bit more study on my part. I suspect that my dual array method does pretty much the same thing as a Hash. Hashes would probably be more efficient but for what I'm doing it doesn't seem to make any difference.
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  3. #18
    Join Date
    Oct 2009
    Posts
    904
    BTW ---

    I like what you doing but you might want to take it a step further. In that, if you add or delete a porch, deck, bedroom, the analysis will automatically update without user intervention. Adding is easy, deletions require more programing because once added, globals remain in memory.

    Consider adding a time stamp and automatically purging any deleted objects (not updated) so that your cals need only add up objects of a defined type for the area analysis. Hash keys set to nil or removed automatically purge that object.
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  4. #19
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    Quote Originally Posted by gteacher View Post
    BTW ---

    I like what you doing but you might want to take it a step further. In that, if you add or delete a porch, deck, bedroom, the analysis will automatically update without user intervention. Adding is easy, deletions require more programing because once added, globals remain in memory.

    Consider adding a time stamp and automatically purging any deleted objects (not updated) so that your calcs need only add up objects of a defined type for the area analysis. Hash keys set to nil or removed automatically purge that object.
    You are absolutely correct about deletions. I currently use one of the following to update after deletions:

    1. Execute a macro that resets all the globals to default values which causes the arrays to get rebuilt to only the remaining items.
    2. Close Chief - Restart Chief - Open the Plan. Has essentially the same effect as #1.

    In both instances I have to redisplay each floor.

    Unfortunately I don't know any way to use a time-stamp at this point - other than just checking every time the array is scanned and if it's more than a minute or so since the last update - set the Area Data to 0 but if that room happens to be on a floor that I don't redisplay it could improperly eliminate valid data. IAE, it's something to think about.
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  5. #20
    Join Date
    Jun 2005
    Location
    Southern California
    Posts
    4,874
    The Room finish Schedule add and deletes rooms on the fly without any problems, depending if you check" include in Schedule" or not. Does it use macro's for that.
    Perry
    P.H. DESIGNS L.L.C.
    Eastvale Calif.
    Alienware, liquid cooled
    Ver 10-"X6 x64 SSA
    WIN 8.1 PRO 64 bit
    Nvidia GTX780 3GB.
    i7 920 2.67-- 12 GB Ram
    40" led monitor

  6. #21
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    Quote Originally Posted by perryh View Post
    The Room finish Schedule add and deletes rooms on the fly without any problems, depending if you check" include in Schedule" or not. Does it use macro's for that.
    Very true - but none of that is available to Ruby so we can't perform automatic calculations with it.

    I'm also interested in creating a completely different Room Finish Schedule. I want it organized and formatted differently than what Chief provides. If I had access to all room attributes (Chief doesn't currently provide everything) I could create one to my own specs. OTOH, it will be interesting to see when X6 is released if Schedules have become more flexible.
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  7. #22
    Join Date
    Oct 2009
    Posts
    904
    Perry:

    Probably does somewhere. But I'm not talking about living area but automatic area analysis & auto breaking out of external vs internal, site, & by room type etc.

    Joe:

    My point that those steps aren't necessary -- unless that's the way your comfortable with.

    Basically, instead of just storing a value for each object, you store a array containing a time stamp, & value(s) array. The value(s) array can be different for each type of object and contain several avail values stored automatically.

    A purge macro runs with each cycle to look at the time stamp and if not up to date within(?) deletes that global. In this manner, the program only needs to add up objects of the same type ID using a enumerator. i.e the sum formula never need be changed.

    The purge macro can be placed on each floor and use a global to identify floors -- ignore floors (globals) your not currently on.

    I didn't go into details because I didn't know if you or anyone else was interested? If so I can supply example macros -- but more set up, so maybe a step too far?
    Last edited by gteacher; 10-07-2013 at 01:15 PM. Reason: Added enumerator
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  8. #23
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    Gerry,

    I understand - I may follow that route. Obviously, I would need to create my own "Floor" global on each floor because Chief doesn't provide an attribute for that (same as for "page"). Even if an array or hash element was removed because of time, it would immediately be added back if the item was present.

    Nice idea. Thanks.
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  9. #24
    Join Date
    Oct 2009
    Posts
    904
    Quote Originally Posted by Joe Carrick View Post
    I understand - I may follow that route. Obviously, I would need to create my own "Floor" global on each floor because Chief doesn't provide an attribute for that (same as for "page"). Even if an array or hash element was removed because of time, it would immediately be added back if the item was present.

    Nice idea. Thanks.
    Yep -- Your welcome
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  10. #25
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    Gerry,

    If I create Hash Entries for Rooms like this:

    $Areas[name] = {type, standard_area, Time.now, $Floor}

    then:

    $Areas["Deck #1"][0] => "Deck"
    $Areas["Deck #1"][1] => 220
    $Areas["Deck #1"][2] => 2013-10-07 15:17:33 -0800
    $Areas["Deck #1"][3] => 1

    Is this correct?

    Can I access the data sequentially using an index number in a loop?
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  11. #26
    Join Date
    Jan 2007
    Location
    San Marcos, CA
    Posts
    6,805
    For me it'll be better to do as follows:

    $RoomAreas = []
    $RoomAreas[i] = [name, type, standard_area, Time.now, $Floor]

    then:

    $RoomAreas[i][0] => "Deck #1"
    $RoomAreas[i][1] => "Deck"
    $RoomAreas[i][2] => 220
    $RoomAreas[i][3] => 2013-10-07 15:17:33 -0800
    $RoomAreas[i][4] => 1
    etc.

    $RoomAreas can contain all room types and I can retrieve the areas based on type. Anytime the Array is scanned I can check the Floor and Time Stamp to see that it's current. If not I'll remove that item.

    This will make the Array larger but it will eliminate having an array for each room type.
    Joseph P. Carrick, Architect - AIA
    ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
    Windows 8.1
    Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium

  12. #27
    Join Date
    Oct 2009
    Posts
    904
    Your completely correct -- but your thinking multi dim array rather than hash. the first part (dim) is the key value, so its more correct to think returned object, than next returned object, than next etc. -- same as stacked casts in c++;

    i.e. ($area["Deck#1"])[3] -- assuming key's "Deck #1" return is a array (Could be another hash) Your code should work and usually does, but the interpreter in 1.9.1 sometimes gets confused without help -- Don't know why.

    You can use a index but better to use a enumerator.

    $area.each { |key,value|
    value.each {|x|
    x = some code
    }
    }

    Also -- caps are usually reserved for constants and classes in Ruby

    You initialize hashes by --- hash = {key => value, key => value ......}
    or just -- hash["some key"] = "something"

    or

    arr = Array.new; arr.push("something"); arr.push("somemore") etc,
    hash["mykey"] = arr

    etc.
    etc.
    Be careful to create a new array rather than reusing a name because arrays & hashes are passed by reference and you may step on your code.
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  13. #28
    Join Date
    Oct 2009
    Posts
    904
    Joe:

    you can type faster than I can get back to the computer. I'll try to catch up in a bit
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

  14. #29
    Join Date
    Oct 2009
    Posts
    904
    Second Post:

    Works just as well
    But a technicality -- Note: Ruby does not support Multi dim arrays, but any array can contain a array -- same thing -- but better to use () to better identify & not confuse the interpreter (sometimes).
    Also Ruby has no support for multi enums.
    Need to cascade same.
    Gerry

    NewCraft Home Services

    Design/ Compliance Review
    PE, X6 , Sketchup 8, TurboCad Pro 20
    -----------------------------------
    ASUS P9X79D, i7-3820, GTX680 w/4gb
    -----------------------------
    If the Government would just cut down more d*** trees, I'd have a much better view of the forest.

 

 

Posting Permissions

  • Login or Register to post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •