Skip to content

Commit

Permalink
secBuildBox関数の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
st-func committed Feb 14, 2024
1 parent 0503243 commit 947cc72
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/functions/functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { secBuildH } from "./functions";
import { secBuildBox, secBuildH } from "./functions";

test("Build-BOX", () => {
expect(secBuildBox("A", 1000, 800, 19, 25)).toBeCloseTo(76100.0, 9);
expect(secBuildBox("ZY", 1000, 800, 19, 25)).toBeCloseTo(24446708.3333333, 7);
expect(secBuildBox("ZZ", 1000, 800, 19, 25)).toBeCloseTo(19098293.4166667, 7);
expect(secBuildBox("m", 1000, 800, 19, 25)).toBeCloseTo(597.385, 12);
expect(secBuildBox("iY", 1000, 800, 19, 25)).toBeCloseTo(400.777073164208, 12);
expect(secBuildBox("iZ", 1000, 800, 19, 25)).toBeCloseTo(316.836310923171, 12);
expect(secBuildBox("IY", 1000, 800, 19, 25)).toBeCloseTo(12223354166.6667, 4);
expect(secBuildBox("IZ", 1000, 800, 19, 25)).toBeCloseTo(7639317366.66666, 4);
});

test("ビルドH", () => {
expect(secBuildH("A", 1200, 400, 19, 25)).toBe(41850.0);
Expand Down
24 changes: 23 additions & 1 deletion src/functions/functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SecPropertyType, SecBuildH, Unit } from "@st-func/st-func-ts";
import { SecPropertyType, SecBuildBox, SecBuildH, Unit } from "@st-func/st-func-ts";
/**
* 文字列をenumのpropertyTypeに変換する
* @param propertyType 文字列の断面性能タイプ
Expand Down Expand Up @@ -49,6 +49,28 @@ function unitOfSecProperty(propertyType: SecPropertyType): string {
}
}

/**
* 組立角形鋼管の断面性能。
* @customfunction secBuildBox secBuildBox
* @param propertyType 表示したい断面性能のタイプ
* @param a 成 A
* @param b 幅 B
* @param t1 成方向の板厚 t1
* @param t2 幅方向の板厚 t2
* @returns 断面性能
*/
export function secBuildBox(propertyType: string, a: number, b: number, t1: number, t2: number): number {
let propertyTypeEnum = toSecPropertyType(propertyType);
let value = SecBuildBox.property(
propertyTypeEnum,
Unit.input(a, "mm"),
Unit.input(b, "mm"),
Unit.input(t1, "mm"),
Unit.input(t2, "mm")
);
return Unit.output(value, unitOfSecProperty(propertyTypeEnum));
}

/**
* 組立H形鋼の断面性能。
* @customfunction secBuildH secBuildH
Expand Down

0 comments on commit 947cc72

Please sign in to comment.