Tuesday, November 28, 2023
Home3D ModelingI need assistance with aggregating (summing) grouped buildings

I need assistance with aggregating (summing) grouped buildings


class DetailInfo
attr_accessor :materials,:det_length, :det_width, :det_thick

def initialize(materials, det_length, det_width, det_thick)
@materials = materials
@det_length = det_length
@det_width = det_width
@det_thick = det_thick

finish
finish

particulars =[
DetailInfo .new(“Material1”, 760, 340, 18),
DetailInfo .new(“Material1”, 800, 200, 18),
DetailInfo .new(“Material1”, 760, 340, 4),
DetailInfo .new(“Material1”, 800, 200, 4),
DetailInfo .new(“Material2”, 400, 440, 16),
DetailInfo .new(“Material2”, 800, 200, 16),
]

grouped_details = particulars.group_by(&:materials)
grouped_details = particulars.group_by detailinfo
squares = grouped_details.map do |materials, det_length, det_width|
sq. = particulars.scale back(0) sum + detailinfo.det_length*detailinfo.det_width
#p sq.
#outcome[material]=sq.
#p outcome
{ materials: materials, sq: sq..spherical(3) }
finish

places squares

#—————————————————–
{:materials=>[“Material1”, 18], :sq=>1172800}
{:materials=>[“Material1”, 4], :sq=>1172800}
{:materials=>[“Material2”, 16], :sq=>1172800}

Why do all teams have the identical values?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments