@buerli.io/core 0.8.0 → 0.9.0-beta.1
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/geometry/ThreeGeometryCreator.js +1 -1
- package/build/cjs/store/states/structure.js +1 -1
- package/build/cjs/types/IStructureTree.js +1 -0
- package/build/cjs/utils/Measure.js +19 -0
- package/build/esm/geometry/ThreeGeometryCreator.js +1 -1
- package/build/esm/store/states/structure.js +1 -1
- package/build/esm/types/IStructureTree.js +1 -0
- package/build/esm/utils/Measure.js +19 -0
- package/build/types/geometry/ThreeGeometryCreator.d.ts +21 -13
- package/build/types/types/IStructureTree.d.ts +6 -1
- package/build/types/types/InteractionInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -274,7 +274,7 @@ class ThreeGeometryCreator {
|
|
|
274
274
|
this.insertPoint(container, `${endId}|point`, endId, end, arc.id, 'end', points);
|
|
275
275
|
const geometry = new THREE.BufferGeometry().setFromPoints(threePts);
|
|
276
276
|
return Object.assign(Object.assign({ geometry,
|
|
277
|
-
graphicId, type: type }, this.getMetadata(arc, container, color)), { normal: normal.clone(), center: center.clone(), radius: arc.radius, angle: arc.angle });
|
|
277
|
+
graphicId, type: type }, this.getMetadata(arc, container, color)), { normal: normal.clone(), center: center.clone(), start: start.clone(), end: end.clone(), radius: arc.radius, angle: arc.angle });
|
|
278
278
|
}
|
|
279
279
|
createPoint(container, key, graphicId, position, ownerId, type) {
|
|
280
280
|
return Object.assign(Object.assign({ key,
|
|
@@ -165,7 +165,7 @@ const structureApi = (set, get, buerliApi) => ({
|
|
|
165
165
|
//////////
|
|
166
166
|
// 1. Collect the products
|
|
167
167
|
//////////
|
|
168
|
-
const searchRoot = structure.root; // || structure.
|
|
168
|
+
const searchRoot = structure.root; // || structure.currentInstance || structure.currentProduct
|
|
169
169
|
const productIds = api.structure.collectProducts(searchRoot).map(p => p.id);
|
|
170
170
|
//////////
|
|
171
171
|
// 2. Collect the solid ids
|
|
@@ -82,6 +82,8 @@ exports.Measure = {
|
|
|
82
82
|
arc.normal = arc.normal.clone().applyMatrix3(matrix3);
|
|
83
83
|
arc.normal.normalize();
|
|
84
84
|
arc.center = arc.center.clone().applyMatrix4(matrix);
|
|
85
|
+
arc.start = arc.start.clone().applyMatrix4(matrix);
|
|
86
|
+
arc.end = arc.end.clone().applyMatrix4(matrix);
|
|
85
87
|
break;
|
|
86
88
|
case types_1.GraphicType.CIRCLE:
|
|
87
89
|
case types_1.GraphicType.CURVECIRCLE:
|
|
@@ -89,6 +91,8 @@ exports.Measure = {
|
|
|
89
91
|
circle.normal = circle.normal.clone().applyMatrix3(matrix3);
|
|
90
92
|
circle.normal.normalize();
|
|
91
93
|
circle.center = circle.center.clone().applyMatrix4(matrix);
|
|
94
|
+
circle.start = circle.start.clone().applyMatrix4(matrix);
|
|
95
|
+
circle.end = circle.end.clone().applyMatrix4(matrix);
|
|
92
96
|
break;
|
|
93
97
|
default:
|
|
94
98
|
break;
|
|
@@ -147,6 +151,16 @@ exports.Measure = {
|
|
|
147
151
|
const arc = element;
|
|
148
152
|
const arcNEnd = arc.center.clone().addScaledVector(arc.normal.clone().normalize(), 40);
|
|
149
153
|
const pointOnArc = getPointOnCircumference(arc.center, arc.normal, arc.radius);
|
|
154
|
+
results.push({
|
|
155
|
+
description: 'Arc start',
|
|
156
|
+
type: MeasureResultType.POSITION,
|
|
157
|
+
measureData: { value: arc.start.clone() },
|
|
158
|
+
});
|
|
159
|
+
results.push({
|
|
160
|
+
description: 'Arc end',
|
|
161
|
+
type: MeasureResultType.POSITION,
|
|
162
|
+
measureData: { value: arc.end.clone() },
|
|
163
|
+
});
|
|
150
164
|
results.push({
|
|
151
165
|
description: 'Arc center',
|
|
152
166
|
type: MeasureResultType.POSITION,
|
|
@@ -183,6 +197,11 @@ exports.Measure = {
|
|
|
183
197
|
type: MeasureResultType.DISTANCE,
|
|
184
198
|
measureData: { value: circle.radius, start: circle.center.clone(), end: pointOnCircle },
|
|
185
199
|
});
|
|
200
|
+
results.push({
|
|
201
|
+
description: 'Circle start/end',
|
|
202
|
+
type: MeasureResultType.POSITION,
|
|
203
|
+
measureData: { value: circle.start.clone() },
|
|
204
|
+
});
|
|
186
205
|
break;
|
|
187
206
|
case types_1.GraphicType.PLANE:
|
|
188
207
|
const plane = element;
|
|
@@ -248,7 +248,7 @@ export class ThreeGeometryCreator {
|
|
|
248
248
|
this.insertPoint(container, `${endId}|point`, endId, end, arc.id, 'end', points);
|
|
249
249
|
const geometry = new THREE.BufferGeometry().setFromPoints(threePts);
|
|
250
250
|
return Object.assign(Object.assign({ geometry,
|
|
251
|
-
graphicId, type: type }, this.getMetadata(arc, container, color)), { normal: normal.clone(), center: center.clone(), radius: arc.radius, angle: arc.angle });
|
|
251
|
+
graphicId, type: type }, this.getMetadata(arc, container, color)), { normal: normal.clone(), center: center.clone(), start: start.clone(), end: end.clone(), radius: arc.radius, angle: arc.angle });
|
|
252
252
|
}
|
|
253
253
|
createPoint(container, key, graphicId, position, ownerId, type) {
|
|
254
254
|
return Object.assign(Object.assign({ key,
|
|
@@ -135,7 +135,7 @@ export const structureApi = (set, get, buerliApi) => ({
|
|
|
135
135
|
//////////
|
|
136
136
|
// 1. Collect the products
|
|
137
137
|
//////////
|
|
138
|
-
const searchRoot = structure.root; // || structure.
|
|
138
|
+
const searchRoot = structure.root; // || structure.currentInstance || structure.currentProduct
|
|
139
139
|
const productIds = api.structure.collectProducts(searchRoot).map(p => p.id);
|
|
140
140
|
//////////
|
|
141
141
|
// 2. Collect the solid ids
|
|
@@ -56,6 +56,8 @@ export const Measure = {
|
|
|
56
56
|
arc.normal = arc.normal.clone().applyMatrix3(matrix3);
|
|
57
57
|
arc.normal.normalize();
|
|
58
58
|
arc.center = arc.center.clone().applyMatrix4(matrix);
|
|
59
|
+
arc.start = arc.start.clone().applyMatrix4(matrix);
|
|
60
|
+
arc.end = arc.end.clone().applyMatrix4(matrix);
|
|
59
61
|
break;
|
|
60
62
|
case GraphicType.CIRCLE:
|
|
61
63
|
case GraphicType.CURVECIRCLE:
|
|
@@ -63,6 +65,8 @@ export const Measure = {
|
|
|
63
65
|
circle.normal = circle.normal.clone().applyMatrix3(matrix3);
|
|
64
66
|
circle.normal.normalize();
|
|
65
67
|
circle.center = circle.center.clone().applyMatrix4(matrix);
|
|
68
|
+
circle.start = circle.start.clone().applyMatrix4(matrix);
|
|
69
|
+
circle.end = circle.end.clone().applyMatrix4(matrix);
|
|
66
70
|
break;
|
|
67
71
|
default:
|
|
68
72
|
break;
|
|
@@ -121,6 +125,16 @@ export const Measure = {
|
|
|
121
125
|
const arc = element;
|
|
122
126
|
const arcNEnd = arc.center.clone().addScaledVector(arc.normal.clone().normalize(), 40);
|
|
123
127
|
const pointOnArc = getPointOnCircumference(arc.center, arc.normal, arc.radius);
|
|
128
|
+
results.push({
|
|
129
|
+
description: 'Arc start',
|
|
130
|
+
type: MeasureResultType.POSITION,
|
|
131
|
+
measureData: { value: arc.start.clone() },
|
|
132
|
+
});
|
|
133
|
+
results.push({
|
|
134
|
+
description: 'Arc end',
|
|
135
|
+
type: MeasureResultType.POSITION,
|
|
136
|
+
measureData: { value: arc.end.clone() },
|
|
137
|
+
});
|
|
124
138
|
results.push({
|
|
125
139
|
description: 'Arc center',
|
|
126
140
|
type: MeasureResultType.POSITION,
|
|
@@ -157,6 +171,11 @@ export const Measure = {
|
|
|
157
171
|
type: MeasureResultType.DISTANCE,
|
|
158
172
|
measureData: { value: circle.radius, start: circle.center.clone(), end: pointOnCircle },
|
|
159
173
|
});
|
|
174
|
+
results.push({
|
|
175
|
+
description: 'Circle start/end',
|
|
176
|
+
type: MeasureResultType.POSITION,
|
|
177
|
+
measureData: { value: circle.start.clone() },
|
|
178
|
+
});
|
|
160
179
|
break;
|
|
161
180
|
case GraphicType.PLANE:
|
|
162
181
|
const plane = element;
|
|
@@ -56,6 +56,7 @@ export declare class ThreeGeometryCreator {
|
|
|
56
56
|
type: GraphicType;
|
|
57
57
|
pointOnPlane: THREE.Vector3;
|
|
58
58
|
normal: THREE.Vector3;
|
|
59
|
+
graphicId: number;
|
|
59
60
|
color: THREE.Color | undefined;
|
|
60
61
|
opacity: number;
|
|
61
62
|
layer: any;
|
|
@@ -68,7 +69,6 @@ export declare class ThreeGeometryCreator {
|
|
|
68
69
|
rawGraphic: IGraphicElement | null;
|
|
69
70
|
isValid: boolean;
|
|
70
71
|
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
71
|
-
graphicId: number;
|
|
72
72
|
loops: number[][];
|
|
73
73
|
};
|
|
74
74
|
createCylinder(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
|
|
@@ -77,6 +77,7 @@ export declare class ThreeGeometryCreator {
|
|
|
77
77
|
axis: THREE.Vector3;
|
|
78
78
|
height: number;
|
|
79
79
|
radius: number;
|
|
80
|
+
graphicId: number;
|
|
80
81
|
color: THREE.Color | undefined;
|
|
81
82
|
opacity: number;
|
|
82
83
|
layer: any;
|
|
@@ -89,7 +90,6 @@ export declare class ThreeGeometryCreator {
|
|
|
89
90
|
rawGraphic: IGraphicElement | null;
|
|
90
91
|
isValid: boolean;
|
|
91
92
|
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
92
|
-
graphicId: number;
|
|
93
93
|
loops: number[][];
|
|
94
94
|
};
|
|
95
95
|
createCone(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
|
|
@@ -99,6 +99,7 @@ export declare class ThreeGeometryCreator {
|
|
|
99
99
|
height: number;
|
|
100
100
|
radiusBottom: number;
|
|
101
101
|
radiusTop: number;
|
|
102
|
+
graphicId: number;
|
|
102
103
|
color: THREE.Color | undefined;
|
|
103
104
|
opacity: number;
|
|
104
105
|
layer: any;
|
|
@@ -111,12 +112,12 @@ export declare class ThreeGeometryCreator {
|
|
|
111
112
|
rawGraphic: IGraphicElement | null;
|
|
112
113
|
isValid: boolean;
|
|
113
114
|
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
114
|
-
graphicId: number;
|
|
115
115
|
loops: number[][];
|
|
116
116
|
};
|
|
117
117
|
createSphere(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
|
|
118
118
|
type: GraphicType;
|
|
119
119
|
radius: number;
|
|
120
|
+
graphicId: number;
|
|
120
121
|
color: THREE.Color | undefined;
|
|
121
122
|
opacity: number;
|
|
122
123
|
layer: any;
|
|
@@ -129,7 +130,6 @@ export declare class ThreeGeometryCreator {
|
|
|
129
130
|
rawGraphic: IGraphicElement | null;
|
|
130
131
|
isValid: boolean;
|
|
131
132
|
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
132
|
-
graphicId: number;
|
|
133
133
|
loops: number[][];
|
|
134
134
|
};
|
|
135
135
|
createLine(line: IGraphicLine, container: IGraphicContainer, points: PointMap, color?: number[]): {
|
|
@@ -169,6 +169,8 @@ export declare class ThreeGeometryCreator {
|
|
|
169
169
|
createArc(arc: IGraphicArc, container: IGraphicContainer, points: PointMap, color?: number[]): {
|
|
170
170
|
normal: THREE.Vector3;
|
|
171
171
|
center: THREE.Vector3;
|
|
172
|
+
start: THREE.Vector3;
|
|
173
|
+
end: THREE.Vector3;
|
|
172
174
|
radius: number;
|
|
173
175
|
angle: number;
|
|
174
176
|
color: THREE.Color | undefined;
|
|
@@ -209,16 +211,21 @@ export declare class ThreeGeometryCreator {
|
|
|
209
211
|
private insertPoint;
|
|
210
212
|
}
|
|
211
213
|
export declare const EMPTY_CONTAINER_GEOMETRY: () => ContainerGeometryT;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
export declare type
|
|
217
|
-
export declare type
|
|
218
|
-
export declare type
|
|
219
|
-
export declare type
|
|
214
|
+
declare type CommonProps = {
|
|
215
|
+
graphicId: GraphicID;
|
|
216
|
+
type: GraphicType;
|
|
217
|
+
};
|
|
218
|
+
export declare type Metadata = ReturnType<ThreeGeometryCreator['getMetadata']>;
|
|
219
|
+
export declare type MeshGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createMesh']>;
|
|
220
|
+
export declare type PlaneGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPlane']>;
|
|
221
|
+
export declare type CylinderGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCylinder']>;
|
|
222
|
+
export declare type ConeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCone']>;
|
|
223
|
+
export declare type SphereGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createSphere']>;
|
|
224
|
+
export declare type LineGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createLine']>;
|
|
225
|
+
export declare type EdgeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createEdge']>;
|
|
226
|
+
export declare type ArcGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createArc']>;
|
|
220
227
|
export declare type CircleGeometry = ArcGeometry;
|
|
221
|
-
export declare type PointGeometry = ReturnType<ThreeGeometryCreator['createPoint']> & {
|
|
228
|
+
export declare type PointGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPoint']> & {
|
|
222
229
|
owners: Array<{
|
|
223
230
|
ownerId: GraphicID;
|
|
224
231
|
type: PointType;
|
|
@@ -245,5 +252,6 @@ export declare type GeometryElement = MeshGeometry | PlaneGeometry | CylinderGeo
|
|
|
245
252
|
export declare type ProductElement = GeometryElement & {
|
|
246
253
|
productId: ObjectID;
|
|
247
254
|
};
|
|
255
|
+
export declare type AnyGeometryElement = CommonProps & Metadata & Partial<MeshGeometry> & Partial<PlaneGeometry> & Partial<CylinderGeometry> & Partial<ConeGeometry> & Partial<SphereGeometry> & Partial<LineGeometry> & Partial<EdgeGeometry> & Partial<ArcGeometry> & Partial<CircleGeometry> & Partial<PointGeometry>;
|
|
248
256
|
export declare const isEqualGeometry: (a: GeometryElement, b: GeometryElement) => boolean;
|
|
249
257
|
export {};
|
|
@@ -18,8 +18,13 @@ export interface IStructureProtocol {
|
|
|
18
18
|
root: ObjectID;
|
|
19
19
|
/** Id of the current product (root or node in part/assembly container). Can be undefined or zero -->> object does not exist! */
|
|
20
20
|
currentProduct?: ObjectID;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Id of the current node in the expanded assembly tree. Can be undefined or zero -->> object does not exist!
|
|
23
|
+
* @deprecated currentNode will be removed in a future release, use currentInstance instead.
|
|
24
|
+
*/
|
|
22
25
|
currentNode?: ObjectID;
|
|
26
|
+
/** Id of the current instance in the expanded assembly tree. Can be undefined or zero -->> object does not exist! */
|
|
27
|
+
currentInstance?: ObjectID;
|
|
23
28
|
/** Id of the test root. Can be undefined or zero -->> object does not exist! */
|
|
24
29
|
testRoot?: ObjectID;
|
|
25
30
|
}
|
|
@@ -14,7 +14,7 @@ export declare type InteractionInfo<T = any> = {
|
|
|
14
14
|
*/
|
|
15
15
|
objectId: ObjectID;
|
|
16
16
|
/**
|
|
17
|
-
* Identifies the
|
|
17
|
+
* Identifies the instance of the Assembly (for BaseModeling).
|
|
18
18
|
* Needed to identify the location ot the object in the tree.
|
|
19
19
|
*/
|
|
20
20
|
prodRefId?: ObjectID | null;
|