@buerli.io/headless 0.4.1 → 0.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/history.js +1226 -0
- package/build/cjs/index.js +35 -0
- package/build/cjs/solid.js +435 -0
- package/build/cjs/utils/selection.js +32 -0
- package/build/{history.js → esm/history.js} +155 -150
- package/build/{index.js → esm/index.js} +0 -0
- package/build/{solid.js → esm/solid.js} +2 -2
- package/build/{utils → esm/utils}/selection.js +0 -0
- package/build/{history.d.ts → types/history.d.ts} +50 -22
- package/build/{index.d.ts → types/index.d.ts} +0 -0
- package/build/{solid.d.ts → types/solid.d.ts} +5 -5
- package/build/{utils → types/utils}/selection.d.ts +0 -0
- package/package.json +11 -11
|
@@ -64,7 +64,7 @@ export declare type ApiHistory = {
|
|
|
64
64
|
ownerId: VID;
|
|
65
65
|
transformation: Transform;
|
|
66
66
|
name?: string;
|
|
67
|
-
}[]) =>
|
|
67
|
+
}[]) => Promise<ObjectID[] | null>;
|
|
68
68
|
/**
|
|
69
69
|
* Adds a dimension to the product in the 3D view
|
|
70
70
|
* @param dimension dimension to be added to a product
|
|
@@ -150,7 +150,7 @@ export declare type ApiHistory = {
|
|
|
150
150
|
dimLayer?: string;
|
|
151
151
|
};
|
|
152
152
|
dxfView: ViewType;
|
|
153
|
-
}[]) =>
|
|
153
|
+
}[]) => Promise<ObjectID[] | null>;
|
|
154
154
|
/**
|
|
155
155
|
* Creates different 2D views, depending on the given view types, in the given product.
|
|
156
156
|
* @param productId id of the product where the view will be created in
|
|
@@ -590,7 +590,7 @@ export declare type ApiHistory = {
|
|
|
590
590
|
*/
|
|
591
591
|
createExpressions: (partId: VID, ...members: {
|
|
592
592
|
name: string;
|
|
593
|
-
value: number |
|
|
593
|
+
value: number | string;
|
|
594
594
|
}[]) => Promise<boolean>;
|
|
595
595
|
/**
|
|
596
596
|
* Creates a new assembly template. This template can be used multiple times as a sub assembly in the root assembly.
|
|
@@ -799,11 +799,11 @@ export declare type ApiHistory = {
|
|
|
799
799
|
*/
|
|
800
800
|
deleteExpressions: (partId: VID, members: string[]) => Promise<boolean>;
|
|
801
801
|
/**
|
|
802
|
-
* Loads a sketch from a
|
|
802
|
+
* Loads a sketch from a ofb filestream and adds its elements to a new sketch.
|
|
803
803
|
* The id of this new created sketch will be returned.
|
|
804
804
|
*
|
|
805
805
|
* @param partId id of the part we want to create the new sketch and copy the sketch elements into it
|
|
806
|
-
* @param strm stream of
|
|
806
|
+
* @param strm stream of ofb file which contains the sketch
|
|
807
807
|
* @param planeId id of the face or workplane to set the new sketch on
|
|
808
808
|
* @param name optional name of the sketch to load from filestream
|
|
809
809
|
*/
|
|
@@ -944,7 +944,7 @@ export declare type ApiHistory = {
|
|
|
944
944
|
* const xDir = { x: 1, y: 0, z: 0 }
|
|
945
945
|
* const yDir = { x: 0, y: 1, z: 0 }
|
|
946
946
|
* const nutBoltAsm = await api.createRootAssembly('NutBolt_Asm')
|
|
947
|
-
* const bolt = await api.loadProduct(arraybuffer, '
|
|
947
|
+
* const bolt = await api.loadProduct(arraybuffer, 'ofb')
|
|
948
948
|
* const boltRefId = await api.addNode(bolt, nutBoltAsm, [pt0, xDir, yDir])
|
|
949
949
|
* const wcsIdOrigin = await api.getWorkCoordSystem(boltRefId, 'WCS_Origin')
|
|
950
950
|
* await api.createFastenedOriginConstraint(nutBoltAsm, { refId: boltRefId, wcsId: wcsIdOrigin[0] }, 0, 0, 0, 0, 0, 'FOC')
|
|
@@ -982,7 +982,7 @@ export declare type ApiHistory = {
|
|
|
982
982
|
/**
|
|
983
983
|
* Writes the current drawing to a stream and returns the data.
|
|
984
984
|
*
|
|
985
|
-
* Important notes about the
|
|
985
|
+
* Important notes about the ofb format:
|
|
986
986
|
* - It contains binary geometry blocks.
|
|
987
987
|
* - Do not try to convert it to text, the geometry blocks will get damaged!
|
|
988
988
|
*
|
|
@@ -990,15 +990,15 @@ export declare type ApiHistory = {
|
|
|
990
990
|
* @example // tbd
|
|
991
991
|
* @image // tbd
|
|
992
992
|
*/
|
|
993
|
-
save: (type:
|
|
993
|
+
save: (type: 'ofb' | 'stp') => Promise<Uint8Array | null>;
|
|
994
994
|
/**
|
|
995
995
|
* POSTs the result to the given url.
|
|
996
996
|
* @param url The url to POST the model to.
|
|
997
|
-
* @param filetype The file type be saved (
|
|
997
|
+
* @param filetype The file type be saved (ofb, stp).
|
|
998
998
|
* @example // tbd
|
|
999
999
|
* @image // tbd
|
|
1000
1000
|
*/
|
|
1001
|
-
saveToUrl: (url: string, filetype: '
|
|
1001
|
+
saveToUrl: (url: string, filetype: 'ofb' | 'stp') => Promise<boolean>;
|
|
1002
1002
|
/**
|
|
1003
1003
|
* Loads the given buffer.
|
|
1004
1004
|
* @param content data as arraybuffer
|
|
@@ -1006,35 +1006,35 @@ export declare type ApiHistory = {
|
|
|
1006
1006
|
* @example // tbd
|
|
1007
1007
|
* @image // tbd
|
|
1008
1008
|
*/
|
|
1009
|
-
load: (content: ArrayBuffer, type:
|
|
1009
|
+
load: (content: ArrayBuffer, type: 'ofb' | 'stp') => Promise<number[] | null>;
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Loads from the given url.
|
|
1012
1012
|
* @param url The url to load data from.
|
|
1013
|
-
* @param filetype The type of data delivered by the url (
|
|
1013
|
+
* @param filetype The type of data delivered by the url (ofb, stp).
|
|
1014
1014
|
* @example // tbd
|
|
1015
1015
|
* @image // tbd
|
|
1016
1016
|
*/
|
|
1017
|
-
loadFromUrl: (url: string, filetype: '
|
|
1017
|
+
loadFromUrl: (url: string, filetype: 'ofb' | 'stp') => Promise<number[] | null>;
|
|
1018
1018
|
/**
|
|
1019
1019
|
* Loads a product into the current drawing.
|
|
1020
1020
|
* @param content data as arraybuffer
|
|
1021
1021
|
* @param type type of the data to load
|
|
1022
1022
|
* @example
|
|
1023
1023
|
* // Loads an existing product
|
|
1024
|
-
* const part = api.loadProduct(arraybuffer, '
|
|
1024
|
+
* const part = api.loadProduct(arraybuffer, 'ofb')
|
|
1025
1025
|
* const geoms = await api.createBufferGeometry(part)
|
|
1026
1026
|
* return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial()))
|
|
1027
1027
|
* @image // tbd
|
|
1028
1028
|
*/
|
|
1029
|
-
loadProduct: (content: ArrayBuffer, type:
|
|
1029
|
+
loadProduct: (content: ArrayBuffer, type: 'ofb' | 'stp') => Promise<number[] | null>;
|
|
1030
1030
|
/**
|
|
1031
1031
|
* Loads a product from the given URL into the current drawing.
|
|
1032
1032
|
* @param url The url to load data from.
|
|
1033
|
-
* @param filetype The type of data delivered by the url (
|
|
1033
|
+
* @param filetype The type of data delivered by the url ('ofb', 'stp').
|
|
1034
1034
|
* @example // tbd
|
|
1035
1035
|
* @image // tbd
|
|
1036
1036
|
*/
|
|
1037
|
-
loadProductFromUrl: (url: string, filetype:
|
|
1037
|
+
loadProductFromUrl: (url: string, filetype: 'ofb' | 'stp') => Promise<number[] | null>;
|
|
1038
1038
|
/**
|
|
1039
1039
|
* Creates a new feature and appends geometry to it. This method can be used to import specific geometry
|
|
1040
1040
|
* which can be used for further operations like boolean, translations and so on.
|
|
@@ -1045,7 +1045,7 @@ export declare type ApiHistory = {
|
|
|
1045
1045
|
* @example // tbd
|
|
1046
1046
|
* @image // tbd
|
|
1047
1047
|
*/
|
|
1048
|
-
importFeature: (partId: VID, content: ArrayBuffer, format:
|
|
1048
|
+
importFeature: (partId: VID, content: ArrayBuffer, format: 'stp' | 'step', name?: string) => ID;
|
|
1049
1049
|
/**
|
|
1050
1050
|
* Removes a node from an assembly node
|
|
1051
1051
|
* @param referenceId id of the node to remove
|
|
@@ -1127,7 +1127,7 @@ export declare type ApiHistory = {
|
|
|
1127
1127
|
*/
|
|
1128
1128
|
setExpressions: (partId: VID, ...members: {
|
|
1129
1129
|
name: string;
|
|
1130
|
-
value: number |
|
|
1130
|
+
value: number | string;
|
|
1131
1131
|
}[]) => Promise<boolean>;
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Updates multiple expression sets in different parts at once
|
|
@@ -1141,7 +1141,7 @@ export declare type ApiHistory = {
|
|
|
1141
1141
|
partId: number;
|
|
1142
1142
|
members: {
|
|
1143
1143
|
name: string;
|
|
1144
|
-
value: number |
|
|
1144
|
+
value: number | string;
|
|
1145
1145
|
}[];
|
|
1146
1146
|
}[]) => Promise<boolean>;
|
|
1147
1147
|
};
|
|
@@ -1163,8 +1163,6 @@ declare type Point = {
|
|
|
1163
1163
|
z: number;
|
|
1164
1164
|
};
|
|
1165
1165
|
export declare type Transform = [Point, Point, Point];
|
|
1166
|
-
declare type DataTypes = 'of1' | 'stp' | 'step';
|
|
1167
|
-
declare type SupportedImportFormats = 'STEP' | 'STP' | 'SAT' | 'IWB' | 'IWP' | 'IWC' | 'IGS' | 'STL' | 'DXF' | 'DWG';
|
|
1168
1166
|
export declare type DimensionType = {
|
|
1169
1167
|
productId: VID;
|
|
1170
1168
|
dimParam: {
|
|
@@ -1186,6 +1184,36 @@ export declare type ViewOptionsType = {
|
|
|
1186
1184
|
color?: number;
|
|
1187
1185
|
layer?: string;
|
|
1188
1186
|
};
|
|
1187
|
+
export declare type FastenedOriginConstraintType = {
|
|
1188
|
+
constrId: VID;
|
|
1189
|
+
mate1: {
|
|
1190
|
+
matePath: VID[];
|
|
1191
|
+
wcsId: VID;
|
|
1192
|
+
flip: number;
|
|
1193
|
+
reoriented: number;
|
|
1194
|
+
};
|
|
1195
|
+
xOffset: number | string;
|
|
1196
|
+
yOffset: number | string;
|
|
1197
|
+
zOffset: number | string;
|
|
1198
|
+
};
|
|
1199
|
+
export declare type FastenedConstraintType = {
|
|
1200
|
+
constrId: VID;
|
|
1201
|
+
mate1: {
|
|
1202
|
+
matePath: VID[];
|
|
1203
|
+
wcsId: VID;
|
|
1204
|
+
flip: number;
|
|
1205
|
+
reoriented: number;
|
|
1206
|
+
};
|
|
1207
|
+
mate2: {
|
|
1208
|
+
matePath: VID[];
|
|
1209
|
+
wcsId: VID;
|
|
1210
|
+
flip: number;
|
|
1211
|
+
reoriented: number;
|
|
1212
|
+
};
|
|
1213
|
+
xOffset: number | string;
|
|
1214
|
+
yOffset: number | string;
|
|
1215
|
+
zOffset: number | string;
|
|
1216
|
+
};
|
|
1189
1217
|
/**
|
|
1190
1218
|
* Information about constraint.
|
|
1191
1219
|
* [
|
|
File without changes
|
|
@@ -223,9 +223,9 @@ export declare type ApiNoHistory = {
|
|
|
223
223
|
intersect: (solidId: VID, keepSolid: boolean, ...bodies: VID[]) => ID;
|
|
224
224
|
/**
|
|
225
225
|
* Loads an arraybuffer in native file format. Native file format
|
|
226
|
-
* is '
|
|
226
|
+
* is 'ofb', if you want to load 'stp' file formats, use import function.
|
|
227
227
|
* Current drawing will be overwritten by loaded data.
|
|
228
|
-
* @param data data as arraybuffer in
|
|
228
|
+
* @param data data as arraybuffer in ofb format
|
|
229
229
|
* @example // tbd
|
|
230
230
|
* @image // tbd
|
|
231
231
|
*/
|
|
@@ -321,14 +321,14 @@ export declare type ApiNoHistory = {
|
|
|
321
321
|
rotateTo: (solidId: VID, rotationVec: Vec) => Promise<void>;
|
|
322
322
|
/**
|
|
323
323
|
* Writes the current drawing as native file format to a stream and returns the data.
|
|
324
|
-
* Native file is '
|
|
324
|
+
* Native file is 'ofb', for 'stp' file format use export method.
|
|
325
325
|
*
|
|
326
|
-
* Important notes about the
|
|
326
|
+
* Important notes about the ofb format:
|
|
327
327
|
* - It contains binary geometry blocks.
|
|
328
328
|
* - Do not try to convert it to text, the geometry blocks will get damaged!
|
|
329
329
|
*
|
|
330
330
|
* @example
|
|
331
|
-
* // Creates a rotated box and gets the
|
|
331
|
+
* // Creates a rotated box and gets the ofb data.
|
|
332
332
|
* const boxId = api.box(10, 10, 10)
|
|
333
333
|
* api.rotateTo(boxId, [Math.PI / 4, 0, Math.PI / 4])
|
|
334
334
|
* const data = api.save()
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/headless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"description": "A non-manifold CAD workflow for the web",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {},
|
|
8
|
-
"main": "build/index.js",
|
|
9
|
-
"module": "build/index.js",
|
|
10
|
-
"types": "build/index.d.ts",
|
|
8
|
+
"main": "build/cjs/index.js",
|
|
9
|
+
"module": "build/esm/index.js",
|
|
10
|
+
"types": "build/types/index.d.ts",
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"scripts": {
|
|
13
13
|
"ver": "npm version",
|
|
14
|
-
"prepack": "npm run clean && npm run build",
|
|
15
|
-
"clean": "rimraf ./build && rimraf
|
|
14
|
+
"prepack": "npm run clean && npm run build -- --sourceMap false && npm run build:cjs -- --sourceMap false",
|
|
15
|
+
"clean": "rimraf ./build* && rimraf tsconfig.tsbuildinfo",
|
|
16
16
|
"build": "tsc -v && tsc",
|
|
17
|
-
"build:
|
|
17
|
+
"build:cjs": "tsc --target es2017 --module commonjs --composite false --declaration false --declarationDir null --outDir ./build/cjs",
|
|
18
18
|
"test": "echo no tests yet",
|
|
19
19
|
"lint": "eslint \"./src/**/*.ts?(x)\"",
|
|
20
20
|
"prettify": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@types/three": "^0.
|
|
23
|
+
"@types/three": "^0.143",
|
|
24
24
|
"copyfiles": "^2.1.1",
|
|
25
25
|
"rimraf": "^2.6.3",
|
|
26
|
-
"three": "^0.
|
|
27
|
-
"typescript": "4.
|
|
26
|
+
"three": "^0.143",
|
|
27
|
+
"typescript": "4.8.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"three": ">=0.138"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@buerli.io/classcad": "0.
|
|
33
|
+
"@buerli.io/classcad": "0.5.0-beta.2",
|
|
34
34
|
"flat-promise": "^1.0.3"
|
|
35
35
|
}
|
|
36
36
|
}
|