Macro for ft & in with no units


KristjanM
 Share

Recommended Posts

When I was using Revit, an available format for a door or window size displayed as 2-8X6-8. I have always found this quite clear. In Chief I can have 28x68 or 2'-8"x6'-8". The first example is clear to the builders I work with but to others, sometimes they think it means 28"x68". Not good. The second example is sometimes too long for my liking. I've spent some significant time trying a number of ruby instructions to get a display like my Revit example but am not successful. Part of the problem is the lack of any comprehensive help about Chief's ruby implementation. Can someone show me the magic macro to duplicate my Revit output?

Link to comment
Share on other sites

Chopsaw - Yes, that works. I must say that I find nothing recognizable in your macro. Time for more exploration. Thanks.

 

Eric - A valid question but I would say that typically, door or window sizes are listed as nominal. Any fractions involved would be displayed in the object schedule.

Link to comment
Share on other sites

Okay, not entirely elegant. :(  If the door width includes inches of 10 or 11, the insert references the wrong placement for the - insert . EG, 2'10" x 6'8". So for this approach, you would need a macro which would test the second and third member of the automatic_label string and see if they were 10 or 11. Then you could apply appropriate insert numbers to get the proper result. A little more figuring to do.

  • Upvote 1
Link to comment
Share on other sites

21 minutes ago, KristjanM said:

Okay, not entirely elegant. :(  If the door width includes inches of 10 or 11, the insert references the wrong placement for the - insert . EG, 2'10" x 6'8". So for this approach, you would need a macro which would test the second and third member of the automatic_label string and see if they were 10 or 11. Then you could apply appropriate insert numbers to get the proper result. A little more figuring to do.

 

I thought there may be limitations but did not think of that one.  That may go beyond my current level of expertise.  Although it likely can be accomplished.  If you are not going to be using fractions then that should really help.

 

Perhaps @solver  could quickly add a few lines and make it work ?  Or a different approach altogether.

Link to comment
Share on other sites

Chopsaw - Upon further thought, I realized that manipulating a string value, considering the possibilities, was not really a trivial problem. A number formatting approach might be better. So... your post has provided that. Thanks for that. This method works except in the case where the measurement involves 0 inches as in a door 3-0X6-8. The zero does not display. It shows as 3X6-8. Not good. I can't find anything in the number formatter methods to force the display of a zero value. Still a puzzle.

 

para-CAD - Good suggestion. That method is clear in intent but I've never been a fan of the very small superscript.

Link to comment
Share on other sites

58 minutes ago, KristjanM said:

Chopsaw - Upon further thought, I realized that manipulating a string value, considering the possibilities, was not really a trivial problem. A number formatting approach might be better. So... your post has provided that. Thanks for that. This method works except in the case where the measurement involves 0 inches as in a door 3-0X6-8. The zero does not display. It shows as 3X6-8. Not good. I can't find anything in the number formatter methods to force the display of a zero value. Still a puzzle.

 

Add a couple lines and I think we have it now ?

 

image.thumb.png.6f72879af4a78cddd9e570b1f6327219.png

Link to comment
Share on other sites

Chopsaw - Yes, that works now. I had played around with leading / trailing zeros but was missing the Decimal_places = 0. Thanks for your help.

 

Eric - A nice neat solution. I had a bit of an issue making this work until I changed the macro Context: to Owner Object. All is good now. Thanks.

 

Not sure why Chief doesn't supply this format natively. I can do this in Autocad, Archicad, Revit, Vectorworks and Softplan out of the box. Chief is really good in so many other ways that I can put up with the few workarounds that present themselves.

Link to comment
Share on other sites

I've been following this discussion as I've also shared Kristjan's concern about the clarity of OOTB standard window and door callouts.

 

I personally think inches underscored is a classic and clear format.  Don't think superscript would even be necessary.

 

But, I suppose getting the underlines to work would be a macro job. 

 

Jim

 

 

image.thumb.png.f32bb852f17589ecb9b475470e5fc6c6.png

Link to comment
Share on other sites

See the video for more info
 

# Copyright Rabbitt Design 2023

# Helper method to convert numbers to superscript
def to_superscript(num)
  superscript_map = {
    '0' => '⁰', '1' => '¹', '2' => '²', '3' => '³',
    '4' => '⁴', '5' => '⁵', '6' => '⁶', '7' => '⁷',
    '8' => '⁸', '9' => '⁹'
  }
  num.to_s.chars.map { |char| superscript_map[char] }.join
end

# WINLABEL MACRO WITH CONDITION FOR BLANK NEW LINE
def winLabel
  # MAPPING OF WINDOW TYPES TO THEIR ABBREVIATIONS
  window_types = {
    'Single Hung' => 'SH',
    'Double Hung' => 'DH',
    'Single Casement' => 'SC',
    'Double Casement' => 'DC',
    'Triple Casement' => 'TC',
    'Left Sliding' => 'LS',
    'Right Sliding' => 'RS',
    'Fixed Glass' => 'FX',
    'Single Awning' => 'AW',
    'Louvered Window' => 'LV',
    'Glass Louvered' => 'GL',
    'Pass-Through' => 'PT'
  }

  # CHECK ENERGY VALUES FOR WINDOW LABEL PREFIX
  window_prefix = if u_factor > 0.3 || shgc > 0.25
                    '(E)-'
                  else
                    ''
                  end

  # CHECK IF LAYER_SET INCLUDES "WINDOW LAYOUT"
  if layer_set.downcase.include?("window layout")
    if window_prefix == '(E)-' || schedule_number.empty?
      return "N/A"
    else
      return schedule_number
    end
  end

  # CONVERT WIDTH TO FLOAT AND CALCULATE IN FEET AND INCHES
  width_feet, width_inches = width.to_f.round.divmod(12)
  width_str = "#{width_feet}#{to_superscript(width_inches.round)}"

  # CALCULATE HEIGHT IN FEET AND INCHES
  height_feet, height_inches = height.to_f.round.divmod(12)
  height_str = "#{height_feet}#{to_superscript(height_inches.round)}"

  # GET SCHEDULE NUMBER
  schedule_str = schedule_number

  # GET TYPE NAME AND REPLACE WITH ABBREVIATION IF EXISTS
  type_str = window_types[type_name] || type_name

  # CHECK IF WIDTH IS LESS THAN 30"
  if width.to_f < 30
    # SPLIT TYPE STRING AFTER ANY SPACE
    type_str = type_str.split(' ').join("\n")
    # COMBINE VALUES INTO MULTIPLE LINES
    "#{window_prefix}#{schedule_str}\n#{width_str}#{height_str}\n#{type_str}"
  else
    # COMBINE ALL VALUES INTO A SINGLE STRING WITH NEW ORDER AND NEW LINE FOR TYPE
    "#{window_prefix}#{schedule_str} #{width_str}#{height_str} #{type_str}"
  end
end

# CALL THE WINLABEL MACRO
winLabel

  • Like 2
  • Upvote 1
Link to comment
Share on other sites

28 minutes ago, Renerabbitt said:

See the video for more info
 

# Copyright Rabbitt Design 2023

# Helper method to convert numbers to superscript
def to_superscript(num)
  superscript_map = {
    '0' => '⁰', '1' => '¹', '2' => '²', '3' => '³',
    '4' => '⁴', '5' => '⁵', '6' => '⁶', '7' => '⁷',
    '8' => '⁸', '9' => '⁹'
  }
  num.to_s.chars.map { |char| superscript_map[char] }.join
end

# WINLABEL MACRO WITH CONDITION FOR BLANK NEW LINE
def winLabel
  # MAPPING OF WINDOW TYPES TO THEIR ABBREVIATIONS
  window_types = {
    'Single Hung' => 'SH',
    'Double Hung' => 'DH',
    'Single Casement' => 'SC',
    'Double Casement' => 'DC',
    'Triple Casement' => 'TC',
    'Left Sliding' => 'LS',
    'Right Sliding' => 'RS',
    'Fixed Glass' => 'FX',
    'Single Awning' => 'AW',
    'Louvered Window' => 'LV',
    'Glass Louvered' => 'GL',
    'Pass-Through' => 'PT'
  }

  # CHECK ENERGY VALUES FOR WINDOW LABEL PREFIX
  window_prefix = if u_factor > 0.3 || shgc > 0.25
                    '(E)-'
                  else
                    ''
                  end

  # CHECK IF LAYER_SET INCLUDES "WINDOW LAYOUT"
  if layer_set.downcase.include?("window layout")
    if window_prefix == '(E)-' || schedule_number.empty?
      return "N/A"
    else
      return schedule_number
    end
  end

  # CONVERT WIDTH TO FLOAT AND CALCULATE IN FEET AND INCHES
  width_feet, width_inches = width.to_f.round.divmod(12)
  width_str = "#{width_feet}#{to_superscript(width_inches.round)}"

  # CALCULATE HEIGHT IN FEET AND INCHES
  height_feet, height_inches = height.to_f.round.divmod(12)
  height_str = "#{height_feet}#{to_superscript(height_inches.round)}"

  # GET SCHEDULE NUMBER
  schedule_str = schedule_number

  # GET TYPE NAME AND REPLACE WITH ABBREVIATION IF EXISTS
  type_str = window_types[type_name] || type_name

  # CHECK IF WIDTH IS LESS THAN 30"
  if width.to_f < 30
    # SPLIT TYPE STRING AFTER ANY SPACE
    type_str = type_str.split(' ').join("\n")
    # COMBINE VALUES INTO MULTIPLE LINES
    "#{window_prefix}#{schedule_str}\n#{width_str}#{height_str}\n#{type_str}"
  else
    # COMBINE ALL VALUES INTO A SINGLE STRING WITH NEW ORDER AND NEW LINE FOR TYPE
    "#{window_prefix}#{schedule_str} #{width_str}#{height_str} #{type_str}"
  end
end

# CALL THE WINLABEL MACRO
winLabel

 

 

Thank you.

 

Jim

 

 

Link to comment
Share on other sites

  • 1 month later...
On 11/23/2023 at 2:53 PM, Renerabbitt said:

See the video for more info
 

# Copyright Rabbitt Design 2023

# Helper method to convert numbers to superscript
def to_superscript(num)
  superscript_map = {
    '0' => '⁰', '1' => '¹', '2' => '²', '3' => '³',
    '4' => '⁴', '5' => '⁵', '6' => '⁶', '7' => '⁷',
    '8' => '⁸', '9' => '⁹'
  }
  num.to_s.chars.map { |char| superscript_map[char] }.join
end

# WINLABEL MACRO WITH CONDITION FOR BLANK NEW LINE
def winLabel
  # MAPPING OF WINDOW TYPES TO THEIR ABBREVIATIONS
  window_types = {
    'Single Hung' => 'SH',
    'Double Hung' => 'DH',
    'Single Casement' => 'SC',
    'Double Casement' => 'DC',
    'Triple Casement' => 'TC',
    'Left Sliding' => 'LS',
    'Right Sliding' => 'RS',
    'Fixed Glass' => 'FX',
    'Single Awning' => 'AW',
    'Louvered Window' => 'LV',
    'Glass Louvered' => 'GL',
    'Pass-Through' => 'PT'
  }

  # CHECK ENERGY VALUES FOR WINDOW LABEL PREFIX
  window_prefix = if u_factor > 0.3 || shgc > 0.25
                    '(E)-'
                  else
                    ''
                  end

  # CHECK IF LAYER_SET INCLUDES "WINDOW LAYOUT"
  if layer_set.downcase.include?("window layout")
    if window_prefix == '(E)-' || schedule_number.empty?
      return "N/A"
    else
      return schedule_number
    end
  end

  # CONVERT WIDTH TO FLOAT AND CALCULATE IN FEET AND INCHES
  width_feet, width_inches = width.to_f.round.divmod(12)
  width_str = "#{width_feet}#{to_superscript(width_inches.round)}"

  # CALCULATE HEIGHT IN FEET AND INCHES
  height_feet, height_inches = height.to_f.round.divmod(12)
  height_str = "#{height_feet}#{to_superscript(height_inches.round)}"

  # GET SCHEDULE NUMBER
  schedule_str = schedule_number

  # GET TYPE NAME AND REPLACE WITH ABBREVIATION IF EXISTS
  type_str = window_types[type_name] || type_name

  # CHECK IF WIDTH IS LESS THAN 30"
  if width.to_f < 30
    # SPLIT TYPE STRING AFTER ANY SPACE
    type_str = type_str.split(' ').join("\n")
    # COMBINE VALUES INTO MULTIPLE LINES
    "#{window_prefix}#{schedule_str}\n#{width_str}#{height_str}\n#{type_str}"
  else
    # COMBINE ALL VALUES INTO A SINGLE STRING WITH NEW ORDER AND NEW LINE FOR TYPE
    "#{window_prefix}#{schedule_str} #{width_str}#{height_str} #{type_str}"
  end
end

# CALL THE WINLABEL MACRO
winLabel

 

 

Link to comment
Share on other sites

I hate to sound completely ignorant, but where would you insert this string of code to achieve window & door sizes to be formatted this CORRECT way? Is this Ruby or something else? I haven't gotten in to that part of using CA. I've used CA off & on since x8! But I've gotten to use it heavily the last 18 months! Thanks to all of you who are willing to suffer through to help those of us with less knowledge in CA!!!

 

Jason Moore

Ironwood Architectural Design/Build

Chief Architect x8-x15

Texas

Link to comment
Share on other sites

19 minutes ago, Investmentbiz said:

I hate to sound completely ignorant, but where would you insert this string of code to achieve window & door sizes to be formatted this CORRECT way? Is this Ruby or something else? I haven't gotten in to that part of using CA. I've used CA off & on since x8! But I've gotten to use it heavily the last 18 months! Thanks to all of you who are willing to suffer through to help those of us with less knowledge in CA!!!

 

Jason Moore

Ironwood Architectural Design/Build

Chief Architect x8-x15

Texas

I have a newer version that does a bit more in my pro plan template but this one should still work great for all intensive purposes. Go into CAD/Text/Text Macro Management then start a new macro, set to evaluate on  an object level, name it, then in your window default label, click the macro drop down and find it in your user macros

Link to comment
Share on other sites

  • 6 months later...
  • 2 months later...

Any help with a macro to convert my door and window labels to feet and inches like this

 

3'0 X 6'8

 

Width in feet and inches X Height in feet in inches (just ' symbol no ") 

The default of inches doesn't work for us and using the formatted height macro doesn't give you the ' symbol and makes it confusing

 

I'm not always doing door and window schedules but the formatting I'm looking for seems pretty common and confused why its not an option in Chief.

 

 

 

 

Link to comment
Share on other sites

2 hours ago, adaptdesign said:

confused why its not an option in Chief.

likely because the standard of window labeling and ordering such as 3060 has been around for over a century and is the most common accepted practice uniformly across window mfr and drafting standard books being taught in international schools of building and design "Architectural Graphic Standards".
Major window manufacturers like Andersen, Pella, and Marvin have been using the "3050" or similar sizing conventions for decades. Their catalogs from as far back as the mid-1900s likely reference this system, showing the continuity of the practice.
I am personally pretty hard nosed about it, when asked to change it I simply say no, haha, not to be a jerk but it is an accepted standard from way back in the UBC days which predate the IBC and changing it invites liability.
All of your major window mfr will use this standard / or order from this standard and in terms of liability, I just wouldn't chance the confusion by introducing more complexity. An " or ' simple can easily be misread by someone that is expecting the standard to be written and simply not seeing your foot markers. 3'0 looks a lot like 30 at a quick glance when youre expecting a convention and you're working off a check set a 1/2 print scale or digitally on an ipad etc. Same goes for if you are exporting a dwg for an engineer.

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