Skip to content

Commit 17566f3

Browse files
base models set up
1 parent 72cf591 commit 17566f3

File tree

10 files changed

+63
-51
lines changed

10 files changed

+63
-51
lines changed

packages/dev/base/lib/api/inputs/text-inputs.ts

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -152,51 +152,7 @@ export namespace Text {
152152
*/
153153
extrudeOffset? = 0;
154154
}
155-
export class VectorCharResultDto {
156-
constructor(width?: number, height?: number, paths?: Base.Point3[][]) {
157-
if (width !== undefined) { this.width = width; }
158-
if (height !== undefined) { this.height = height; }
159-
if (paths !== undefined) { this.paths = paths; }
160-
}
161-
/**
162-
* The width of the char
163-
* @default undefined
164-
*/
165-
width?: number;
166-
/**
167-
* The height of the char
168-
* @default undefined
169-
*/
170-
height?: number;
171-
/**
172-
* The segments of the char
173-
* @default undefined
174-
*/
175-
paths?: Base.Point3[][];
176-
}
177-
178-
export class VectorTextResultDto {
179-
constructor(width?: number, height?: number, chars?: VectorCharResultDto[]) {
180-
if (width !== undefined) { this.width = width; }
181-
if (height !== undefined) { this.height = height; }
182-
if (chars !== undefined) { this.chars = chars; }
183-
}
184-
/**
185-
* The width of the char
186-
* @default undefined
187-
*/
188-
width?: number;
189-
/**
190-
* The height of the char
191-
* @default undefined
192-
*/
193-
height?: number;
194-
/**
195-
* The segments of the char
196-
* @default undefined
197-
*/
198-
chars?: VectorCharResultDto[];
199-
}
155+
200156
export class VectorTextDto {
201157
constructor(text?: string, xOffset?: number, yOffset?: number, height?: number, lineSpacing?: number, letterSpacing?: number, align?: Base.horizontalAlignEnum, extrudeOffset?: number, centerOnOrigin?: boolean) {
202158
if (text !== undefined) { this.text = text; }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./text";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./vector-char-data";
2+
export * from "./vector-text-data";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as Text from "./bucket";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Base } from "../../inputs/base-inputs";
2+
3+
export class VectorCharData {
4+
constructor(width?: number, height?: number, paths?: Base.Point3[][]) {
5+
if (width !== undefined) { this.width = width; }
6+
if (height !== undefined) { this.height = height; }
7+
if (paths !== undefined) { this.paths = paths; }
8+
}
9+
/**
10+
* The width of the char
11+
* @default undefined
12+
*/
13+
width?: number;
14+
/**
15+
* The height of the char
16+
* @default undefined
17+
*/
18+
height?: number;
19+
/**
20+
* The segments of the char
21+
* @default undefined
22+
*/
23+
paths?: Base.Point3[][];
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
import { VectorCharData } from "./vector-char-data";
3+
4+
export class VectorTextData {
5+
constructor(width?: number, height?: number, chars?: VectorCharData[]) {
6+
if (width !== undefined) { this.width = width; }
7+
if (height !== undefined) { this.height = height; }
8+
if (chars !== undefined) { this.chars = chars; }
9+
}
10+
/**
11+
* The width of the char
12+
* @default undefined
13+
*/
14+
width?: number;
15+
/**
16+
* The height of the char
17+
* @default undefined
18+
*/
19+
height?: number;
20+
/**
21+
* The segments of the char
22+
* @default undefined
23+
*/
24+
chars?: VectorCharData[];
25+
}

packages/dev/base/lib/api/services/text.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as Inputs from "../inputs";
2+
import * as Models from "../models";
23
import { defaultsVectorParams } from "../models/simplex";
34
import { Point } from "./point";
45

@@ -103,7 +104,7 @@ export class TextBitByBit {
103104
* @shortname vector char
104105
* @drawable false
105106
*/
106-
vectorChar(inputs: Inputs.Text.VectorCharDto): Inputs.Text.VectorCharResultDto {
107+
vectorChar(inputs: Inputs.Text.VectorCharDto): Models.Text.VectorCharData {
107108
const {
108109
xOffset, yOffset, font, input, height, extrudeOffset
109110
} = this.vectorParamsChar(inputs);
@@ -142,7 +143,7 @@ export class TextBitByBit {
142143
* @shortname vector text
143144
* @drawable false
144145
*/
145-
vectorText(inputs: Inputs.Text.VectorTextDto): Inputs.Text.VectorTextResultDto[] {
146+
vectorText(inputs: Inputs.Text.VectorTextDto): Models.Text.VectorTextData[] {
146147
const {
147148
xOffset, yOffset, height, align, extrudeOffset, lineSpacing, letterSpacing
148149
} = Object.assign({}, defaultsVectorParams, inputs);
@@ -155,7 +156,7 @@ export class TextBitByBit {
155156

156157
// manage the list of lines
157158
let maxWidth = 0; // keep track of max width for final alignment
158-
type Line = { width: number, height: number, chars: Inputs.Text.VectorCharResultDto[] };
159+
type Line = { width: number, height: number, chars: Models.Text.VectorCharData[] };
159160
let line: Line = { width: 0, height: 0, chars: [] };
160161
let lines: Line[] = [];
161162

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * as OCCT from "@bitbybit-dev/occt/lib/api/models";
1+
export * from "@bitbybit-dev/occt/lib/api/models";
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export * as OCCT from "./bucket";
1+
export * from "@bitbybit-dev/base/lib/api/models";
2+
export * as OCCT from "./bucket";

packages/dev/occt/lib/shape-parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TopoDS_Shape } from "../bitbybit-dev-occt/bitbybit-dev-occt";
2-
import { Inputs, OCCTTransforms, Models } from "./index";
2+
import { Inputs, OCCTTransforms } from "./index";
3+
import * as Models from "./api/models";
34

45
export class ShapeParser {
56

0 commit comments

Comments
 (0)