uhlerandcompany 0 Posted January 13, 2020 Does anyone know how to make the object specific framing joist macro labels in ft and inches ('0-0") instead of inches? Share this post Link to post Share on other sites
uhlerandcompany 0 Posted January 13, 2020 I added a signature but in case it doesn't show up i'm running X11. Thanks for the help! Share this post Link to post Share on other sites
solver 1575 Posted January 13, 2020 Something like this? Share this post Link to post Share on other sites
uhlerandcompany 0 Posted January 13, 2020 Yes, that would be ideal. I'm using the macro to auto generate the length but cant figure out how to do it in feet instead of inches. Share this post Link to post Share on other sites
solver 1575 Posted January 13, 2020 This is what I use. It gives you some formatting options. I define a function ConvertToFeetInches, and the very last line calls the function. If you wanted to convert the length, it would look like this. ConvertToFeetInches(length,16, " ", "-", true) def ConvertToFeetInches (number, denominator, s1, s2, show_zero) # number - the input to be converted from decimal inches to feet and fractional inches # denominator (8 for 1/8, 16 for 1/16 etc) # s1 - user defined string placed between feet and inches # s2 - user defined string placed between inches and any fraction # show_zero - (true/false) adds 0" if there are no inches (number=12 and s1="-" would format as 1'-0") # core code adapted from https://chieftalk.chiefarchitect.com/topic/11982-tip-for-correcting-ft-in-macros/#comment-133636 case denominator when 1..64 else return "[Convert Error - Denominator out of range. Must be from 1 to 64]" end divisor = 1/denominator.to_f a = ((number/divisor).round*divisor).divmod(12) if a[0] != 0 feet = a[0].to_s + "'" else feet="" end if a[1] == 0 # check for inches, if none, return feet if show_zero return feet + s1 + "0\"" else return feet end else i = a[1].floor # get inches f = a[1].modulo(1).rationalize # get fraction if i != 0 and f != 0 # both inches and fractions return feet + s1 + i.to_s + s2 + f.to_s + '"' end if i != 0 # inches but no fractions return feet + s1 + i.to_s + '"' end if f != 0 # fractions but no inches return feet + s1 + f.to_s + '"' end end end ConvertToFeetInches(length,16, " ", "-", true) Share this post Link to post Share on other sites
uhlerandcompany 0 Posted January 13, 2020 Can you re-post that link? It is saying couldn't locate item. Share this post Link to post Share on other sites