Some Useful Macros


RobDesLLC
 Share

Recommended Posts

I made a few macros that I've found useful and thought I'd share. I have %cadblockname%, which returns the name of the CAD block it references. I also have %lumberheight% and %lumberwidth%, which return the nominal dimensions of the CAD box they reference. I use "%lumberwidth%" X %lumberheight%" (CONT.)" to create a dynamic label for lumber sections (including 1x trim). I then use %description% built into Chief to create labels for polyline objects, which I use for things like plywood, concrete footings, rafters, etc. 

 

These have helped me to speed up sections and details for me. I hope they help you as well.

CADBlockName.json LumberHeight.json LumberWidth.json

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

  • 2 months later...
On 7/25/2023 at 5:02 PM, TCB_BdnMY said:

could you post up a visual example of this?

 

In the example section, the CADBlockName macro automatically names the label for the Simpson SDWF floor screw just by making the arrow touch the CAD block. The LumberHeight and LumberWidth macros automatically fill in the nominal lumber size in the 2x12 rim joist label. For example, changing the size of the cross box to 1"W and 16"H would change the label to "5/4X16" RIM JOIST".

Example Section 7.31.23.JPG

Link to comment
Share on other sites

20 hours ago, DRDesign said:

 

In the example section, the CADBlockName macro automatically names the label for the Simpson SDWF floor screw just by making the arrow touch the CAD block. The LumberHeight and LumberWidth macros automatically fill in the nominal lumber size in the 2x12 rim joist label. For example, changing the size of the cross box to 1"W and 16"H would change the label to "5/4X16" RIM JOIST".

Example Section 7.31.23.JPG

Interesting approach. Im curious about how this saves time for you? Making everything an individual CAD block is kindv'e cumbersome I would think. Maybe try the following code set to referenced.
It will give you variables based on pattern angle OR if 0 then pattern scale up until the pattern isoutside of those key amounts 1-10 angle and 1.1-1.5 scale.... as well as a custom variable that looks at visible length, assuming a polyline side length that is 20" which you can change and figures out what size lumber based on that assumption together with a scale of 10 which is what the wood pattern fills are set to
 

# Copyright Rabbitt Design 2023

# Check which object is being referenced
referenced ? obj = referenced : obj = owner

# Initialize variables
lumber_type = "#2 DF"
lumber_spacing = '16" O.C.'
polyline_side_length = 20

# Define pattern_angle labels
pattern_angle_labels = {
  1 => "your_variable_1",
  2 => "your_variable_2",
  3 => "your_variable_3",
  4 => "your_variable_4",
  5 => "your_variable_5",
  6 => "your_variable_6",
  7 => "your_variable_7",
  8 => "your_variable_8",
  9 => "your_variable_9",
  10 => "your_variable_10"
}

# Define custom_pattern_scale labels
custom_pattern_scale_labels = {
  1.1 => "your_scale_variable_1",
  1.2 => "your_scale_variable_2",
  1.3 => "your_scale_variable_3",
  1.4 => "your_scale_variable_4",
  1.5 => "your_scale_variable_5"
}

# Check for existence of pattern_angle and custom_pattern_scale
if obj.respond_to?(:pattern_angle) && obj.respond_to?(:custom_pattern_scale)
  # Determine cad_label based on pattern_angle or custom_pattern_scale
  if pattern_angle_labels.has_key?(pattern_angle)
    cad_label = pattern_angle_labels[pattern_angle]
  elsif custom_pattern_scale_labels.has_key?(custom_pattern_scale)
    cad_label = custom_pattern_scale_labels[custom_pattern_scale]
  end

  # Determine lumber_width based on visible_length
  visible_length_mod = visible_length.to_f - (polyline_side_length * 2)
  if visible_length_mod >= 0
    lumber_width_values = {7 => "2x4", 11 => "2x6", 15 => "2x8", 19 => "2x10", 23 => "2x12"}
    lumber_width = lumber_width_values[visible_length_mod.round(2).to_i]
  end

  # Set cad_label to include lumber_width, lumber_type, and lumber_spacing if custom_pattern_scale is 10
  if custom_pattern_scale == 10 && lumber_width
    cad_label = "#{lumber_width}\" #{lumber_type} #{lumber_spacing}"
  end

  # Add the extra double quote to the lumber_width part of cad_label
  cad_label.gsub!("2x", "2\"x") if cad_label && cad_label.include?("2x")

  # If there is no cad_label, and the object does not have a pattern angle or custom pattern scale
  if cad_label.nil?
    cad_label = "Please modify Pattern Scale Or Pattern Angle for automatic reporting"
  end
else
  cad_label = "Not connected to a Polyline"
end

cad_label


 

Link to comment
Share on other sites

21 hours ago, DRDesign said:

In the example section, the CADBlockName macro automatically names the label for the Simpson SDWF floor screw just by making the arrow touch the CAD block. The LumberHeight and LumberWidth macros automatically fill in the nominal lumber size in the 2x12 rim joist label. For example, changing the size of the cross box to 1"W and 16"H would change the label to "5/4X16" RIM JOIST".

i see there are dim lines, is that a live view with some add ons (flashing and everything outside the ribboard, Simpson, et al)? CAD Detail from view?

Link to comment
Share on other sites

On 8/1/2023 at 4:27 PM, Renerabbitt said:

Interesting approach. Im curious about how this saves time for you? Making everything an individual CAD block is kindv'e cumbersome I would think. Maybe try the following code set to referenced.
It will give you variables based on pattern angle OR if 0 then pattern scale up until the pattern isoutside of those key amounts 1-10 angle and 1.1-1.5 scale.... as well as a custom variable that looks at visible length, assuming a polyline side length that is 20" which you can change and figures out what size lumber based on that assumption together with a scale of 10 which is what the wood pattern fills are set to

 

 

I have been building a library of frequently used CAD block details and CAD block elements. My projects here often have unique/project-specific details with frequently used elements, so having labels that automatically populate is useful to me. I like your approach and I will try it out. I appreciate you sharing the code. Thank you.

Link to comment
Share on other sites

On 8/1/2023 at 5:52 PM, SHCanada2 said:

i see there are dim lines, is that a live view with some add ons (flashing and everything outside the ribboard, Simpson, et al)? CAD Detail from view?

 

I do not use live views for my sections and details. I use the "CAD detail from view" tool as a starting point when a new detail is required. 

Link to comment
Share on other sites

2 hours ago, DRDesign said:

 

I do not use live views for my sections and details. I use the "CAD detail from view" tool as a starting point when a new detail is required. 

That eliminates some automatic labeling of objects using their NVPs.  CAD Details are unfortunately without intelligence.

  • Upvote 1
Link to comment
Share on other sites

15 hours ago, Joe_Carrick said:

That eliminates some automatic labeling of objects using their NVPs.  CAD Details are unfortunately without intelligence.

i assume he cant get most of that(if any) from the live view, so by going to CAD, he ensures the items which vary by dimension are the correct dimension related to other things. A better man than I.

 

I leave my CAD details generic (I don't change the size of the lumber) and instead change the label, thereby minimizing the number of CAD details, but it also means my CAD details are not dimensionally correct related to each component, and they are NTS. That is the tradeoff which is acceptable for myself

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