@tscircuit/core 0.0.1158 → 0.0.1159

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11581,8 +11581,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11581
11581
  if (this.props.doNotPlace) return;
11582
11582
  const { db } = this.root;
11583
11583
  const { boardThickness = 0 } = this._getBoard() ?? {};
11584
- const cadModelProp = this._parsedProps.cadModel;
11585
- const cadModel = cadModelProp === void 0 ? this._asyncFootprintCadModel : cadModelProp;
11584
+ const cadModelProp2 = this._parsedProps.cadModel;
11585
+ const cadModel = cadModelProp2 === void 0 ? this._asyncFootprintCadModel : cadModelProp2;
11586
11586
  const footprint = this.getFootprinterString() ?? this._getImpliedFootprintString();
11587
11587
  if (!this.pcb_component_id) return;
11588
11588
  if (!cadModel && !footprint) return;
@@ -12288,7 +12288,7 @@ var Chip = class extends NormalComponent3 {
12288
12288
  const hasFootprintChild = this.children.some(
12289
12289
  (c) => c.componentName === "Footprint"
12290
12290
  );
12291
- if (!footprint && !hasFootprintChild) {
12291
+ if (!footprint && !hasFootprintChild && !this._hasStartedFootprintUrlLoad) {
12292
12292
  const footprint_error = db.pcb_missing_footprint_error.insert({
12293
12293
  message: `No footprint specified for component: ${this.getString()}`,
12294
12294
  source_component_id: `${this.source_component_id}`,
@@ -19315,7 +19315,7 @@ import { identity as identity5 } from "transformation-matrix";
19315
19315
  var package_default = {
19316
19316
  name: "@tscircuit/core",
19317
19317
  type: "module",
19318
- version: "0.0.1157",
19318
+ version: "0.0.1158",
19319
19319
  types: "dist/index.d.ts",
19320
19320
  main: "dist/index.js",
19321
19321
  module: "dist/index.js",
@@ -23188,6 +23188,38 @@ var convertCircuitJsonToUsbCStandardCircuitJson = (partCircuitJson) => {
23188
23188
  });
23189
23189
  };
23190
23190
 
23191
+ // lib/utils/connectors/extractCadModelFromCircuitJson.ts
23192
+ import { cadModelProp } from "@tscircuit/props";
23193
+ var extractCadModelFromCircuitJson = (circuitJson) => {
23194
+ const cadComponent = circuitJson.find(
23195
+ (elm) => elm.type === "cad_component"
23196
+ );
23197
+ if (!cadComponent) return void 0;
23198
+ const cadModelCandidate = {
23199
+ stlUrl: cadComponent.model_stl_url,
23200
+ objUrl: cadComponent.model_obj_url,
23201
+ gltfUrl: cadComponent.model_gltf_url,
23202
+ glbUrl: cadComponent.model_glb_url,
23203
+ stepUrl: cadComponent.model_step_url,
23204
+ wrlUrl: cadComponent.model_wrl_url,
23205
+ modelOriginPosition: cadComponent.model_origin_position ?? void 0,
23206
+ modelUnitToMmScale: cadComponent.model_unit_to_mm_scale_factor,
23207
+ modelBoardNormalDirection: cadComponent.model_board_normal_direction,
23208
+ size: cadComponent.size ?? void 0,
23209
+ rotationOffset: cadComponent.rotation ?? void 0,
23210
+ positionOffset: cadComponent.position ?? void 0,
23211
+ showAsTranslucentModel: cadComponent.show_as_translucent_model
23212
+ };
23213
+ if (!cadModelCandidate.stlUrl && !cadModelCandidate.objUrl && !cadModelCandidate.gltfUrl && !cadModelCandidate.glbUrl && !cadModelCandidate.stepUrl && !cadModelCandidate.wrlUrl && !cadComponent.model_jscad) {
23214
+ return void 0;
23215
+ }
23216
+ if (cadComponent.model_jscad && typeof cadComponent.model_jscad === "object") {
23217
+ cadModelCandidate.jscad = cadComponent.model_jscad;
23218
+ }
23219
+ const parsedCadModel = cadModelProp.safeParse(cadModelCandidate);
23220
+ return parsedCadModel.success ? parsedCadModel.data : void 0;
23221
+ };
23222
+
23191
23223
  // lib/components/normal-components/Connector.ts
23192
23224
  import { symbols as symbols4 } from "schematic-symbols";
23193
23225
 
@@ -23341,6 +23373,12 @@ var Connector = class extends Chip {
23341
23373
  },
23342
23374
  standardizedCircuitJson
23343
23375
  );
23376
+ const fetchedCadModel = extractCadModelFromCircuitJson(
23377
+ standardizedCircuitJson
23378
+ );
23379
+ if (fetchedCadModel) {
23380
+ this._asyncFootprintCadModel = fetchedCadModel;
23381
+ }
23344
23382
  this.addAll(fpComponents);
23345
23383
  this._markDirty("InitializePortsFromChildren");
23346
23384
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1158",
4
+ "version": "0.0.1159",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",