0
0

More than 1 year has passed since last update.

石膏ボード(3×6)の必要枚数を計算する

Posted at

初めに

建設業界で働いていると図面から必要な建材の拾い出しを行わなければならない場面があります。

タイトルにある石膏ボードもその一つで、

必要な枚数を拾い出そうとすると、まあとにかく面倒くさい。

そこで普段電卓でしていることをそのままコードにしました。

それでは聞いてください。

code
#CHが1820に満たないとき
import math
def PB(ch,width):
    x = math.ceil(width /910)
    if ch <= 1820:
        num = 1820 // ch
        #PBの余りが足りないとき
        if num <= 1:
            PB_num = x
        elif num >= 2:
            PB_num = x / num
            
    elif ch > 1820:
        #余っている分を考える
        y = ch % 1820
        y_num = ch // 1820
        #下の数を考える
        PB_num = x * y_num
        
        #合計
        num = 1820 // y
        PB_num += math.ceil(x / num)
    return print(PB_num)

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0