@code3d/core 0.0.1-alpha.7 → 0.0.1-alpha.9
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/README.md +42 -1
- package/bld/chunks/{chunk-C3AJ6WNB.js → chunk-2NWM3BLX.js} +2 -2
- package/bld/chunks/{chunk-4WLVDYUJ.js → chunk-OALDEU3F.js} +405 -76
- package/bld/chunks/chunk-OALDEU3F.js.map +7 -0
- package/bld/chunks/{chunk-TCMEEKWL.js → chunk-SM7V45DO.js} +2 -2
- package/bld/chunks/{chunk-VHSPHJ5F.js → chunk-TAYVRBWE.js} +3 -3
- package/bld/library/index.d.ts +2 -2
- package/bld/library/index.d.ts.map +1 -1
- package/bld/library/index.js +3 -1
- package/bld/library/loft.d.ts.map +1 -1
- package/bld/library/replicad.js +2 -2
- package/bld/library/runtime.d.ts +59 -2
- package/bld/library/runtime.d.ts.map +1 -1
- package/bld/library/topology.d.ts +4 -2
- package/bld/library/topology.d.ts.map +1 -1
- package/bld/node/index.js +5 -3
- package/bld/node/replicad.js +4 -4
- package/bld/tooling/index.d.ts +1 -1
- package/bld/tooling/index.d.ts.map +1 -1
- package/bld/tooling/index.js +2 -2
- package/package.json +1 -1
- package/src/library/index.ts +3 -0
- package/src/library/loft.ts +5 -1
- package/src/library/runtime.ts +497 -37
- package/src/library/shell.ts +3 -3
- package/src/library/topology.ts +24 -15
- package/src/tooling/index.ts +1 -0
- package/bld/chunks/chunk-4WLVDYUJ.js.map +0 -7
- /package/bld/chunks/{chunk-C3AJ6WNB.js.map → chunk-2NWM3BLX.js.map} +0 -0
- /package/bld/chunks/{chunk-TCMEEKWL.js.map → chunk-SM7V45DO.js.map} +0 -0
- /package/bld/chunks/{chunk-VHSPHJ5F.js.map → chunk-TAYVRBWE.js.map} +0 -0
package/README.md
CHANGED
|
@@ -75,6 +75,19 @@ Build readable models from named intermediate values and public operations. A
|
|
|
75
75
|
profile followed by extrusion, or solids combined with Boolean operations,
|
|
76
76
|
keeps the construction understandable and editable by both people and agents.
|
|
77
77
|
|
|
78
|
+
## Measure geometry for another part
|
|
79
|
+
|
|
80
|
+
`distance(a, b, axis?)` measures models, finite topology, bounds or point anchors
|
|
81
|
+
in their solved placement and returns a normal non-negative number. Omit the axis
|
|
82
|
+
for shortest geometric distance; supply `x`, `y`, `z`, a direction vector or a
|
|
83
|
+
straight edge/axis reference for the gap between projected intervals. Overlap
|
|
84
|
+
returns zero. Existing relations are resolved on demand, before any group is
|
|
85
|
+
needed; subsequent relations do not update the number.
|
|
86
|
+
|
|
87
|
+
See the [measurement reference](../web/src/content/docs/docs/reference/core.md#measurements)
|
|
88
|
+
and the [fitted beam example](../app/examples/operations/distance.ts). They cover
|
|
89
|
+
finite geometry, nested occurrences, axis frames and source-order dependencies.
|
|
90
|
+
|
|
78
91
|
## Find the modeling API
|
|
79
92
|
|
|
80
93
|
| Task | Start here |
|
|
@@ -114,7 +127,9 @@ including in mixed `Model[]` collections. Nesting preserves each group's hierarc
|
|
|
114
127
|
`expose()` adds named references when callers need to address members.
|
|
115
128
|
|
|
116
129
|
A topology ID belongs to its owning model and element kind. It is a number or a
|
|
117
|
-
flat numeric path, such as `.edge([1, 3])`.
|
|
130
|
+
flat numeric path, such as `.edge([1, 3])`. Local edits (`fillet`, `chamfer`, `shell`)
|
|
131
|
+
preserve one-to-one IDs and allocate fresh IDs for new elements without reusing
|
|
132
|
+
retired numbers. Loft, extrusion and Booleans prefix inherited IDs by input;
|
|
118
133
|
transforms preserve complete paths. Inspect the result after topology changes
|
|
119
134
|
instead of assuming IDs from a different model still apply.
|
|
120
135
|
|
|
@@ -296,3 +311,29 @@ npm test --workspace @code3d/core
|
|
|
296
311
|
|
|
297
312
|
Use the [agent entry](../../docs/agents.md) to work on a project through the CLI,
|
|
298
313
|
or the [App README](../app/README.md) to develop the editor and visualization.
|
|
314
|
+
|
|
315
|
+
## Geometry measurements
|
|
316
|
+
|
|
317
|
+
`model.bounds(relativeTo?)` returns readonly `minimum`, `maximum` and `size`
|
|
318
|
+
XYZ vectors for tight finite geometry bounds. By default it uses the model's
|
|
319
|
+
own local frame. An explicit reference includes solved placement and nested
|
|
320
|
+
member occurrences in that reference's frame. Empty groups have no finite
|
|
321
|
+
bounds; a source occurring more than once in the reference is ambiguous.
|
|
322
|
+
|
|
323
|
+
`model.position(relativeTo)` returns the model origin in the explicit reference's
|
|
324
|
+
local frame. A model's origin in its own frame is always `[0, 0, 0]`, including
|
|
325
|
+
point models whose geometry may be offset from that origin. Neither query
|
|
326
|
+
changes the model or its placement. These methods are available on every model
|
|
327
|
+
kind, including groups. As model members, `bounds` and `position` are reserved
|
|
328
|
+
names and cannot be used as exposed element names.
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
import {box, group, offset} from '@code3d/core';
|
|
332
|
+
|
|
333
|
+
const base = box(20, 4, 20);
|
|
334
|
+
const part = box(8, 12, 4).relate(self => [self.on(base.up), offset(20, 0, 0)]);
|
|
335
|
+
const size = part.bounds().size; // [8, 12, 4]
|
|
336
|
+
const origin = part.position(base); // [20, 8, 0]
|
|
337
|
+
const minimum = part.bounds(base).minimum; // [16, 2, -2]
|
|
338
|
+
export default group([base, part]);
|
|
339
|
+
```
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__name,
|
|
3
3
|
castOwnedShape,
|
|
4
4
|
primitiveConstructor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OALDEU3F.js";
|
|
6
6
|
|
|
7
7
|
// packages/core/src/library/replicad.ts
|
|
8
8
|
import * as replicadModule from "replicad";
|
|
@@ -27,4 +27,4 @@ export {
|
|
|
27
27
|
replicad,
|
|
28
28
|
definePrimitive
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-2NWM3BLX.js.map
|