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

MP-symbol.tsx

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

function buildMpPoints(): Pt[] {
  const shaftH = 0.05
  const midH = 0.08 // middle section height
  const blockH = 0.12 // block and short section height
  const stepH = 0.09 // long section height

  const noseR = shaftH
  const shaftLen = 0.2 // shaft after nose (longer)
  const midLen = 0.35 // line at mid height (second line - longer)
  const shortLen = 0.02 // SHORT section (third line - longer)
  const longLen = 0.3 // LONG section
  const blockW = 0.12

  const noseCx = -0.55
  const shaftEnd = noseCx + noseR + shaftLen // end of shaft
  const midEnd = shaftEnd + midLen // end of mid section
  const shortEnd = midEnd + shortLen // end of SHORT section
  const longEnd = shortEnd + longLen // end of LONG section
  const blockRight = longEnd + blockW // end of block

  const pts: Pt[] = []

  const noseRight = noseCx + noseR // rightmost point of nose arc
  pts.push({ x: noseRight, y: -shaftH })

  const segs = 12
  for (let i = 0; i <= segs; i++) {
    const a = -Math.PI / 2 - (Math.PI * i) / segs
    pts.push({
      x: noseCx + noseR * Math.cos(a),
      y: noseR * Math.sin(a),
    })
  }

  pts.push({ x: shaftEnd, y: shaftH })

  pts.push({ x: shaftEnd, y: midH })

  pts.push({ x: midEnd, y: midH })

  pts.push({ x: midEnd, y: blockH })

  pts.push({ x: shortEnd, y: blockH })

  pts.push({ x: shortEnd, y: stepH })
  pts.push({ x: longEnd, y: stepH })

  pts.push({ x: longEnd, y: blockH })
  pts.push({ x: blockRight, y: blockH })

  pts.push({ x: blockRight, y: -blockH })

  pts.push({ x: longEnd, y: -blockH })

  pts.push({ x: longEnd, y: -stepH })
  pts.push({ x: shortEnd, y: -stepH })

  pts.push({ x: shortEnd, y: -blockH })

  pts.push({ x: midEnd, y: -blockH })
  pts.push({ x: midEnd, y: -midH })

  pts.push({ x: shaftEnd, y: -midH })

  pts.push({ x: shaftEnd, y: -shaftH })

  pts.push({ x: noseRight, y: -shaftH })

  return pts
}

export const MPSymbol = (
  <symbol>
    {/* Connector body outline */}
    <schematicpath isFilled={false} points={buildMpPoints()} />

    {/* Connection line */}
    <schematicline x1={0.48} y1={0} x2={0.85} y2={0} strokeWidth={0.02} />

    {/* Connection circle */}
    <schematiccircle
      center={{ x: 0.85, y: 0 }}
      radius={0.06}
      isFilled={false}
      strokeWidth={0.02}
    />

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