You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/__test__/Polyline/offset_tool_sq.test.ts

24 lines
1.9 KiB

import { Polyline } from "../../src/DatabaseServices/Entity/Polyline";
import { PolylineJoinType } from "../../src/GraphicsSystem/OffsetPolyline";
import { LoadCurvesFromFileData } from "../Utils/LoadEntity.util";
import "../Utils/jest.util";
test('走刀 补直线', () =>
{
/**
* 因为中间圆裁剪后,线连接不起来了,提高连接的容差精度后就可以了
*/
let d =
{ "file": [1, "Polyline", 10, 2, 154, 0, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2601.0945127774107, 949.9743923671341, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 18, [4.547473508864641e-13, 1.1368683772161603e-13], 0, [-120.2931727439086, 22.053748336383364], 0, [-120.2931727439086, -166.85479437718436], 0, [-244.3936752564714, -190.2960004073351], 0, [-459.50121294491373, -543.2929853319582], 0, [-227.84694158812954, -517.0939903570838], -0.40210168311676253, [-316.096187819287, -701.8658496535651], 0, [-142.35548430169774, -701.8658496535662], 0, [-309.2017154574901, -868.7120808093316], 0, [-139.59769535697387, -914.2155983972847], 0, [257.5239126832266, -967.9924828193951], 0, [395.41335991940787, -592.9331863369833], 0, [613.2786865525736, -592.9331863369833], 0, [391.2766765023225, -256.48293508070196], 0, [376.1088373063426, -68.95328683949595], 0, [269.6684368006304, -49.43921341344867], -0.5459751344667229, [141.84056613947723, 1.061209382390416], -0.6541961494111228, [0, 0], 0, false], "basePt": { "x": 2141.593299832497, "y": -18.01809045226105, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let pl = LoadCurvesFromFileData(d)[0] as Polyline;
for (let dist of [3])
{
let cus = pl.GetFeedingToolPath(dist, 9 * 2.1, PolylineJoinType.Square);
expect(cus.length).toMatchSnapshot();
for (let c of cus)
expect(c.Length).toMatchNumberSnapshot();
}
});