Skip to content

Commit 4b84a4b

Browse files
Merge pull request #48 from bitbybit-dev/develop
v0.15.13
2 parents 5a45f42 + 877699f commit 4b84a4b

File tree

9 files changed

+126
-15
lines changed

9 files changed

+126
-15
lines changed

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,52 @@ export declare class TColStd_Array1OfInteger {
38153815
constructor(theBegin: Standard_Integer, theLower: Standard_Integer, theUpper: Standard_Integer);
38163816
}
38173817

3818+
export declare class TColStd_Array1OfReal {
3819+
begin(): any;
3820+
end(): any;
3821+
cbegin(): any;
3822+
cend(): any;
3823+
Init(theValue: Standard_Real): void;
3824+
Size(): Standard_Integer;
3825+
Length(): Standard_Integer;
3826+
IsEmpty(): Standard_Boolean;
3827+
Lower(): Standard_Integer;
3828+
Upper(): Standard_Integer;
3829+
IsDeletable(): Standard_Boolean;
3830+
IsAllocated(): Standard_Boolean;
3831+
Assign(theOther: TColStd_Array1OfReal): TColStd_Array1OfReal;
3832+
Move(theOther: TColStd_Array1OfReal): TColStd_Array1OfReal;
3833+
First(): Standard_Real;
3834+
ChangeFirst(): Standard_Real;
3835+
Last(): Standard_Real;
3836+
ChangeLast(): Standard_Real;
3837+
Value(theIndex: Standard_Integer): Standard_Real;
3838+
ChangeValue(theIndex: Standard_Integer): Standard_Real;
3839+
SetValue(theIndex: Standard_Integer, theItem: Standard_Real): void;
3840+
Resize(theLower: Standard_Integer, theUpper: Standard_Integer, theToCopyData: Standard_Boolean): void;
3841+
delete(): void;
3842+
}
3843+
3844+
export declare class TColStd_Array1OfReal_1 extends TColStd_Array1OfReal {
3845+
constructor();
3846+
}
3847+
3848+
export declare class TColStd_Array1OfReal_2 extends TColStd_Array1OfReal {
3849+
constructor(theLower: Standard_Integer, theUpper: Standard_Integer);
3850+
}
3851+
3852+
export declare class TColStd_Array1OfReal_3 extends TColStd_Array1OfReal {
3853+
constructor(theOther: TColStd_Array1OfReal);
3854+
}
3855+
3856+
export declare class TColStd_Array1OfReal_4 extends TColStd_Array1OfReal {
3857+
constructor(theOther: TColStd_Array1OfReal);
3858+
}
3859+
3860+
export declare class TColStd_Array1OfReal_5 extends TColStd_Array1OfReal {
3861+
constructor(theBegin: Standard_Real, theLower: Standard_Integer, theUpper: Standard_Integer);
3862+
}
3863+
38183864
export declare class TColStd_IndexedDataMapOfStringString extends NCollection_BaseMap {
38193865
begin(): any;
38203866
end(): any;
@@ -10256,6 +10302,12 @@ export type OpenCascadeInstance = {FS: typeof FS} & {
1025610302
TColStd_Array1OfInteger_3: typeof TColStd_Array1OfInteger_3;
1025710303
TColStd_Array1OfInteger_4: typeof TColStd_Array1OfInteger_4;
1025810304
TColStd_Array1OfInteger_5: typeof TColStd_Array1OfInteger_5;
10305+
TColStd_Array1OfReal: typeof TColStd_Array1OfReal;
10306+
TColStd_Array1OfReal_1: typeof TColStd_Array1OfReal_1;
10307+
TColStd_Array1OfReal_2: typeof TColStd_Array1OfReal_2;
10308+
TColStd_Array1OfReal_3: typeof TColStd_Array1OfReal_3;
10309+
TColStd_Array1OfReal_4: typeof TColStd_Array1OfReal_4;
10310+
TColStd_Array1OfReal_5: typeof TColStd_Array1OfReal_5;
1025910311
TColStd_IndexedDataMapOfStringString: typeof TColStd_IndexedDataMapOfStringString;
1026010312
TColStd_IndexedDataMapOfStringString_1: typeof TColStd_IndexedDataMapOfStringString_1;
1026110313
TColStd_IndexedDataMapOfStringString_2: typeof TColStd_IndexedDataMapOfStringString_2;
9.56 KB
Binary file not shown.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
- symbol: StlAPI_Writer
258258
- symbol: TColStd_Array1OfBoolean
259259
- symbol: TColStd_Array1OfInteger
260+
- symbol: TColStd_Array1OfReal
260261
- symbol: TColStd_IndexedDataMapOfStringString
261262
- symbol: TColgp_Array1OfDir
262263
- symbol: TColgp_Array1OfPnt

generate-prod-build-yaml.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ async function start() {
142142
"TColgp_Array1OfPnt2d",
143143
"TColgp_Array2OfPnt",
144144
"TColStd_Array1OfBoolean",
145+
"TColStd_Array1OfReal",
145146
"TColgp_Array1OfVec",
146147
"TColStd_Array1OfInteger",
147148
"Precision",

lib/api/inputs/occ-inputs.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export namespace OCCT {
361361
*/
362362
radius = 0.3;
363363
}
364-
export class CurveAndSurfaceDto<T, U>{
364+
export class CurveAndSurfaceDto<T, U> {
365365
constructor(curve?: T, surface?: U) {
366366
if (curve !== undefined) { this.curve = curve; }
367367
if (surface !== undefined) { this.surface = surface; }
@@ -437,7 +437,7 @@ export namespace OCCT {
437437
*/
438438
points: Base.Point3[];
439439
}
440-
export class SplitWireOnPointsDto<T>{
440+
export class SplitWireOnPointsDto<T> {
441441
constructor(shape?: T, points?: Base.Point3[]) {
442442
if (shape !== undefined) { this.shape = shape; }
443443
if (points !== undefined) { this.points = points; }
@@ -2408,6 +2408,28 @@ export namespace OCCT {
24082408
*/
24092409
closed = false;
24102410
}
2411+
export class BezierWeightsDto {
2412+
constructor(points?: Base.Point3[], weights?: number[], closed?: boolean) {
2413+
if (points !== undefined) { this.points = points; }
2414+
if (weights !== undefined) { this.weights = weights; }
2415+
if (closed !== undefined) { this.closed = closed; }
2416+
}
2417+
/**
2418+
* Points through which the Bezier curve will be created
2419+
* @default undefined
2420+
*/
2421+
points: Base.Point3[];
2422+
/**
2423+
* Weights for beziers that will be used, values should be between 0 and 1
2424+
* @default undefined
2425+
*/
2426+
weights: number[];
2427+
/**
2428+
* Indicates wether Bezier will be cloed
2429+
* @default false
2430+
*/
2431+
closed = false;
2432+
}
24112433
export class BezierWiresDto {
24122434
constructor(bezierWires?: BezierDto[], returnCompound?: boolean) {
24132435
if (bezierWires !== undefined) { this.bezierWires = bezierWires; }
@@ -3181,7 +3203,7 @@ export namespace OCCT {
31813203
*/
31823204
otherShape: T;
31833205
}
3184-
export class FixSmallEdgesInWireDto<T>{
3206+
export class FixSmallEdgesInWireDto<T> {
31853207
constructor(shape?: T, lockvtx?: boolean, precsmall?: number) {
31863208
if (shape !== undefined) { this.shape = shape; }
31873209
if (lockvtx !== undefined) { this.lockvtx = lockvtx; }
@@ -3248,7 +3270,7 @@ export namespace OCCT {
32483270
*/
32493271
minTolerance = 0.0001;
32503272
}
3251-
export class FixClosedDto<T>{
3273+
export class FixClosedDto<T> {
32523274
constructor(shape?: T, precision?: number) {
32533275
if (shape !== undefined) { this.shape = shape; }
32543276
if (precision !== undefined) { this.precision = precision; }
@@ -3540,7 +3562,7 @@ export namespace OCCT {
35403562
translations: Base.Vector3[] = [[0, 0, 0]];
35413563
}
35423564

3543-
export class AlignDto<T>{
3565+
export class AlignDto<T> {
35443566
constructor(shape?: T, fromOrigin?: Base.Point3, fromDirection?: Base.Vector3, toOrigin?: Base.Point3, toDirection?: Base.Vector3) {
35453567
if (shape !== undefined) { this.shape = shape; }
35463568
if (fromOrigin !== undefined) { this.fromOrigin = fromOrigin; }
@@ -3697,7 +3719,7 @@ export namespace OCCT {
36973719
*/
36983720
normals: Base.Vector3[] = [[0, 0, 1]];
36993721
}
3700-
export class AlignAndTranslateDto<T>{
3722+
export class AlignAndTranslateDto<T> {
37013723
constructor(shape?: T, direction?: Base.Vector3, center?: Base.Vector3) {
37023724
if (shape !== undefined) { this.shape = shape; }
37033725
if (direction !== undefined) { this.direction = direction; }
@@ -3746,7 +3768,7 @@ export namespace OCCT {
37463768
*/
37473769
concatBSplines = true;
37483770
}
3749-
export class FilterFacePointsDto<T>{
3771+
export class FilterFacePointsDto<T> {
37503772
constructor(shape?: T, points?: Base.Point3[], tolerance?: number, useBndBox?: boolean, gapTolerance?: number, keepIn?: boolean, keepOn?: boolean, keepOut?: boolean, keepUnknown?: boolean) {
37513773
if (shape !== undefined) { this.shape = shape; }
37523774
if (points !== undefined) { this.points = points; }
@@ -3812,7 +3834,7 @@ export namespace OCCT {
38123834
*/
38133835
keepUnknown = false;
38143836
}
3815-
export class FilterSolidPointsDto<T>{
3837+
export class FilterSolidPointsDto<T> {
38163838
constructor(shape?: T, points?: Base.Point3[], tolerance?: number, keepIn?: boolean, keepOn?: boolean, keepOut?: boolean, keepUnknown?: boolean) {
38173839
if (shape !== undefined) { this.shape = shape; }
38183840
if (points !== undefined) { this.points = points; }
@@ -3861,7 +3883,7 @@ export namespace OCCT {
38613883
*/
38623884
keepUnknown = false;
38633885
}
3864-
export class AlignAndTranslateShapesDto<T>{
3886+
export class AlignAndTranslateShapesDto<T> {
38653887
constructor(shapes?: T[], directions?: Base.Vector3[], centers?: Base.Vector3[]) {
38663888
if (shapes !== undefined) { this.shapes = shapes; }
38673889
if (directions !== undefined) { this.directions = directions; }
@@ -4064,7 +4086,7 @@ export namespace OCCT {
40644086
*/
40654087
centers: Base.Point3[] = [[0, 0, 0]];
40664088
}
4067-
export class ShapeToMeshDto<T>{
4089+
export class ShapeToMeshDto<T> {
40684090
constructor(shape?: T, precision?: number, adjustYtoZ?: boolean) {
40694091
if (shape !== undefined) { this.shape = shape; }
40704092
if (precision !== undefined) { this.precision = precision; }
@@ -4089,7 +4111,7 @@ export namespace OCCT {
40894111
*/
40904112
adjustYtoZ = false;
40914113
}
4092-
export class ShapesToMeshesDto<T>{
4114+
export class ShapesToMeshesDto<T> {
40934115
constructor(shapes?: T[], precision?: number, adjustYtoZ?: boolean) {
40944116
if (shapes !== undefined) { this.shapes = shapes; }
40954117
if (precision !== undefined) { this.precision = precision; }
@@ -4815,7 +4837,7 @@ export namespace OCCT {
48154837
*/
48164838
direction: Base.Vector3 = [0, 1, 0];
48174839
}
4818-
export class Geom2dTrimmedCurveDto<T>{
4840+
export class Geom2dTrimmedCurveDto<T> {
48194841
constructor(shape?: T, u1?: number, u2?: number, sense?: boolean, adjustPeriodic?: boolean) {
48204842
if (shape !== undefined) { this.shape = shape; }
48214843
if (u1 !== undefined) { this.u1 = u1; }

lib/services/base/wires.service.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,37 @@ export class WiresService {
623623
return result;
624624
}
625625

626+
createBezierWeights(inputs: Inputs.OCCT.BezierWeightsDto) {
627+
if (!inputs.closed && inputs.points.length !== inputs.weights.length) {
628+
throw new Error("Number of points and weights must be the same when bezier is not clsoed.");
629+
} else if (inputs.closed && inputs.points.length !== inputs.weights.length - 1) {
630+
throw new Error("Number of points must be one less than number of weights when bezier is clsoed.");
631+
}
632+
633+
const ptList = new this.occ.TColgp_Array1OfPnt_2(1, inputs.points.length + (inputs.closed ? 1 : 0));
634+
for (let pIndex = 1; pIndex <= inputs.points.length; pIndex++) {
635+
ptList.SetValue(pIndex, this.entitiesService.gpPnt(inputs.points[pIndex - 1]));
636+
}
637+
if (inputs.closed) { ptList.SetValue(inputs.points.length + 1, ptList.Value(1)); }
638+
const arrayOfReal = new this.occ.TColStd_Array1OfReal_2(1, inputs.weights.length);
639+
for (let i = 1; i <= inputs.weights.length; i++) {
640+
arrayOfReal.SetValue(i, inputs.weights[i - 1]);
641+
}
642+
const geomBezierCurveHandle = new this.occ.Geom_BezierCurve_2(ptList, arrayOfReal);
643+
const geomCurve = new this.occ.Handle_Geom_Curve_2(geomBezierCurveHandle);
644+
const edgeMaker = new this.occ.BRepBuilderAPI_MakeEdge_24(geomCurve);
645+
const edge = edgeMaker.Edge();
646+
const makeWire = new this.occ.BRepBuilderAPI_MakeWire_2(edge);
647+
const result = makeWire.Wire();
648+
makeWire.delete();
649+
edgeMaker.delete();
650+
edge.delete();
651+
geomCurve.delete();
652+
ptList.delete();
653+
arrayOfReal.delete();
654+
return result;
655+
}
656+
626657
addEdgesAndWiresToWire(inputs: Inputs.OCCT.ShapeShapesDto<TopoDS_Wire, TopoDS_Wire | TopoDS_Edge>): TopoDS_Wire {
627658
const makeWire = new this.occ.BRepBuilderAPI_MakeWire_1();
628659
makeWire.Add_2(inputs.shape);

lib/services/shapes/wire.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export class OCCTWire {
4646
return this.och.converterService.makeCompoundIfNeeded(wires, inputs.returnCompound);
4747
}
4848

49+
createBezierWeights(inputs: Inputs.OCCT.BezierWeightsDto) {
50+
return this.och.wiresService.createBezierWeights(inputs);
51+
}
52+
4953
interpolatePoints(inputs: Inputs.OCCT.InterpolationDto): TopoDS_Wire {
5054
return this.och.wiresService.interpolatePoints(inputs);
5155
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitbybit-dev/occt",
3-
"version": "0.15.12",
3+
"version": "0.15.13",
44
"description": "Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)