circuit-json-to-gltf 0.0.156 → 0.0.157
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/dist/index.d.ts +13 -1
- package/dist/index.js +34 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -366,6 +366,18 @@ declare function getBestCameraPosition(circuitJson: CircuitJson, opts?: CameraFi
|
|
|
366
366
|
fov: number;
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
+
type OcctImportJsFactory = (moduleArgs?: {
|
|
370
|
+
locateFile?: (path: string, scriptDirectory: string) => string;
|
|
371
|
+
}) => Promise<any>;
|
|
372
|
+
/**
|
|
373
|
+
* Provide occt-import-js for STEP loading, e.g. from your own bundle or a
|
|
374
|
+
* self-hosted copy. Otherwise it is imported from node_modules under Node and
|
|
375
|
+
* from a CDN in browsers.
|
|
376
|
+
*/
|
|
377
|
+
declare function setOcctImportJs(factory: OcctImportJsFactory, options?: {
|
|
378
|
+
wasmUrl?: string;
|
|
379
|
+
}): void;
|
|
380
|
+
|
|
369
381
|
declare function applyCoordinateTransform(point: Point3, config: CoordinateTransformConfig): Point3;
|
|
370
382
|
/** Convert source-frame triangles into the configured frame, in the same mm
|
|
371
383
|
* units. Reflections preserve outward faces by swapping winding and vertex UVs;
|
|
@@ -405,4 +417,4 @@ interface BRepShape {
|
|
|
405
417
|
is_negative?: boolean;
|
|
406
418
|
}
|
|
407
419
|
|
|
408
|
-
export { type BRepShape, type BoardRenderOptions, type BoundingBox, type Box3D, CAMERA_PRESET_DIRECTIONS, COORDINATE_TRANSFORMS, type Camera3D, type CameraFitOptions, type CameraPreset, type CircuitJsonWithPcbFlex, type CircuitTo3DOptions, type Color, type ConversionOptions, type CoordinateTransformConfig, type GLTFExportOptions, type LayerRef, type Light3D, type OBJMaterial, type OBJMesh, type PcbBendRecord, type PcbStiffenerRecord, type Point, type Point3, type PoppyglErrorOverlay, type PoppyglErrorOverlayOptions, type STLMesh, type Scene3D, type Size3, type Triangle, applyCoordinateTransform, clearGLBCache, clearOBJCache, clearSTLCache, convertCircuitJsonTo3D, convertCircuitJsonToGltf, convertSceneToGLTF, getBestCameraPosition, getPoppyglErrorOverlayOptions, loadGLB, loadJscadPlan, loadOBJ, loadSTL, renderBoardLayer, renderBoardTextures, transformTriangles };
|
|
420
|
+
export { type BRepShape, type BoardRenderOptions, type BoundingBox, type Box3D, CAMERA_PRESET_DIRECTIONS, COORDINATE_TRANSFORMS, type Camera3D, type CameraFitOptions, type CameraPreset, type CircuitJsonWithPcbFlex, type CircuitTo3DOptions, type Color, type ConversionOptions, type CoordinateTransformConfig, type GLTFExportOptions, type LayerRef, type Light3D, type OBJMaterial, type OBJMesh, type OcctImportJsFactory, type PcbBendRecord, type PcbStiffenerRecord, type Point, type Point3, type PoppyglErrorOverlay, type PoppyglErrorOverlayOptions, type STLMesh, type Scene3D, type Size3, type Triangle, applyCoordinateTransform, clearGLBCache, clearOBJCache, clearSTLCache, convertCircuitJsonTo3D, convertCircuitJsonToGltf, convertSceneToGLTF, getBestCameraPosition, getPoppyglErrorOverlayOptions, loadGLB, loadJscadPlan, loadOBJ, loadSTL, renderBoardLayer, renderBoardTextures, setOcctImportJs, transformTriangles };
|
package/dist/index.js
CHANGED
|
@@ -17745,24 +17745,42 @@ function clearOBJCache() {
|
|
|
17745
17745
|
|
|
17746
17746
|
// lib/loaders/step.ts
|
|
17747
17747
|
var stepCache = /* @__PURE__ */ new Map();
|
|
17748
|
+
var OCCT_IMPORT_JS_VERSION = "0.0.23";
|
|
17749
|
+
var OCCT_IMPORT_JS_CDN_URL = `https://cdn.jsdelivr.net/npm/occt-import-js@${OCCT_IMPORT_JS_VERSION}`;
|
|
17750
|
+
var occtImportJsFactory;
|
|
17751
|
+
var occtWasmUrl;
|
|
17748
17752
|
var occtModulePromise = null;
|
|
17753
|
+
function setOcctImportJs(factory, options = {}) {
|
|
17754
|
+
occtImportJsFactory = factory;
|
|
17755
|
+
occtWasmUrl = options.wasmUrl;
|
|
17756
|
+
occtModulePromise = null;
|
|
17757
|
+
}
|
|
17758
|
+
var isNode = () => typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
17759
|
+
var importAtRuntime = (specifier) => import(
|
|
17760
|
+
/* @vite-ignore */
|
|
17761
|
+
/* webpackIgnore: true */
|
|
17762
|
+
specifier
|
|
17763
|
+
);
|
|
17764
|
+
async function importOcctImportJs() {
|
|
17765
|
+
const occtModule = await importAtRuntime(
|
|
17766
|
+
isNode() ? "occt-import-js" : `${OCCT_IMPORT_JS_CDN_URL}/+esm`
|
|
17767
|
+
);
|
|
17768
|
+
return occtModule.default ?? occtModule;
|
|
17769
|
+
}
|
|
17749
17770
|
async function getOcctModule() {
|
|
17750
17771
|
if (!occtModulePromise) {
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
} else {
|
|
17764
|
-
occtModulePromise = occtimportjs();
|
|
17765
|
-
}
|
|
17772
|
+
occtModulePromise = (async () => {
|
|
17773
|
+
const factory = occtImportJsFactory ?? await importOcctImportJs();
|
|
17774
|
+
const wasmUrl = occtWasmUrl ?? (occtImportJsFactory || isNode() ? void 0 : `${OCCT_IMPORT_JS_CDN_URL}/dist/occt-import-js.wasm`);
|
|
17775
|
+
return factory(
|
|
17776
|
+
wasmUrl ? {
|
|
17777
|
+
locateFile: (path, scriptDirectory) => path.endsWith(".wasm") ? wasmUrl : scriptDirectory + path
|
|
17778
|
+
} : void 0
|
|
17779
|
+
);
|
|
17780
|
+
})();
|
|
17781
|
+
occtModulePromise.catch(() => {
|
|
17782
|
+
occtModulePromise = null;
|
|
17783
|
+
});
|
|
17766
17784
|
}
|
|
17767
17785
|
return occtModulePromise;
|
|
17768
17786
|
}
|
|
@@ -20567,5 +20585,6 @@ export {
|
|
|
20567
20585
|
loadSTL,
|
|
20568
20586
|
renderBoardLayer,
|
|
20569
20587
|
renderBoardTextures,
|
|
20588
|
+
setOcctImportJs,
|
|
20570
20589
|
transformTriangles
|
|
20571
20590
|
};
|