Q: How do I get control over the macro-generated text on a roof plane?


para-CAD
 Share

Recommended Posts

1 hour ago, Kbird1 said:

Now I'd like to total the Room Info Table if possible  , if someone know the Code for that , thanks.

 

Here is the basics copied form BT's original Roof Plane formatting.  But you are already beyond the original as I see.

 

Rooms Text Schedule.JPG

Link to comment
Share on other sites

1 hour ago, Chopsaw said:

 

Here is the basics copied form BT's original Roof Plane formatting.  But you are already beyond the original as I see.

 

Rooms Text Schedule.JPG

 

 

Hmmm I did try that but I get an Eval. Error, will try changing the context but not sure if it is related to the fact I split the Macro into individual lines for easier reading (and inserting of tabs) earlier.

 

Am I right thinking there is a trick to making text larger in the TMM Edit window? ---- size 8 font just don't cut it anymore

 

M.

 

image.thumb.png.f00c180a4557c4462ad83f958f552153.png

Link to comment
Share on other sites

16 minutes ago, Kbird1 said:

Am I right thinking there is a trick to making text larger in the TMM Edit window? ---- size 8 font just don't cut it anymore

 

Yes I believe that is on Joe's suggestion list.   Although I think he does most of the work in Notepad++ so that is not so much of an issue.

 

Very nice work by the way especially for someone who claims to not know Ruby.  I will give yours a play if I have time to see if I can make it work.

Link to comment
Share on other sites

Okay sounds like I need to reinstall Notepad++

 

I have played a little with different languages over the years, most recently a little Arduino so I tend to always leave myself lots of Notes in the Code so I know where I got it from and it maybe 5 years till I look at the code again and I won't remember what I did :) ..... With ruby I know a little bit of syntax etc and a few commands eg rounding stuff but don't really understand what is happening where, so lots of trail and error, I certainly can't do what Joe , BT , Micheal  or Even Eric can.

 

You are more than welcome to try these macros in their present state..... happy to share ......

 

Room and Roof Sqft Macros for Table.json

 

no warranty given or implied :)

 

 

 

Link to comment
Share on other sites

2 hours ago, Kbird1 said:

Hmmm I did try that but I get an Eval. Error, will try changing the context but not sure if it is related to the fact I split the Macro into individual lines for easier reading (and inserting of tabs) earlier.

 

Yes you were correct although I have no idea why.

 

I do like the way you had it laid out nice and clean. 

 

Maybe one of the guru's can explain ?

 

I formatted the Totals: line the way it is in Chief Schedules just for consistency..  I did not really like mine or yours or even BT's format.

 

Take a look and see if it works for you.

 

Room Sqft Macro for Table Revised by Chop.json

Link to comment
Share on other sites

This was an example of enumeration for rooms. 

 

I recommend you for practical purposes to store "conditioned" value and may be "type_name".

 

== roomLabel Macro ==

referenced ? obj = referenced : obj = owner

if $tree.nil?

$tree = Hash.new { |hash, key| hash[key] = {} }

end

id="r" + obj.object_id.to_s

items = Hash.new()

items['room_name']=obj.name

items['floor_number']=obj.floor_number

items['internal_area']=obj.internal_area

items['conditioned']=obj.conditioned

items['type_name']=obj.type_name

$tree['rooms'][id]=items

arr = (obj.ceiling_elevation-obj.floor_elevation).round(0).divmod(12)

result ="#{arr[0]}'-#{arr[1].round}''" + " CLG.HT."

result

==

 

== room_Sqft_info ==

##############################################################

#

# ORIGINAL MACRO CODE BY FORUM MEMBER ---- MANY THANKS TO BROWN TIGER -----

#

#https://chieftalk.chiefarchitect.com/topic/20097-ruby-enumerating-objects-list-of-rooms-areas-or-sq-ft/

#or

#https://chieftalk.chiefarchitect.com/topic/24014-q-how-do-i-get-control-over-the-macro-generated-text-on-a-roof-plane/

#

# EDITED BY MICK AKA KBIRD1 ON CA FORUMS WITH A LITTLE HELP FROM CHOPSAW

#

# Place this Macro in a Text Box or Rich Text Box

# or in a 4 Column Schedule converted to Text. (best looking)

#

# Make sure the room_Label Macro is also added to the Room Default Label

# in the Plan Defaults as well.

#

##############################################################

 

result=""

sqft=0

 

$tree["rooms"].keys.each_with_index do |key,index|

s= (index+1).to_s

if ( $tree["rooms"][key]['conditioned'])

result += " " + s +"\t" + $tree["rooms"][key]['room_name'].to_s + " \t" + $tree["rooms"][key]['floor_number'].to_s + " \t" + $tree["rooms"][key]["internal_area"].round(0).to_s + " sq ft\n"

sqft +=$tree["rooms"][key]["internal_area"].round(0)

end

end

 

result += "Totals: \t\t\t" +sqft.to_s + " sq ft \n"

result

  • Upvote 1
Link to comment
Share on other sites

The garages_sqft_info macro can print out garages. Same with porches etc

==

result=""

sqft=0

 

$tree["rooms"].keys.each_with_index do |key,index|

s= (index+1).to_s

 

if ( $tree["rooms"][key]['type_name'] == 'Garage')

result += " " + s +"\t" + $tree["rooms"][key]['room_name'].to_s + " \t" + $tree["rooms"][key]['floor_number'].to_s + " \t" + $tree["rooms"][key]["internal_area"].round(0).to_s + " sq ft\n"

sqft +=$tree["rooms"][key]["internal_area"].round(0)

end

end

result += "Totals: \t\t\t" +sqft.to_s + " sq ft \n"

result

Garage_sqft.txt

  • Upvote 1
Link to comment
Share on other sites

Thanks for the Follow Up BT and the new/updated Macros

 

The new Room Label Code and the Code for splitting out Different Room Types works great.

 

** Is there a way to force the Room sort Order eg alphabetically or by Room type  per Floor would be best if also possible

 

*** Note to Others , once you put the new Room Code Macro into the Default Room Label ( put it on Line 2 in the label DBX)

make sure to go into Existing Rooms in the Plan and toggle the "Show Label" box off and back on, then close the DBX

to get it to refresh and report the Room Types to your new Garage, Porch, Decks etc Tables ( and add the CLG HGT to the room label.

 

M. 

 

image.thumb.png.e0c5c7bc1b12bb1cac17301f6038970e.png

Link to comment
Share on other sites

15 hours ago, Chopsaw said:

 

Yes you were correct although I have no idea why.

 

I do like the way you had it laid out nice and clean. 

 

Maybe one of the guru's can explain ?

 

I formatted the Totals: line the way it is in Chief Schedules just for consistency..  I did not really like mine or yours or even BT's format.

 

Take a look and see if it works for you.

 

Room Sqft Macro for Table Revised by Chop.json

 

Thanks Chopsaw  , you are right, it was my editing for readability that broke it.  

 

It seems it needs to be Coded your way (and BT's see new macros) too populate the Table with a Total.

 

M.

Link to comment
Share on other sites

On 10/25/2019 at 8:15 PM, solver said:
On 10/25/2019 at 7:51 PM, Kbird1 said:

Am I right thinking there is a trick to making text larger in the TMM Edit window?

 

Nope -- an upgrade has been suggested. I use Notepad++ to edit.

 

Hi Eric what settings in NP++ do you use to display .json files correctly ? currently it is just one long line  and wordwrap doesn't format , just wraps to window. I can't remember what I did to get it to display Arduino Files properly , so hope you can remember what .json needs....

 

Thanks,

 

Mick.

Link to comment
Share on other sites

** Is there a way to force the Room sort Order eg alphabetically or by Room type  per Floor would be best if also possible

 

Lol I realize ruby language is pretty cryptic, elegant in its own insane way...

 

1) in the collector macro change to upper case from 

items['room_name']=obj.name

to

items['room_name']=obj.name.upcase

 

Next sort your way, by first creating an array of values and next sorting it, or sort by room scheduler number (that one can be manually reordered). 

$tree['rooms'].values.sort_by {|h| [ h['floor_number'],h['room_name'] ]}

Sort it by as many predicate as you wish

 

 

>Should we use the room standard area instead of internal perhaps

Standard Area is measured from center of interior walls

Interior Area is measured from the inner surfaces 

 

I assume that the standard area for promotional purposes ... 

 

Link to comment
Share on other sites

1 hour ago, solver said:

 

They are Ruby files so I've always used a .rb extension.

 

Not sure why the use of the .json extension as it's a file that stores simple data structures and objects in JavaScript Object Notation (JSON) format.


This highlights one of the most fundamental pieces of the puzzle...

 

Chief Architect and Ruby are 2 entirely separate constructs.  The sooner a person realizes this, the better.
 

A .json text macro is NOT a Ruby script.  It’s a Chief file.  That simple text file contains several key pieces of information that only Chief can make any use of...one of which (evaluated vs. non-evaluated) is whether the appropriate section of that text file should even be sent over to Ruby in the first place or not.  
 

An .rb file on the other hand is typically ONLY Ruby script and not something Chief can actually make any use of.  It only becomes useful if it’s accessed directly by Ruby.  
 

And do what you guys want, this is obviously just one persons opinion, but I wouldn’t recommend switching over to Notepad++ till you actually learn the fundamentals.  Based on some of the posts above, it’s clear to me that some of you are lacking some important understanding of some key basics.  In order to address those shortcomings you should really stick with writing your macros in Chief, using the selected object to get accurate feedback, and using the Evaluation Error messages to see where you’re going wrong.  Once you actually understand the code you’re manipulating, how that code is being used in conjunction with the Chief model information, and how that code is being run through Ruby and subsequently displayed onscreen by Chief, then I think you can better make use of an external text editor.  Until then, I feel like you’ll be trying to run and jump before you can actually walk.  
 


 

 

Link to comment
Share on other sites

The issue is ... and I am really sympathize with the author about his font issues. ChiefArchitect is based on Qt framework. In Qt you set the font QApplication and every dialog QDialog inherits it.

 

All good. However Ruby macros Ruby dialog [886_] this font is way to small.

Chief Architect Premier X11 Dialog Sizes.ini allow you to define dialog sizes, but not the font.

 

ChiefArchitect allow you to override the font but only for a material list.

 

So my understanding is that @Kbird1 was looking for a solution and someone suggested Notepad++. [Fine right?]

But I think he is trying to open JSon file instead of just pasting the script. 

 

My Suggesting would be to use Windows Magnifier tool (<Window Key> and <PLUS key> to launch, and <Window Key> and ESC to turn off).

 

 

 

Link to comment
Share on other sites

1 hour ago, BrownTiger said:

The issue is ... and I am really sympathize with the author about his font issues. ChiefArchitect is based on Qt framework. In Qt you set the font QApplication and every dialog QDialog inherits it.

 

All good. However Ruby macros Ruby dialog [886_] this font is way to small.

Chief Architect Premier X11 Dialog Sizes.ini allow you to define dialog sizes, but not the font.

 

ChiefArchitect allow you to override the font but only for a material list.

 

So my understanding is that @Kbird1 was looking for a solution and someone suggested Notepad++. [Fine right?]

But I think he is trying to open JSon file instead of just pasting the script. 

 

My Suggesting would be to use Windows Magnifier tool (<Window Key> and <PLUS key> to launch, and <Window Key> and ESC to turn off).

 

 

 

 

You are correct BT, I tried opening the .json Chief saves directly in the hope of comparing your new and old code yesterday and of course got all the hidden text etc etc.

 

The Font Size is way too small to work with easily if you aren't a 20 something anymore :)

 

I did not think about using a simple copy and paste to NP++ (or even windows NP?) from the Edit DBX and back again if needed.

 

I believe the Help System uses QT framework too and it has a Zoom function , so I wonder why it hasn't been implemented in the TMM/TMM Edit DBX.

 

I have Suggested several times that Chief allow us to Change the Font to our liking through the Program as , at the moment only parts of it respond to the Windows Font settings , maybe in X12 since we got Themes in X11.......

 

Mick.

 

 

 

Link to comment
Share on other sites

#=== room_sqft_info sorted macro by request==

result=""

sqft=0

 

v=$tree['rooms'].values.sort_by {|h| [ h['floor_number'],h['room_name'] ]}.each_with_index do |val,index|

s= (index+1).to_s

 

if ( val['conditioned'] && val['type_name'] != 'Open Below')

result += " " + s +"\t" + val['room_name'].to_s + " \t" + val['floor_number'].to_s + " \t" +val["internal_area"].round(0).to_s + " sq ft\n"

sqft +=val["internal_area"].round(0)

end

end

 

result += "Totals: \t\t\t" +sqft.to_s + " sq ft \n"

result

Macro_room_sqft2.txt

Link to comment
Share on other sites

On 10/26/2019 at 12:06 PM, BrownTiger said:

The garages_sqft_info macro can print out garages. Same with porches etc

==

result=""

sqft=0

 

$tree["rooms"].keys.each_with_index do |key,index|

s= (index+1).to_s

 

if ( $tree["rooms"][key]['type_name'] == 'Garage')

result += " " + s +"\t" + $tree["rooms"][key]['room_name'].to_s + " \t" + $tree["rooms"][key]['floor_number'].to_s + " \t" + $tree["rooms"][key]["internal_area"].round(0).to_s + " sq ft\n"

sqft +=$tree["rooms"][key]["internal_area"].round(0)

end

end

result += "Totals: \t\t\t" +sqft.to_s + " sq ft \n"

result

 

Hello BT,  I thought maybe I could use this formatting to isolate my results by floor but can't seem to make it work.  I don't get an error but also no results ?

 

####################################################################################

result=""

sqft=0

 

$tree["rooms"].keys.each_with_index do |key,index|

 

s= (index+1).to_s

 

if ($tree["rooms"][key]['floor_number'] == '1')

 

result += " " + s +"\t" + $tree["rooms"][key]['room_name'].to_s + " \t" + $tree["rooms"][key]['floor_number'].to_s + " \t" + $tree["rooms"][key]["internal_area"].round(0).to_s + " sq ft\n"

 

sqft +=$tree["rooms"][key]["internal_area"].round(0)

 

end

end

 

result += "Totals: \t\t\t" +sqft.to_s + " sq ft \n"

 

result

 

######################################################################################

 

One other little issue I noticed is that the macro seems to pick up the data from the "Living Area Label".  Is it possible to use this in the plan but exclude it from the results ?

 

I really appreciate you sharing and taking the time to teach these skills. :)

 

Edited by Chopsaw
It seems this line does not require the quotes. if ($tree["rooms"][key]['floor_number'] == 1)
Link to comment
Share on other sites

> I don't get an error but also no results ?

 

Macro_room_sqft.txt

 

Because $tree["rooms"][key]['floor_number'] <-- is a number and not a literal.

$tree["rooms"][key]['floor_number'] == 1 <- not == '1' 

 

>One other little issue I noticed is that the macro seems to pick up the data from the "Living Area Label".  Is it possible to use this in the plan but exclude it from the results ?

 

Many ways...

 - Double click on the "Living Area Label" and remove the collector macro at the bottom. Followed by $tree = nil ( or open and close ChiefArchitect)

 

 

  • Like 1
Link to comment
Share on other sites

10 hours ago, BrownTiger said:

>One other little issue I noticed is that the macro seems to pick up the data from the "Living Area Label".  Is it possible to use this in the plan but exclude it from the results ?

 

Many ways...

 - Double click on the "Living Area Label" and remove the collector macro at the bottom. Followed by $tree = nil ( or open and close ChiefArchitect)

 

Perfect.  I did not realize that the Living Area Label was a "Room Label" and had acquired the macro I placed in as the default.  That sounds like the simplest solution.   Thank You !!!

Link to comment
Share on other sites

Its great the people with this knowledge take the time to share, but I am guessing that the majority out there can't follow this. Example for roof planes: what is the latest macro for roof planes and what areas does one place the macro to get to a roof plane schedule. It's tough to follow unless you understand. I think I have learned one thing, I should give up on learning macros and will be way farther ahead purchasing some custom marcos from one of you. Interested let me know.  

Link to comment
Share on other sites

On 10/28/2019 at 7:13 PM, BrownTiger said:

 

#=== room_sqft_info sorted macro by request==

 

Macro_room_sqft2.txt

 

 

Thanks BT , I really appreciate you looking at the Sort Order issue/request and re-writing this Macro , so I didn't need to Play with the code you supplied above and figure out where I was going wrong !

 

And for Supplying the Macro as a standard Text file :) , so much easier to read etc in Notepad .

 

 

Link to comment
Share on other sites

On 10/29/2019 at 9:47 PM, jonboy said:

Example for roof planes: what is the latest macro for roof planes and what areas does one place the macro to get to a roof plane schedule.

 

 Yes the discussion has become a little complicated for the average user but unfortunately macro's are that way.  BT has posted his work for free and allowed us to take advantage of the power of macro's without having to know all the idiosyncrasies.

 

The important thing here is that you are interested and have hung in this far.

 

The roof plane text macro can be placed into what I am calling a text schedule.  Michael shared that a stock Chief Architect schedule of any kind with the correct number of columns can be converted to text.  The number of columns can actually be edited later by adding tab stops to the Text Specification DBX.  Then the data is gutted and replaced to create your own custom schedule.

 

Mine looks like this for the Roof Plane text macro.

 

Roof Plane Schedule 2.JPG

 

If this is what you are after just let me know and I will try my best to walk you through what I know.

Link to comment
Share on other sites

Finally got this to work and tried rearranging the order that items are displayed. With changing things around in the macro I get is error message. Trying to get to the order as shown on the left of the attachment

How does one prevent getting multiple roof planes, every time I make a revision I get a new roof plane in the schedule. Is there something one can change or add to the macro?

Lastly,  how can one control the numbering order of roof planes. Any help is greatly appreciated.  

macro2.JPG

macro.JPG

Link to comment
Share on other sites

Try this jonboy ........  note: 1st line of order does not need the + sign, the next 4 do after result 

 

indx = $tree['roofplanes'].keys.find_index(id)

 

result = "Roof Plane No# : " + (indx+1).to_s + "\n"

 

result += "Roof Area Sqft : " + area.to_s + " sqft" + "\n"

 

result += "Roof Area Total Sqs : " + areasq.to_s + " sq" + "\n"

 

result += "Roof Pitch : " + pitch + "\n"

 

result += "Slope Angle : " + slope.to_s + "°\n"

 

result


=======================================================

 

Full Macro text fileRoof_Label_Macro_Text File.txt

 

=======================================================

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share