Edge counting in the same material, similar to FredoTools Report Area with surfaces

Hi,
I’m just starting my adventure with sketchup extensions.
I am looking for a method or extension that will generate a report where all edges will be summed up by their color / material.
Just like the FredoTools Report Area does with surfaces.

For example:
I have a 3x6m rectangle in my project, 2 edges are colored red / or pattern1 and the next 2 edges are in the default sketchup color. I need a report like:

Pattern 1 = 6m (sum of 2 edges in pattern1)
Texture (will fill an area of 3x6m) = 18m2

Is there any edge extension ready? or what functions in ruby is best to use?

Thank you very much for all the hints.

This is my very first imagined - quick and dirty - snippets, will print out to the Ruby Console the selected Edges length by its material: (The length will be formatted according to current settings in Model Info>Units)
The nested edges, which are in components or group will not be considered, however you can go into its editing context and select there all.
Also, area of faces is not counted here…

Usage:
Select part of or all content of your model, in which you have an edges
Copy and paste the code below to Ruby Console, and Hit Return (Enter):

def count_edge_len_by_mat
  model = Sketchup.active_model
  sel = model.selection
  edges = sel.grep(Sketchup::Edge)
  return "Please Select edges" unless edges.first
  edge_colors_len = {}
  edges.each{|e|
    mat = e.material || "the default sketchup color"
    if edge_colors_len[mat]
      edge_colors_len[mat] += e.length
    else
      edge_colors_len[mat] = e.length
    end
  }
  puts ""
  puts "Edges length by its material (color):"
  edge_colors_len.each{|k,v|
    m_name = k == "the default sketchup color" ? k : k.display_name
    puts "#{m_name}:  #{Sketchup.format_length(v)}"
  }
  nil
end
count_edge_len_by_mat

edgelenmat

1 Like

BTW.
I don’t use it, so I’m not sure if it may be exaggerating the current task you described, but it might be worth checking:
https://extensions.sketchup.com/extension/00f0bf69-7a42-4295-9e1c-226080814e3e/open-cut-list

Probably should reassign this topic to the Ruby category.

The solution can be even more complex if any scaled geometry is involved.

It is great ! Generally, I need to create a plugin that will report to me the area by material and m2 and the length by color / material in the current m. There is also an export of all to csv.
Generally, in the plug-in window I would have to have a list, for example:

  • material1 | color | - 150m2
  • material2 | color | - 62m2
  • line material | I would like to choose a color from the list | - 32 running meters

I would like to choose the color of the line from the list that appears, because what I draw in the skp is the development of the space on the plot.
For clarity. For example, I have to count how much a curb is needed to separate the plantings. and for example I have 30m marked in blue which represents it. But I sell curbs with colors such as gray / black / red, etc. I would like to choose this color from the list.
Because it would be cumbersome to prepare 100 colors for the versions it sells.

My guess is that I need some dictionary / base in the plugin for the list.
Of course, I sell, for example, curbs, which I will always mark in blue. In addition, palisades that I will always have green, etc. etc.

Long way to create it, if anyone would be willing to create something like this, please offer.

good thought thank you