diff --git a/lib/components/normal-components/Resistor.ts b/lib/components/normal-components/Resistor.ts index 7298d89..310354f 100644 --- a/lib/components/normal-components/Resistor.ts +++ b/lib/components/normal-components/Resistor.ts @@ -1,6 +1,7 @@ import { resistorProps } from "@tscircuit/props" import type { PassivePorts, Ftype, BaseSymbolName } from "lib/utils/constants" import { NormalComponent } from "../base-components/NormalComponent" +import type { SourceSimpleResistorInput } from "@tscircuit/soup" export class Resistor extends NormalComponent< typeof resistorProps, @@ -16,4 +17,19 @@ export class Resistor extends NormalComponent< pin1 = this.portMap.pin1 pin2 = this.portMap.pin2 + + doInitialSourceRender() { + const { db } = this.project! + const { _parsedProps: props } = this + const source_component = db.source_component.insert({ + ftype: "simple_resistor", + name: props.name, + // @ts-ignore + manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn, + supplier_part_numbers: props.supplierPartNumbers, + + resistance: props.resistance, + } as SourceSimpleResistorInput) + this.source_component_id = source_component.source_component_id + } }