Conversation
Add support for PDIP (Plastic Dual In-line Package) footprint string. PDIP is an alias for DIP packages, commonly used in datasheets and component listings. Closes tscircuit#371
tests/pdip.test.ts
Outdated
| test("pdip8 footprint", () => { | ||
| const circuitJson = fp.string("pdip8").circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "pdip8") | ||
| }) | ||
|
|
||
| test("pdip8 parameters match dip8", () => { | ||
| const pdipJson = fp.string("pdip8").json() | ||
| const dipJson = fp.string("dip8").json() | ||
|
|
||
| // PDIP should have same parameters as DIP (except fn name) | ||
| expect(pdipJson.num_pins).toBe(dipJson.num_pins) | ||
| expect(pdipJson.w).toBe(dipJson.w) | ||
| expect(pdipJson.p).toBe(dipJson.p) | ||
| expect(pdipJson.id).toBe(dipJson.id) | ||
| expect(pdipJson.od).toBe(dipJson.od) | ||
| }) | ||
|
|
||
| test("pdip14 footprint", () => { | ||
| const circuitJson = fp.string("pdip14").circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "pdip14") | ||
| }) | ||
|
|
||
| test("pdip16 footprint", () => { | ||
| const circuitJson = fp.string("pdip16").circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "pdip16") | ||
| }) | ||
|
|
||
| test("pdip8_wide footprint", () => { | ||
| const circuitJson = fp | ||
| .string("pdip8_wide") | ||
| .circuitJson() as AnyCircuitElement[] | ||
| const svgContent = convertCircuitJsonToPcbSvg(circuitJson) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "pdip8_wide") | ||
| }) | ||
|
|
||
| test("PDIP8 string resolves using lowercase function", () => { | ||
| const uppercaseJson = fp.string("PDIP8").json() | ||
| const lowercaseJson = fp.string("pdip8").json() | ||
| expect(uppercaseJson).toEqual(lowercaseJson) | ||
| }) |
There was a problem hiding this comment.
This test file contains 6 test functions, which violates the rule that a *.test.ts file may have AT MOST one test(...). The file should be split into multiple numbered files such as pdip1.test.ts, pdip2.test.ts, pdip3.test.ts, pdip4.test.ts, pdip5.test.ts, and pdip6.test.ts, with each file containing only one test function.
Spotted by Graphite Agent (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
rushabhcodes
left a comment
There was a problem hiding this comment.
also add kicad parity test, see others for ref
src/fn/pdip.ts
Outdated
| /** | ||
| * PDIP (Plastic Dual In-line Package) footprint | ||
| * | ||
| * PDIP is the standard plastic version of DIP packages. | ||
| * Common variants: PDIP-8, PDIP-14, PDIP-16, PDIP-20, PDIP-28, etc. | ||
| * | ||
| * Standard specifications: | ||
| * - Pin pitch: 2.54mm (100 mil) | ||
| * - Row spacing: 7.62mm (300 mil) for narrow, 15.24mm (600 mil) for wide | ||
| */ | ||
|
|
||
| import { dip, dip_def, extendDipDef, getCcwDipCoords } from "./dip" | ||
|
|
||
| // PDIP uses the same implementation as DIP | ||
| export const pdip = dip | ||
|
|
||
| // Export the definition for type compatibility | ||
| export const pdip_def = dip_def | ||
| export const extendPdipDef = extendDipDef | ||
| export const getCcwPdipCoords = getCcwDipCoords |
There was a problem hiding this comment.
please follow code maintainability
src/fn/pdip.ts
Outdated
| /** | ||
| * PDIP (Plastic Dual In-line Package) footprint | ||
| * | ||
| * PDIP is the standard plastic version of DIP packages. | ||
| * Common variants: PDIP-8, PDIP-14, PDIP-16, PDIP-20, PDIP-28, etc. | ||
| * | ||
| * Standard specifications: | ||
| * - Pin pitch: 2.54mm (100 mil) | ||
| * - Row spacing: 7.62mm (300 mil) for narrow, 15.24mm (600 mil) for wide | ||
| */ |
There was a problem hiding this comment.
Unrelavent comment, if you need describe use .describe()
| test("parity/pdip8", async () => { | ||
| const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = | ||
| await compareFootprinterVsKicad( | ||
| "pdip8_w7.62mm", | ||
| "Package_DIP.pretty/DIP-8_W7.62mm.circuit.json", | ||
| ) | ||
|
|
||
| const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) | ||
| expect(svgContent).toMatchSvgSnapshot(import.meta.path, "pdip8") | ||
| expect(booleanDifferenceSvg).toMatchSvgSnapshot( | ||
| import.meta.path, | ||
| "pdip8_boolean_difference", | ||
| ) |
There was a problem hiding this comment.
Adding pdip and comparing with dip, this is incorrect
PDIP is an alias for DIP (Plastic Dual In-line Package), so there's no separate PDIP footprint in KiCAD library. Instead, added a test that verifies pdip produces identical circuit json as dip.
|
Thanks for the feedback! You're right - I've replaced the KiCAD parity test. PDIP (Plastic Dual In-line Package) is just an alias for DIP - they have identical physical dimensions. KiCAD library doesn't have separate PDIP footprints because they're the same as DIP. Instead, I've added an alias verification test ( |
techmannih
left a comment
There was a problem hiding this comment.
are the pdip and dip same?
|
Yes, PDIP and DIP are the same physically. PDIP = Plastic Dual In-line Package It's just a more specific naming convention used in datasheets to indicate the package material is plastic (as opposed to CDIP = Ceramic DIP). The pin pitch (2.54mm) and row spacing (7.62mm for narrow, 15.24mm for wide) are identical. Many component datasheets use "PDIP-8" instead of "DIP-8", so having this alias makes it easier to match footprint names with datasheet terminology. |
|
Friendly ping for review! I've addressed all the feedback - removed unnecessary comments and added an alias verification test instead of KiCAD parity test (since PDIP is just an alias for DIP). Ready for another look! |
Summary
Changes
src/fn/pdip.ts- New file that exports DIP as PDIP aliassrc/fn/index.ts- Export pdip functionsrc/footprinter.ts- Add pdip type definitiontests/pdip.test.ts- Tests for pdip8, pdip14, pdip16, pdip8_wideTest Plan
pdip8parameters matchdip8parametersPDIP8resolves same aspdip8Closes #371
/claim #371