circuit-json-to-gltf 0.0.150 → 0.0.152
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 +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +3993 -3861
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ convertCircuitJsonToGltf(circuitJson: CircuitJson, options?: ConversionOptions):
|
|
|
76
76
|
- `silkscreenColor`: Silkscreen color in board textures; overrides `pcb_board.silkscreen_color`
|
|
77
77
|
- `solderMaskWithCopperColor`: Color of traces and copper covered by solder mask; otherwise derived from the solder-mask color
|
|
78
78
|
- `drillColor`: Drill opening color in board textures
|
|
79
|
+
- `showReferenceSurfaces`: Render `cad_reference_surface` records as translucent rectangles with outlines, outward normal arrows, and `PART.surface` labels (default: `false`). Explicit width/height are respected; frames without extents use a 10 mm diagnostic rectangle. Works without an owner CAD model.
|
|
79
80
|
- `showBoundingBoxes`: Show bounding boxes for debugging (default: `false`)
|
|
80
81
|
- `projectBaseUrl`: Optional base URL used to resolve `node_modules` model assets via `/package_files/download`
|
|
81
82
|
- `authHeaders`: Optional auth headers for model downloads, e.g. `{ Authorization: "Bearer ..." }`
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ interface ConversionOptions {
|
|
|
50
50
|
silkscreenColor?: string;
|
|
51
51
|
solderMaskWithCopperColor?: string;
|
|
52
52
|
drillColor?: string;
|
|
53
|
+
/** Show named CAD reference surfaces as diagnostic frames. Defaults to false. */
|
|
54
|
+
showReferenceSurfaces?: boolean;
|
|
53
55
|
showBoundingBoxes?: boolean;
|
|
54
56
|
coordinateTransform?: CoordinateTransformConfig;
|
|
55
57
|
projectBaseUrl?: string;
|
|
@@ -80,6 +82,10 @@ interface Size3 {
|
|
|
80
82
|
y: number;
|
|
81
83
|
z: number;
|
|
82
84
|
}
|
|
85
|
+
/** Geometry uses outward counterclockwise winding, with normals agreeing with
|
|
86
|
+
* the vertex order. Scene3D triangles use +Y up and mm; source geometry may use
|
|
87
|
+
* another frame until its loader converts it. Reflections reverse vertex order
|
|
88
|
+
* and attached UVs once; rotations leave winding unchanged. */
|
|
83
89
|
interface Triangle {
|
|
84
90
|
/** Authored JSCAD appearance; color tuples use linear 0–1 RGB. */
|
|
85
91
|
material?: MaterialOptions;
|
|
@@ -109,6 +115,8 @@ interface BoundingBox {
|
|
|
109
115
|
min: Point3;
|
|
110
116
|
max: Point3;
|
|
111
117
|
}
|
|
118
|
+
/** Loader and Scene3D meshes use +Y-up mm and outward-wound triangles.
|
|
119
|
+
* Exporters preserve their order; the final glTF X reflection owns its reversal. */
|
|
112
120
|
interface STLMesh {
|
|
113
121
|
triangles: Triangle[];
|
|
114
122
|
boundingBox: BoundingBox;
|
|
@@ -132,6 +140,8 @@ interface Box3D {
|
|
|
132
140
|
rotation?: Point3;
|
|
133
141
|
color?: Color;
|
|
134
142
|
sideColor?: Color;
|
|
143
|
+
/** Explicit CAD color override, distinct from the fallback mesh color. */
|
|
144
|
+
materialColorOverride?: string;
|
|
135
145
|
texture?: {
|
|
136
146
|
top?: string;
|
|
137
147
|
bottom?: string;
|
|
@@ -200,6 +210,8 @@ interface CircuitTo3DOptions {
|
|
|
200
210
|
/** Include full Circuit JSON error messages for screen overlay renderers. Defaults to false. */
|
|
201
211
|
showErrors?: boolean;
|
|
202
212
|
coordinateTransform?: CoordinateTransformConfig;
|
|
213
|
+
/** Show named CAD reference surfaces as diagnostic frames. Defaults to false. */
|
|
214
|
+
showReferenceSurfaces?: boolean;
|
|
203
215
|
showBoundingBoxes?: boolean;
|
|
204
216
|
projectBaseUrl?: string;
|
|
205
217
|
authHeaders?: AuthHeaders;
|
|
@@ -348,6 +360,11 @@ declare function getBestCameraPosition(circuitJson: CircuitJson, opts?: CameraFi
|
|
|
348
360
|
};
|
|
349
361
|
|
|
350
362
|
declare function applyCoordinateTransform(point: Point3, config: CoordinateTransformConfig): Point3;
|
|
363
|
+
/** Convert source-frame triangles into the configured frame, in the same mm
|
|
364
|
+
* units. Reflections preserve outward faces by swapping winding and vertex UVs;
|
|
365
|
+
* normals are unit inverse-transpose directions, including nonuniform flips.
|
|
366
|
+
* Matches pcb-fold.swapMeshFrame for the Circuit Z-up -> Scene Y-up reflection.
|
|
367
|
+
*/
|
|
351
368
|
declare function transformTriangles(triangles: Triangle[], config: CoordinateTransformConfig): Triangle[];
|
|
352
369
|
declare const COORDINATE_TRANSFORMS: {
|
|
353
370
|
readonly CIRCUIT_Z_UP_TO_SCENE_Y_UP: CoordinateTransformConfig;
|