Skip to content

Commit a43f2c5

Browse files
switch to use MakePipe instead of MakePipeShell as it is more stable. New approach does not work well for sharp corners, but previous solution also did not work well for those situations. It's better to always provide rounded wires to this operation to succeed.
1 parent d503f52 commit a43f2c5

7 files changed

Lines changed: 219 additions & 119 deletions

File tree

packages/dev/occt/bitbybit-dev-occt/bitbybit-dev-occt.d.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ export declare class BRepFill_Filling {
2828
delete(): void;
2929
}
3030

31+
export declare type GeomFill_Trihedron = {
32+
GeomFill_IsCorrectedFrenet: {};
33+
GeomFill_IsFixed: {};
34+
GeomFill_IsFrenet: {};
35+
GeomFill_IsConstantNormal: {};
36+
GeomFill_IsDarboux: {};
37+
GeomFill_IsGuideAC: {};
38+
GeomFill_IsGuidePlan: {};
39+
GeomFill_IsGuideACWithContact: {};
40+
GeomFill_IsGuidePlanWithContact: {};
41+
GeomFill_IsDiscreteTrihedron: {};
42+
}
43+
3144
export declare class BRepMesh_DiscretRoot extends Standard_Transient {
3245
SetShape(theShape: TopoDS_Shape): void;
3346
Shape(): TopoDS_Shape;
@@ -1609,6 +1622,23 @@ export declare class GccEnt_QualifiedLin {
16091622
delete(): void;
16101623
}
16111624

1625+
export declare class BRepOffsetAPI_MakeEvolved extends BRepBuilderAPI_MakeShape {
1626+
Evolved(): BRepFill_Evolved;
1627+
Build(theRange: Message_ProgressRange): void;
1628+
GeneratedShapes(SpineShape: TopoDS_Shape, ProfShape: TopoDS_Shape): TopTools_ListOfShape;
1629+
Top(): TopoDS_Shape;
1630+
Bottom(): TopoDS_Shape;
1631+
delete(): void;
1632+
}
1633+
1634+
export declare class BRepOffsetAPI_MakeEvolved_1 extends BRepOffsetAPI_MakeEvolved {
1635+
constructor();
1636+
}
1637+
1638+
export declare class BRepOffsetAPI_MakeEvolved_2 extends BRepOffsetAPI_MakeEvolved {
1639+
constructor(theSpine: TopoDS_Shape, theProfile: TopoDS_Wire, theJoinType: GeomAbs_JoinType, theIsAxeProf: Standard_Boolean, theIsSolid: Standard_Boolean, theIsProfOnSpine: Standard_Boolean, theTol: Standard_Real, theIsVolume: Standard_Boolean, theRunInParallel: Standard_Boolean);
1640+
}
1641+
16121642
export declare class BRepOffsetAPI_MakePipeShell extends BRepPrimAPI_MakeSweep {
16131643
constructor(Spine: TopoDS_Wire)
16141644
SetMode_1(IsFrenet: Standard_Boolean): void;
@@ -1641,6 +1671,25 @@ export declare class BRepOffsetAPI_MakePipeShell extends BRepPrimAPI_MakeSweep {
16411671
delete(): void;
16421672
}
16431673

1674+
export declare class BRepOffsetAPI_MakePipe extends BRepPrimAPI_MakeSweep {
1675+
Pipe(): BRepFill_Pipe;
1676+
Build(theRange: Message_ProgressRange): void;
1677+
FirstShape(): TopoDS_Shape;
1678+
LastShape(): TopoDS_Shape;
1679+
Generated_1(S: TopoDS_Shape): TopTools_ListOfShape;
1680+
Generated_2(SSpine: TopoDS_Shape, SProfile: TopoDS_Shape): TopoDS_Shape;
1681+
ErrorOnSurface(): Standard_Real;
1682+
delete(): void;
1683+
}
1684+
1685+
export declare class BRepOffsetAPI_MakePipe_1 extends BRepOffsetAPI_MakePipe {
1686+
constructor(Spine: TopoDS_Wire, Profile: TopoDS_Shape);
1687+
}
1688+
1689+
export declare class BRepOffsetAPI_MakePipe_2 extends BRepOffsetAPI_MakePipe {
1690+
constructor(Spine: TopoDS_Wire, Profile: TopoDS_Shape, aMode: GeomFill_Trihedron, ForceApproxC1: Standard_Boolean);
1691+
}
1692+
16441693
export declare class BRepOffsetAPI_ThruSections extends BRepBuilderAPI_MakeShape {
16451694
constructor(isSolid: Standard_Boolean, ruled: Standard_Boolean, pres3d: Standard_Real)
16461695
Init(isSolid: Standard_Boolean, ruled: Standard_Boolean, pres3d: Standard_Real): void;
@@ -1697,6 +1746,24 @@ export declare class BRepOffsetAPI_MakeOffset extends BRepBuilderAPI_MakeShape {
16971746
constructor(Spine: TopoDS_Wire, Join: GeomAbs_JoinType, IsOpenResult: Standard_Boolean);
16981747
}
16991748

1749+
export declare class BRepOffsetAPI_MakeDraft extends BRepBuilderAPI_MakeShape {
1750+
constructor(Shape: TopoDS_Shape, Dir: gp_Dir, Angle: Standard_Real)
1751+
SetOptions(Style: BRepBuilderAPI_TransitionMode, AngleMin: Standard_Real, AngleMax: Standard_Real): void;
1752+
SetDraft(IsInternal: Standard_Boolean): void;
1753+
Perform_1(LengthMax: Standard_Real): void;
1754+
Perform_2(Surface: Handle_Geom_Surface, KeepInsideSurface: Standard_Boolean): void;
1755+
Perform_3(StopShape: TopoDS_Shape, KeepOutSide: Standard_Boolean): void;
1756+
Shell(): TopoDS_Shell;
1757+
Generated(S: TopoDS_Shape): TopTools_ListOfShape;
1758+
delete(): void;
1759+
}
1760+
1761+
export declare class BRepOffsetAPI_MiddlePath extends BRepBuilderAPI_MakeShape {
1762+
constructor(aShape: TopoDS_Shape, StartShape: TopoDS_Shape, EndShape: TopoDS_Shape)
1763+
Build(theRange: Message_ProgressRange): void;
1764+
delete(): void;
1765+
}
1766+
17001767
export declare class BRepOffsetAPI_MakeFilling extends BRepBuilderAPI_MakeShape {
17011768
constructor(Degree: Graphic3d_ZLayerId, NbPtsOnCur: Graphic3d_ZLayerId, NbIter: Graphic3d_ZLayerId, Anisotropie: Standard_Boolean, Tol2d: Standard_Real, Tol3d: Standard_Real, TolAng: Standard_Real, TolCurv: Standard_Real, MaxDeg: Graphic3d_ZLayerId, MaxSegments: Graphic3d_ZLayerId)
17021769
SetConstrParam(Tol2d: Standard_Real, Tol3d: Standard_Real, TolAng: Standard_Real, TolCurv: Standard_Real): void;
@@ -10406,6 +10473,7 @@ declare namespace FS {
1040610473
export type OpenCascadeInstance = {FS: typeof FS} & {
1040710474
BRepFill_TypeOfContact: BRepFill_TypeOfContact;
1040810475
BRepFill_Filling: typeof BRepFill_Filling;
10476+
GeomFill_Trihedron: GeomFill_Trihedron;
1040910477
BRepMesh_DiscretRoot: typeof BRepMesh_DiscretRoot;
1041010478
BRepMesh_IncrementalMesh: typeof BRepMesh_IncrementalMesh;
1041110479
BRepMesh_IncrementalMesh_1: typeof BRepMesh_IncrementalMesh_1;
@@ -10554,13 +10622,21 @@ export type OpenCascadeInstance = {FS: typeof FS} & {
1055410622
GccEnt_Array1OfPosition_5: typeof GccEnt_Array1OfPosition_5;
1055510623
GccEnt: typeof GccEnt;
1055610624
GccEnt_QualifiedLin: typeof GccEnt_QualifiedLin;
10625+
BRepOffsetAPI_MakeEvolved: typeof BRepOffsetAPI_MakeEvolved;
10626+
BRepOffsetAPI_MakeEvolved_1: typeof BRepOffsetAPI_MakeEvolved_1;
10627+
BRepOffsetAPI_MakeEvolved_2: typeof BRepOffsetAPI_MakeEvolved_2;
1055710628
BRepOffsetAPI_MakePipeShell: typeof BRepOffsetAPI_MakePipeShell;
10629+
BRepOffsetAPI_MakePipe: typeof BRepOffsetAPI_MakePipe;
10630+
BRepOffsetAPI_MakePipe_1: typeof BRepOffsetAPI_MakePipe_1;
10631+
BRepOffsetAPI_MakePipe_2: typeof BRepOffsetAPI_MakePipe_2;
1055810632
BRepOffsetAPI_ThruSections: typeof BRepOffsetAPI_ThruSections;
1055910633
BRepOffsetAPI_MakeThickSolid: typeof BRepOffsetAPI_MakeThickSolid;
1056010634
BRepOffsetAPI_MakeOffset: typeof BRepOffsetAPI_MakeOffset;
1056110635
BRepOffsetAPI_MakeOffset_1: typeof BRepOffsetAPI_MakeOffset_1;
1056210636
BRepOffsetAPI_MakeOffset_2: typeof BRepOffsetAPI_MakeOffset_2;
1056310637
BRepOffsetAPI_MakeOffset_3: typeof BRepOffsetAPI_MakeOffset_3;
10638+
BRepOffsetAPI_MakeDraft: typeof BRepOffsetAPI_MakeDraft;
10639+
BRepOffsetAPI_MiddlePath: typeof BRepOffsetAPI_MiddlePath;
1056410640
BRepOffsetAPI_MakeFilling: typeof BRepOffsetAPI_MakeFilling;
1056510641
BRepOffsetAPI_MakeOffsetShape: typeof BRepOffsetAPI_MakeOffsetShape;
1056610642
ChFiDS_ChamfMode: ChFiDS_ChamfMode;
60.5 KB
Binary file not shown.

packages/dev/occt/bitbybit-dev-occt/bitbybit-dev-occt.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@
9393
- symbol: BRepLib
9494
- symbol: BRepMesh_DiscretRoot
9595
- symbol: BRepMesh_IncrementalMesh
96+
- symbol: BRepOffsetAPI_MakeDraft
97+
- symbol: BRepOffsetAPI_MakeEvolved
9698
- symbol: BRepOffsetAPI_MakeFilling
9799
- symbol: BRepOffsetAPI_MakeOffset
98100
- symbol: BRepOffsetAPI_MakeOffsetShape
101+
- symbol: BRepOffsetAPI_MakePipe
99102
- symbol: BRepOffsetAPI_MakePipeShell
100103
- symbol: BRepOffsetAPI_MakeThickSolid
104+
- symbol: BRepOffsetAPI_MiddlePath
101105
- symbol: BRepOffsetAPI_ThruSections
102106
- symbol: BRepOffset_Mode
103107
- symbol: BRepPrimAPI_MakeBox
@@ -194,6 +198,7 @@
194198
- symbol: GeomAPI_ProjectPointOnCurve
195199
- symbol: GeomAbs_JoinType
196200
- symbol: GeomAbs_Shape
201+
- symbol: GeomFill_Trihedron
197202
- symbol: GeomLProp_SLProps
198203
- symbol: GeomLib
199204
- symbol: GeomPlate_BuildPlateSurface

packages/dev/occt/generate-prod-build-yaml.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ async function start() {
269269
"BRepPrimAPI_MakeTorus",
270270
"BRepPrimAPI_MakeRevolution",
271271
"BRepOffsetAPI_MakeFilling",
272+
"BRepOffsetAPI_MakePipe",
273+
"BRepOffsetAPI_MiddlePath",
274+
"BRepOffsetAPI_MakeDraft",
275+
"BRepOffsetAPI_MakeEvolved",
272276
"BRepClass3d_SolidClassifier",
273277
"BRepClass3d_SClassifier",
274278
"BRepClass3d_SolidExplorer",
@@ -344,6 +348,7 @@ async function start() {
344348
"BRepBuilderAPI_MakeEdge",
345349
"Geom_Curve",
346350
"Geom_Geometry",
351+
"GeomFill_Trihedron",
347352
"Handle_Geom_Curve",
348353
"BRepBuilderAPI_MakeWire",
349354
"TopoDS_Edge",

packages/dev/occt/lib/api/inputs/occ-inputs.ts

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@ export namespace OCCT {
116116
furthest = "furthest",
117117
closestAndFurthest = "closestAndFurthest",
118118
}
119+
export enum geomFillTrihedronEnum {
120+
isCorrectedFrenet = "isCorrectedFrenet",
121+
isFixed = "isFixed",
122+
isFrenet = "isFrenet",
123+
isConstantNormal = "isConstantNormal",
124+
isDarboux = "isDarboux",
125+
isGuideAC = "isGuideAC",
126+
isGuidePlan = "isGuidePlan",
127+
isGuideACWithContact = "isGuideACWithContact",
128+
isGuidePlanWithContact = "isGuidePlanWithContact",
129+
isDiscreteTrihedron = "isDiscreteTrihedron",
130+
131+
}
119132
export class DecomposedMeshDto {
120133
constructor(faceList?: DecomposedFaceDto[], edgeList?: DecomposedEdgeDto[]) {
121134
if (faceList !== undefined) { this.faceList = faceList; }
@@ -3581,11 +3594,12 @@ export namespace OCCT {
35813594
face: U;
35823595
}
35833596
export class PipeWiresCylindricalDto<T> {
3584-
constructor(shapes?: T[], radius?: number, withContact?: boolean, withCorrection?: boolean) {
3597+
constructor(shapes?: T[], radius?: number, makeSolid?: boolean, trihedronEnum?: geomFillTrihedronEnum, forceApproxC1?: boolean) {
35853598
if (shapes !== undefined) { this.shapes = shapes; }
35863599
if (radius !== undefined) { this.radius = radius; }
3587-
if (withContact !== undefined) { this.withContact = withContact; }
3588-
if (withCorrection !== undefined) { this.withCorrection; }
3600+
if (makeSolid !== undefined) { this.makeSolid = makeSolid; }
3601+
if (trihedronEnum !== undefined) { this.trihedronEnum = trihedronEnum; }
3602+
if (forceApproxC1 !== undefined) { this.forceApproxC1 = forceApproxC1; }
35893603
}
35903604
/**
35913605
* Wire paths to pipe
@@ -3601,22 +3615,28 @@ export namespace OCCT {
36013615
*/
36023616
radius = 0.1;
36033617
/**
3604-
* If withContact is true, the section is translated to be in contact with the spine.
3605-
* @default false
3618+
* Make solid result by closing start and end parts
3619+
* @default true
36063620
*/
3607-
withContact = false;
3621+
makeSolid = true;
3622+
/**
3623+
* Goemetry Fill Trihedron Options
3624+
* @default isConstantNormal
3625+
*/
3626+
trihedronEnum = geomFillTrihedronEnum.isConstantNormal;
36083627
/**
3609-
* If withCorrection is true, the section is rotated to be orthogonal to the spine's tangent in the correspondent point.
3628+
* Attempt to approximate a C1-continuous surface if a swept surface proved to be C0
36103629
* @default false
36113630
*/
3612-
withCorrection = false;
3631+
forceApproxC1 = false;
36133632
}
36143633
export class PipeWireCylindricalDto<T> {
3615-
constructor(shape?: T, radius?: number, withContact?: boolean, withCorrection?: boolean) {
3634+
constructor(shape?: T, radius?: number, makeSolid?: boolean, trihedronEnum?: geomFillTrihedronEnum, forceApproxC1?: boolean) {
36163635
if (shape !== undefined) { this.shape = shape; }
36173636
if (radius !== undefined) { this.radius = radius; }
3618-
if (withContact !== undefined) { this.withContact = withContact; }
3619-
if (withCorrection !== undefined) { this.withCorrection; }
3637+
if (makeSolid !== undefined) { this.makeSolid = makeSolid; }
3638+
if (trihedronEnum !== undefined) { this.trihedronEnum = trihedronEnum; }
3639+
if (forceApproxC1 !== undefined) { this.forceApproxC1 = forceApproxC1; }
36203640
}
36213641
/**
36223642
* Wire path to pipe
@@ -3632,23 +3652,29 @@ export namespace OCCT {
36323652
*/
36333653
radius = 0.1;
36343654
/**
3635-
* If withContact is true, the section is translated to be in contact with the spine.
3636-
* @default false
3655+
* Make solid result by closing start and end parts
3656+
* @default true
36373657
*/
3638-
withContact = false;
3658+
makeSolid = true;
36393659
/**
3640-
* If withCorrection is true, the section is rotated to be orthogonal to the spine's tangent in the correspondent point.
3660+
* Goemetry Fill Trihedron Options
3661+
* @default isConstantNormal
3662+
*/
3663+
trihedronEnum = geomFillTrihedronEnum.isConstantNormal;
3664+
/**
3665+
* Attempt to approximate a C1-continuous surface if a swept surface proved to be C0
36413666
* @default false
36423667
*/
3643-
withCorrection = false;
3668+
forceApproxC1 = false;
36443669
}
36453670
export class PipePolygonWireNGonDto<T> {
3646-
constructor(shapes?: T, radius?: number, nrCorners?: number, withContact?: boolean, withCorrection?: boolean) {
3671+
constructor(shapes?: T, radius?: number, nrCorners?: number, makeSolid?: boolean, trihedronEnum?: geomFillTrihedronEnum, forceApproxC1?: boolean) {
36473672
if (shapes !== undefined) { this.shape = shapes; }
36483673
if (radius !== undefined) { this.radius = radius; }
36493674
if (nrCorners !== undefined) { this.nrCorners = nrCorners; }
3650-
if (withContact !== undefined) { this.withContact = withContact; }
3651-
if (withCorrection !== undefined) { this.withCorrection; }
3675+
if (makeSolid !== undefined) { this.makeSolid = makeSolid; }
3676+
if (trihedronEnum !== undefined) { this.trihedronEnum = trihedronEnum; }
3677+
if (forceApproxC1 !== undefined) { this.forceApproxC1 = forceApproxC1; }
36523678
}
36533679
/**
36543680
* Wire path to pipe
@@ -3672,15 +3698,20 @@ export namespace OCCT {
36723698
*/
36733699
nrCorners = 6;
36743700
/**
3675-
* If withContact is true, the section is translated to be in contact with the spine.
3676-
* @default false
3701+
* Make solid result by closing start and end parts
3702+
* @default true
3703+
*/
3704+
makeSolid = true;
3705+
/**
3706+
* Goemetry Fill Trihedron Options
3707+
* @default isConstantNormal
36773708
*/
3678-
withContact = false;
3709+
trihedronEnum = geomFillTrihedronEnum.isConstantNormal;
36793710
/**
3680-
* If withCorrection is true, the section is rotated to be orthogonal to the spine's tangent in the correspondent point.
3711+
* Attempt to approximate a C1-continuous surface if a swept surface proved to be C0
36813712
* @default false
36823713
*/
3683-
withCorrection = false;
3714+
forceApproxC1 = false;
36843715
}
36853716
export class ExtrudeDto<T> {
36863717
constructor(shape?: T, direction?: Base.Vector3) {

packages/dev/occt/lib/services/base/enum.service.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
GccEnt_Position, OpenCascadeInstance, TopAbs_State, TopoDS_Shape
2+
GccEnt_Position, GeomFill_Trihedron, OpenCascadeInstance, TopAbs_State, TopoDS_Shape
33
} from "../../../bitbybit-dev-occt/bitbybit-dev-occt";
44
import * as Inputs from "../../api/inputs/inputs";
55

@@ -81,4 +81,30 @@ export class EnumService {
8181
}
8282
}
8383

84+
getGeomFillTrihedronEnumOCCTValue(value: Inputs.OCCT.geomFillTrihedronEnum): GeomFill_Trihedron {
85+
if (value === Inputs.OCCT.geomFillTrihedronEnum.isConstantNormal) {
86+
return this.occ.GeomFill_Trihedron.GeomFill_IsConstantNormal as GeomFill_Trihedron;
87+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isCorrectedFrenet) {
88+
return this.occ.GeomFill_Trihedron.GeomFill_IsCorrectedFrenet as GeomFill_Trihedron;
89+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isDarboux) {
90+
return this.occ.GeomFill_Trihedron.GeomFill_IsDarboux as GeomFill_Trihedron;
91+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isDiscreteTrihedron) {
92+
return this.occ.GeomFill_Trihedron.GeomFill_IsDiscreteTrihedron as GeomFill_Trihedron;
93+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isFixed) {
94+
return this.occ.GeomFill_Trihedron.GeomFill_IsFixed as GeomFill_Trihedron;
95+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isFrenet) {
96+
return this.occ.GeomFill_Trihedron.GeomFill_IsFrenet as GeomFill_Trihedron;
97+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isGuideAC) {
98+
return this.occ.GeomFill_Trihedron.GeomFill_IsGuideAC as GeomFill_Trihedron;
99+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isGuideACWithContact) {
100+
return this.occ.GeomFill_Trihedron.GeomFill_IsGuideACWithContact as GeomFill_Trihedron;
101+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isGuidePlan) {
102+
return this.occ.GeomFill_Trihedron.GeomFill_IsGuidePlan as GeomFill_Trihedron;
103+
} else if (value === Inputs.OCCT.geomFillTrihedronEnum.isGuidePlanWithContact) {
104+
return this.occ.GeomFill_Trihedron.GeomFill_IsGuidePlanWithContact as GeomFill_Trihedron;
105+
} else {
106+
return this.occ.GeomFill_Trihedron.GeomFill_IsConstantNormal as GeomFill_Trihedron;
107+
}
108+
}
109+
84110
}

0 commit comments

Comments
 (0)