BrownTiger Posted October 23, 2019 Share Posted October 23, 2019 >Hello BT, Just trying to get the new revised version to work with the previously posted roof plane macro. Thank you. Issues with the cut and paste. Corrected >Would it be possible to return the Roof Plane # in the Roof plane label something like this ? Add something like this: result += "Roof Plane: " + obj.object_id.to_s i.e. result = "Slope Angle: " +(Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2).to_s + "\n" result += "Pitch: " + obj.automatic_label+ "\n" result += "Area: " + ((obj.framing_area / 100.0 ).round(1)).to_s result += "Roof Plane: " + obj.object_id.to_s result Link to comment Share on other sites More sharing options...
Chopsaw Posted October 23, 2019 Share Posted October 23, 2019 Thank You BT, But still getting duplicates in the results for some reason after editing. Also is there a way to make the Roof Plane # match the numbering of the results ? Link to comment Share on other sites More sharing options...
BrownTiger Posted October 23, 2019 Share Posted October 23, 2019 Try this label macro referenced ? obj = referenced : obj = owner if $tree.nil? $tree = Hash.new { |hash, key| hash[key] = {} } end id="p" + obj.object_id.to_s pitch = obj.automatic_label area = ( obj.framing_area / 100.0 ).round(1) slope = (Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2) #unless $tree['roofplanes'].has_value?(id) items = Hash.new() items['roof_plane']=id items['pitch']=pitch items['area']=area $tree['roofplanes'][id]=items #end indx = $tree['roofplanes'].keys.find_index(id) result = "Slope Angle: " +slope.to_s + "\n" result += "Pitch: " + pitch+ "\n" result += "Area: " + area.to_s + "\n" result += "Roof Plane: " +indx.to_s result ============================================ Entering statement below in Ruby console will reset your collection tree. $tree = nil Link to comment Share on other sites More sharing options...
BrownTiger Posted October 23, 2019 Share Posted October 23, 2019 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 23, 2019 Share Posted October 23, 2019 (edited) I seem to be getting an evaluation error but can't find the discrepancy. Cut and paste did add a couple of "?" similar to the issue Alan was having, at the end of the slope and index lines that I removed but not sure what is causing the error. Edited October 23, 2019 by Chopsaw Found it... there was another cut and paste ? mid line that I missed. Link to comment Share on other sites More sharing options...
Chopsaw Posted October 23, 2019 Share Posted October 23, 2019 Thanks for sharing that BT, It seems to be working for me now with the ruby console reset of collection tree "$tree = nil " Link to comment Share on other sites More sharing options...
Alaskan_Son Posted October 23, 2019 Share Posted October 23, 2019 On 10/22/2019 at 4:37 PM, Chopsaw said: Also is it possible for the data to be presented in Standard Text Box with tab stops and grid lines to give the appearance of a schedule ? BT's macro can definitely be modified to help accommodate this a little more, but it already has tab stops in it to get you most of the way there. The problem though is this: The text box you're using needs to have the appropriate number of tabs added to the text itself or the macro generated tabs don't work. It could be as simple as adding the column headers and their related tabs. 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 23, 2019 Share Posted October 23, 2019 Oops... It seems the Text macro is now picking up the new label global variable for the area and they are not the supposed to be the same. sq should not equal sq ft. I will try to fix it but it may be beyond me still. This seems to fix the issue and also has my preferred custom formatting. ################################################################################# referenced ? obj = referenced : obj = owner if $tree.nil? $tree = Hash.new { |hash, key| hash[key] = {} } end id="p" + obj.object_id.to_s pitch = obj.automatic_label area = obj.surface_area areasq = ( obj.framing_area / 100.0 ).round(1) slope = (Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2) #unless $tree['roofplanes'].has_value?(id) items = Hash.new() items['roof_plane']=id items['pitch']=pitch items['area']=area items['areasq']=areasq $tree['roofplanes'][id]=items #end indx = $tree['roofplanes'].keys.find_index(id) result = "Slope Angle: " + slope.to_s + "°\n" result += "Roof Pitch: " + pitch + "\n" result += "Roof Area: " + areasq.to_s + " sq" +"\n" result += "Roof Plane: # " + indx.to_s result ################################################################################# Link to comment Share on other sites More sharing options...
Chopsaw Posted October 23, 2019 Share Posted October 23, 2019 1 hour ago, Alaskan_Son said: 17 hours ago, Chopsaw said: Also is it possible for the data to be presented in Standard Text Box with tab stops and grid lines to give the appearance of a schedule ? BT's macro can definitely be modified a little more to help accommodate this a little more, but it already has tab stops in it to get you most of the way there. The problem though is this: The text box you're using needs to have the appropriate number of tabs added to the text itself or the macro generated tabs don't work. It could be as simple as adding the column headers and their related tabs. Thanks Michael, I learned a lot today. Link to comment Share on other sites More sharing options...
Alaskan_Son Posted October 23, 2019 Share Posted October 23, 2019 38 minutes ago, Chopsaw said: Thanks Michael, I learned a lot today. You bet. Here’s a bonus trick too... Convert a schedule to text, delete the unnecessary stuff and then use that as your text box instead if you want the title line with double underline. 1 Link to comment Share on other sites More sharing options...
BrownTiger Posted October 23, 2019 Share Posted October 23, 2019 Thank you guys. Another improvement slope = (Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2) Can be replaced with the angle method no need to calculate. slope = obj.angle.round(2) Anyone knows what is the difference between .framing_area and .surface_area methods? Link to comment Share on other sites More sharing options...
Joe_Carrick Posted October 23, 2019 Share Posted October 23, 2019 54 minutes ago, BrownTiger said: Thank you guys. Another improvement slope = (Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2) Can be replaced with the angle method no need to calculate. slope = obj.angle.round(2) Anyone knows what is the difference between .framing_area and .surface_area methods? framing_area should be to the outside of the rafters and rough fascia surface_area should be to the outside of the finish fascia and possibly shadow-boards 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 24, 2019 Share Posted October 24, 2019 7 hours ago, Alaskan_Son said: You bet. Here’s a bonus trick too... Convert a schedule to text, delete the unnecessary stuff and then use that as your text box instead if you want the title line with double underline. I am sure that I could have used that quite a few times if I had known sooner. Thank You. Too bad it is not a one click option. 1 Link to comment Share on other sites More sharing options...
Alaskan_Son Posted October 24, 2019 Share Posted October 24, 2019 Just a few quick notes for when you're trying to utilize global arrays and hashes... You can use the = nil, .clear or similar in the Ruby Console to force a rebuild. The downside though is that you have to type it up every time. You can write a custom macro to do the exact same as above and then simply opening and closing Text Macro Management will force the rebuild. The downside to this though is that it will also force an empty hash or array inside Text Macro Management, so you'll never get to preview your results in that dialog. To me, this is pretty minor and the results there are usually inaccurate anyway, so it's really a non-issue for me personally. You can place the aforementioned macro somewhere on screen so that whenever that particular object is displayed, the array or hash is cleared and subsequently rebuilt. It can only be displayed temporarily though because otherwise it will continually empty the array or hash and you won't get your desired results. You can use the time oriented method Joe suggested, but this also has it's downsides...For example, if you have roof planes on more than one floor, you'll almost always be missing results from the other floors. The only totally consistent method I've found is to use something with a schedule number so that the schedule number can be used as a constant. If the schedule number already exists in the hash or array, then that item is deleted and the new one is placed there. This essentially makes sure no extra items are ever added to the list. It's obviously only possible for items with schedule numbers though. For items without schedule numbers, one of my personally preferred methods is to use a .clear macro placed up on the attic level. I then just periodically cycle through all floors to both clear the array or hash and to also pick up on any items that are on other floors. Anyway, just beware that those hashes and arrays are tricky to work with in Chief and that you have to be pretty deliberate with your methods if you want to be sure you're getting accurate results. Link to comment Share on other sites More sharing options...
BrownTiger Posted October 24, 2019 Share Posted October 24, 2019 I typically click on a Macro in TMM and copy and paste the results into a text box; If you adjust a roof plane -- copy and paste again. This was a test Ruby project for an enumeration of roof planes. Same thing can be done with area analysis, etc. Link to comment Share on other sites More sharing options...
Rich_Winsor Posted October 25, 2019 Share Posted October 25, 2019 God love you guys, but when you start hashing out these macros I might as well be reading this stuff. More than ever I am convinced that macros should have a forum of their own. 2 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 On 10/23/2019 at 11:56 AM, Chopsaw said: Also is there a way to make the Roof Plane # match the numbering of the results ? On 10/23/2019 at 12:01 PM, BrownTiger said: Try this label macro referenced ? obj = referenced : obj = owner if $tree.nil? $tree = Hash.new { |hash, key| hash[key] = {} } end id="p" + obj.object_id.to_s pitch = obj.automatic_label area = ( obj.framing_area / 100.0 ).round(1) slope = (Math.atan2(obj.pitch,12.0)*180.0/Math::PI).round(2) #unless $tree['roofplanes'].has_value?(id) items = Hash.new() items['roof_plane']=id items['pitch']=pitch items['area']=area $tree['roofplanes'][id]=items #end indx = $tree['roofplanes'].keys.find_index(id) result = "Slope Angle: " +slope.to_s + "\n" result += "Pitch: " + pitch+ "\n" result += "Area: " + area.to_s + "\n" result += "Roof Plane: " +indx.to_s result ============================================ Entering statement below in Ruby console will reset your collection tree. $tree = nil I think Rich is correct in that Hieroglyphics would be simpler but I think I am finally getting the hang of this and will be able to make use of this type of macro. Is there a simple way to make the Roof Plane # sequence start at 1 rather than 0 ? Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 1 minute ago, solver said: Why do you ask? Because it would reduce the level of confusion for those not familiar with Hieroglyphics. If you have a listing of items that goes from 0-33 some people forget that there are actually 34 items once they get to the end of the list. 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 Thanks Eric, I did not realize it would be that simple. Putting it in the result line produces an error but in the indx line it seem to be working. indx = $tree['roofplanes'].keys.find_index(id)+1 I just need to figure out the global part now but that will likely be the same trick. Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 9 minutes ago, solver said: result += "Roof Plane: " +indx+1.to_s Probably needed to be result += "Roof Plane: " +(indx+1).to_s Yes that method makes it work for both the label and text macro's. Thank You s= index.to_s needs to be s=( index+1).to_s in the text macro. Link to comment Share on other sites More sharing options...
Kbird1 Posted October 25, 2019 Share Posted October 25, 2019 1 hour ago, Chopsaw said: Yes that method makes it work for both the label and text macro's. Thank You s= index.to_s needs to be s=( index+1).to_s in the text macro. Thanks Chopsaw (and Eric) I had the same thought as you about the numbering and this has fixed it I'm just following along and trying things (script kiddie) as I don't know Ruby, so two Tips from Michael (Thanks) in this thread have also helped with some issues I was having too, the .Clear Macro on the Attic Level works well for forcing the rebuild of the Tables and the Trick with the Schedule turned to Text makes it look nicer too. (save-able to Library). I just need to figure out the Tab stops for the Room Sqft Table so it works nicer like the Roof Sqft Table . I assume it is the +"\t" part but must be placing it incorrectly or something? Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 18 minutes ago, Kbird1 said: I just need to figure out the Tab stops for the Room Sqft Table so it works nicer like the Roof Sqft Table . I assume it is the +"\t" part but must be placing it incorrectly or something? Mick it looks like maybe you missed a tab setting up the text schedule for your column headings ? Link to comment Share on other sites More sharing options...
Kbird1 Posted October 25, 2019 Share Posted October 25, 2019 37 minutes ago, Chopsaw said: Mick it looks like maybe you missed a tab setting up the text schedule for your column headings ? Yep so far playing with it I haven't got it to work, BT's macro does it for the Roof Planes but His Room Macro is missing the extra Tab Stops of the Roof Plane macro and I assume I am inserting the wrong Code ( +"\t" ??? ) or inserting it in the wrong place so far. Need to play more.... M. Link to comment Share on other sites More sharing options...
Chopsaw Posted October 25, 2019 Share Posted October 25, 2019 4 minutes ago, Kbird1 said: Yep so far playing with it I haven't got it to work, BT macro does it for the Roof Planes but the Room Macro is missing the extra Tab Stops and I assume I am inserting the wrong Code ( +"\t" ) or inserting it in the wrong place so far. I believe that is the correct code and it appears that you were successful with the Roof Plane Schedule. Maybe post the test plan if you are sure you have the tabs in the text schedule. Link to comment Share on other sites More sharing options...
Kbird1 Posted October 25, 2019 Share Posted October 25, 2019 Thanks for the Help/Push CS got it sorted out (somehow ) was a two part issue , the code was right , just had to find the placement for it and then I needed a 4 Column Schedule Text Box to pull it all together, I had made a 2, 3, and 4 column one and didn't notice I was trying to use the 2 column one , so the tabs weren't being recognised properly. Now I'd like to total the Room Info Table if possible , if someone know the Code for that , thanks. *** should we use the room standard area instead of internal perhaps? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now