-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BrickWallCostEstimate] - Cost and quantity estimate of all BIM objects with IFC Type='Wall' #65
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__Name__ = 'CostEstimate' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
__Comment__ = 'Estimates brick, cement, sand cost of all objects that have IFCRole=Wall' | ||
__Author__ = 'haseeb' | ||
__Version__ = '0.1' | ||
__Date__ = '2019-6-24' | ||
__License__ = 'LGPL-3.0-or-later' | ||
__Web__ = '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a forum link? |
||
__Wiki__ = '' | ||
__Icon__ = '' | ||
__Help__ = '' | ||
__Status__ = 'Alpha' | ||
__Requires__ = 'FreeCAD >= v0.17' | ||
__Communication__ = '' | ||
__Files__ = '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
import FreeCAD, math | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use import Please organize your import (standard lib, then system libs then "project libs"), one per line. |
||
import numpy as np | ||
|
||
class WallEstimator: | ||
''' | ||
All units are in mm | ||
''' | ||
def __init__(self): | ||
self.Length = 0 | ||
self.Width = 0 | ||
self.Height = 0 | ||
self.Volume = 0 | ||
self.num_bricks = 0 | ||
self.brick_cost = 0 | ||
self.dry_vol_sand = 0 | ||
self.sand_small_trolley = 0 | ||
self.sand_large_trolley = 0 | ||
self.sand_truck = 0 | ||
self.sand_big_truck = 0 | ||
self.sand_seenkara = 0 | ||
self.num_cement = 0 | ||
|
||
def wall_cost_estimate(self, obj, brick_unit_cost=12 ,debug=False): | ||
''' | ||
Function to estimate cost of a wall | ||
''' | ||
# Make it static | ||
volume_of_wall = obj.Shape.Volume | ||
volume_of_brick = 9.375*4.875*3.375*25.4**3 # in mm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain these numbers. |
||
|
||
num_bricks = math.ceil(volume_of_wall/volume_of_brick) | ||
losses = 5/100 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A dialog would render these parameters accessible... |
||
brick_cost = (num_bricks + num_bricks*losses)* brick_unit_cost | ||
|
||
actual_vol_brick = 9*4.5*3*25.4**3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain these numbers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nominal dimension of brick in inches. |
||
|
||
vol_mortar = volume_of_wall - num_bricks*actual_vol_brick | ||
#print(volume_of_wall/10**6, volume_of_brick*num_bricks/10**6,vol_mortar/10**6) | ||
dry_vol_mortar = 1.54*vol_mortar | ||
vol_cement = vol_mortar * 1/5 | ||
vol_sand = vol_mortar * 4/5 | ||
|
||
dry_vol_sand = vol_sand*1.333 | ||
|
||
cement_bag = 1.25*(12*25.4)**3 | ||
num_cement = vol_cement/cement_bag | ||
|
||
# setting up units | ||
small_trolley = 75*(12*25.4)**3 | ||
large_trolley = 325*(12*25.4)**3 | ||
# This unit is used in India/Pakistan | ||
seenkara = 100*(12*25.4)**3 | ||
truck = 5.5*seenkara | ||
big_truck = 12*seenkara | ||
|
||
sand_truck = dry_vol_sand/truck | ||
sand_big_truck = dry_vol_sand/truck | ||
sand_small_trolley = dry_vol_sand/small_trolley | ||
sand_large_trolley =dry_vol_sand/large_trolley | ||
sand_seenkara =dry_vol_sand/seenkara | ||
|
||
self.num_bricks += num_bricks | ||
self.brick_cost += brick_cost | ||
self.dry_vol_sand += dry_vol_sand | ||
self.sand_small_trolley += sand_small_trolley | ||
self.sand_large_trolley += sand_large_trolley | ||
self.sand_truck += sand_truck | ||
self.sand_big_truck += sand_big_truck | ||
self.sand_seenkara += sand_seenkara | ||
self.num_cement += num_cement | ||
self.Length += obj.Shape.Length | ||
self.Volume += obj.Shape.Volume | ||
|
||
def all_wall_estimate(self): | ||
''' | ||
Function to estimate cost of all walls | ||
''' | ||
for obj in FreeCAD.ActiveDocument.Objects: | ||
try: | ||
if obj.IfcRole == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
elif obj.IfcType == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
except AttributeError: | ||
pass | ||
|
||
return vars(self) | ||
|
||
def selected_wall_estimate(self): | ||
''' | ||
Function to estimate cost of selected walls | ||
Don't use the same object twice with this method | ||
''' | ||
for obj in FreeCADGui.Selection.getSelection(): | ||
try: | ||
if obj.IfcRole == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
elif obj.IfcType == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
except AttributeError: | ||
pass | ||
|
||
return vars(self) | ||
|
||
def pretty_all_wall_estimate(self): | ||
''' | ||
Function to estimate cost of all walls and prints it in a readable format | ||
''' | ||
for obj in FreeCAD.ActiveDocument.Objects: | ||
try: | ||
if obj.IfcRole == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
elif obj.IfcType == 'Wall': | ||
self.wall_cost_estimate(obj) | ||
except AttributeError: | ||
pass | ||
|
||
print('Number of Bricks :', self.num_bricks) | ||
print('Cement Bags: ', self.num_cement) | ||
print('Volume of Sand (cu ft):', self.dry_vol_sand*(10**-3*3.28)**3, 'cubic feet') | ||
|
||
|
||
WallEstimator().pretty_all_wall_estimate() | ||
|
||
# Use this for cost estimation of a particular wall | ||
#WallEstimator().selected_wall_estimate() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improvement suggestion: make this line available by non-hackers by adding a dialog. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Description | ||
Calculates brick, cement and sand cost of objects with IFCType or IFCRole = 'Wall' | ||
|
||
# Usage: | ||
The default function estimates the cost all Wall objects in the current document | ||
|
||
# Screenshot | ||
![](https://raw.githubusercontent.com/QuantumNovice/FreeCAD-macros/master/Cost%20Estimation/BrickWallEstimate.PNG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the macro into the
Information
folder