Skip to content

Commit b1d4e76

Browse files
committed
extend makePipe and IShell definition
1 parent 3c673d8 commit b1d4e76

File tree

3 files changed

+63
-7
lines changed

3 files changed

+63
-7
lines changed

lib/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ export interface OCC {
278278
*
279279
* @param profile
280280
*/
281-
makePipe(spine: IWire, profile: IWire): ISolid;
281+
makePipe(spine: IWire, profile: IWire): IShell;
282+
makePipe(spine: IFace, profile: IWire): ISolid;
282283

283284
makeRevol(vertex: IVertex, axis: IAxisLike, angleDegree?: number): IEdge;
284285
makeRevol(edge: IEdge, axis: IAxisLike, angleDegree?: number): IFace;

test/debug_tools.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ISolid } from "..";
1+
import { IShell, ISolid } from "..";
22

33
const doDebug = true;
44
export function dumpSolid(b: ISolid) {
@@ -30,3 +30,31 @@ export function dumpSolid(b: ISolid) {
3030
);
3131
}
3232
}
33+
export function dumpShell(b: IShell) {
34+
if (doDebug) {
35+
console.log("num faces ", b.numFaces);
36+
console.log("num edges ", b.getEdges().length);
37+
console.log("num vertices ", b.getVertices().length);
38+
console.log(
39+
" faces = ",
40+
b
41+
.getFaces()
42+
.map((e) => b.getShapeName(e))
43+
.join(", ")
44+
);
45+
console.log(
46+
" edges = ",
47+
b
48+
.getEdges()
49+
.map((e) => b.getShapeName(e))
50+
.join(", ")
51+
);
52+
console.log(
53+
" vertices = ",
54+
b
55+
.getVertices()
56+
.map((e) => b.getShapeName(e))
57+
.join(", ")
58+
);
59+
}
60+
}

test/test_makePipe.ts

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
import should from "should";
22
import { Vertex, occ } from "..";
3+
import { dumpSolid, dumpShell } from "./debug_tools";
34
describe("makePipe", () => {
4-
it("should make a pipe from 2 circles", () => {
5-
const wire1 = occ.makeCircle([0, 0, 0], [0, 0, 1], 10);
5+
it("should make a pipe from a spine which is a wire (circle) and a profile line ", () => {
6+
const wire1 = occ.makeWire(occ.makeCircle([0, 0, 0], [0, 0, 1], 10));
67

7-
const spine = occ.makeLine([0, 0, 0], [0, 0, 10]);
8-
9-
/// const solid = occ.makePipe(spine, wire1);
8+
const spine = occ.makeInterpolatedCurve(
9+
[
10+
[0, 0, 0],
11+
[0, 6, 10],
12+
[0, 0, 20]
13+
],
14+
false,
15+
0.01
16+
);
17+
const wire = occ.makeWire(spine);
18+
const shell = occ.makePipe(wire, wire1);
19+
dumpShell(shell);
1020
});
21+
22+
// it("should make a pipe from a spine which is a Face and a profile line ", () => {
23+
24+
// const wire1 = occ.makeWire(occ.makeCircle([0, 0, 0], [0, 0, 1], 10));
25+
// const face = occ.makeFace(wire1);
26+
27+
// const spine = occ.makeWire(occ.makeInterpolatedCurve(
28+
// [
29+
// [0, 0, 0],
30+
// [0, 6, 10],
31+
// [0, 0, 20],
32+
33+
// ], false, 0.01));
34+
35+
// const solid = occ.makePipe(face, spine);
36+
// dumpSolid(solid);
37+
// });
1138
});

0 commit comments

Comments
 (0)