MustafaMulla29/MC-MP-symbols

This code defines a 10mm x 10mm schematic diagram featuring two integrated circuit components ("MC" and "MP") with their respective physical symbols, including outer rings, lobed shapes, connection lines, and ports.

Usage: To use this package, import the components from "@tsci/MustafaMulla29.MC-MP-symbols": ```tsx import { MC, MP } from "@tsci/MustafaMulla29.MC-MP-symbols" export default () => ( <board> <MC name="U1" /> <MP name="U2" schX={3} /> </board> ) ``` The package provides two components: - `MC`: A circuit symbol with a shaft port - `MP`: A circuit symbol with a signal port You can place these components on a board and customize their positioning using standard tscircuit props.

Version
0.0.1
License
unset
Stars
0

MC-symbol.tsx

PCBPCB preview for MC-symbol.tsx
SchematicSchematic preview for MC-symbol.tsx
type Pt = { x: number; y: number }

function buildMcInnerPoints(): Pt[] {
  const R = 0.145 // center circle radius (bigger)
  const L = 0.32 // arm length (taller)
  const Wb = 0.04 // arm half-width at BASE (slightly wider)
  const Wt = 0.08 // arm half-width at TIP (restored)
  const segments = 8 // points per arc (smoother curves)

  // Helper to generate elliptical arc points (elongated tips)
  function ellipticalArcPts(
    cx: number,
    cy: number,
    rx: number,
    ry: number,
    startDeg: number,
    endDeg: number
  ): Pt[] {
    const pts: Pt[] = []
    const startRad = (startDeg * Math.PI) / 180
    const endRad = (endDeg * Math.PI) / 180
    for (let i = 0; i <= segments; i++) {
      const a = startRad + (endRad - startRad) * (i / segments)
      pts.push({ x: cx + rx * Math.cos(a), y: cy + ry * Math.sin(a) })
    }
    return pts
  }

  // Helper to generate circular arc points (for center)
  function arcPts(
    cx: number,
    cy: number,
    r: number,
    startDeg: number,
    endDeg: number
  ): Pt[] {
    return ellipticalArcPts(cx, cy, r, r, startDeg, endDeg)
  }

  const pts: Pt[] = []

  // TOP ARM (concave sides - narrower at base, wider at tip)
  pts.push({ x: -Wb, y: R }) // left base (narrow)
  pts.push({ x: -Wt, y: L }) // left side to tip (wide)
  pts.push(...ellipticalArcPts(0, L, Wt, Wt * 0.4, 180, 0).slice(1)) // elliptical tip arc (flatter)
  pts.push({ x: Wb, y: R }) // right side back (narrow at base)

  // Center arc from TOP to RIGHT
  pts.push(...arcPts(0, 0, R, 70, 20).slice(1))

  // RIGHT ARM (concave sides)
  pts.push({ x: R, y: Wb }) // top base (narrow)
  pts.push({ x: L, y: Wt }) // top side to tip (wide)
  pts.push(...ellipticalArcPts(L, 0, Wt * 0.4, Wt, 90, -90).slice(1)) // elliptical tip arc (flatter)
  pts.push({ x: R, y: -Wb }) // bottom side back (narrow at base)

  // Center arc from RIGHT to BOTTOM
  pts.push(...arcPts(0, 0, R, -20, -70).slice(1))

  // BOTTOM ARM (concave sides)
  pts.push({ x: Wb, y: -R }) // right base (narrow)
  pts.push({ x: Wt, y: -L }) // right side to tip (wide)
  pts.push(...ellipticalArcPts(0, -L, Wt, Wt * 0.4, 0, -180).slice(1)) // elliptical tip arc (flatter)
  pts.push({ x: -Wb, y: -R }) // left side back (narrow at base)

  // Center arc from BOTTOM to LEFT
  pts.push(...arcPts(0, 0, R, -110, -160).slice(1))

  // LEFT ARM (concave sides)
  pts.push({ x: -R, y: -Wb }) // bottom base (narrow)
  pts.push({ x: -L, y: -Wt }) // bottom side to tip (wide)
  pts.push(...ellipticalArcPts(-L, 0, Wt * 0.4, Wt, 270, 90).slice(1)) // elliptical tip arc (flatter)
  pts.push({ x: -R, y: Wb }) // top side back (narrow at base)

  // Center arc from LEFT back to TOP
  pts.push(...arcPts(0, 0, R, 160, 110).slice(1))

  return pts
}

export const MCSymbol = (
  <symbol>
    <schematiccircle
      center={{ x: 0, y: 0 }}
      radius={0.45}
      isFilled={false}
      strokeWidth={0.02}
    />

    <schematicpath isFilled={false} points={buildMcInnerPoints()} />

    <schematicline x1={0.45} y1={0} x2={1.0} y2={0} strokeWidth={0.02} />

    <schematiccircle
      center={{ x: 1, y: 0 }}
      radius={0.06}
      isFilled={false}
      strokeWidth={0.02}
    />

    <port name="shaft" direction="right" schX={1.08} schY={0} />
  </symbol>
)