BrownTiger Posted May 12, 2020 Share Posted May 12, 2020 What is the correct or suggested way to create a ceiling macro in X12? (Let's say I want it displayed as x'-y") Like this for example: #================================================== height = (owner.ceiling_elevation-owner.floor_elevation).round(0).to_in arr =height.divmod(12) result ="#{arr[0]}'-#{arr[1].round}''" + " CLG.HT." #=================================================== Or there is a better way to display 12'-5" without the use of divmod? Define a custom NumberFormarter? etc. Just looking for suggestions? Link to comment Share on other sites More sharing options...
Alaskan_Son Posted May 12, 2020 Share Posted May 12, 2020 Define new NumberFormatter is the easiest and most accurate way. 1 Link to comment Share on other sites More sharing options...
Joe_Carrick Posted May 12, 2020 Share Posted May 12, 2020 I agree with Michael. Note that you don't need to use .to_in when using the NumberFormatter. I actually have several predefined NumberFormatters saved as $Globals so that I can just specify which one I want: $NF_in $NF_ft $NF_ft_in They are all automatically loaded into memory when I open my Layout (macro in a text box on page 0) 1 Link to comment Share on other sites More sharing options...
BrownTiger Posted May 12, 2020 Author Share Posted May 12, 2020 Thank you very much. # #Macro: roomLabel #X12 Room Macro. Defined global $FtIn #BT Output: 13'-0" CLG.HT. # referenced ? obj = referenced : obj = owner height = (obj.ceiling_elevation-obj.floor_elevation).round(0) if defined?($FtIn).nil? then $FtIn = NumberFormatter.new $FtIn.unit = "'-\"" $FtIn.use_fractions = true $FtIn.denominator = 8 $FtIn.show_trailing_zeros = true end result = $FtIn.apply(height) + " CLG.HT." LabelTest.plan Link to comment Share on other sites More sharing options...
Joe_Carrick Posted May 12, 2020 Share Posted May 12, 2020 BT, Since you rounded height to 0 places - the denominator of 8 is superfluous. 1 Link to comment Share on other sites More sharing options...
BrownTiger Posted May 12, 2020 Author Share Posted May 12, 2020 Lol, thanks. $FtIn.denominator = 8 I was going to define in the room lable macro and reuse $FtIn class in other places. 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