完善AMESim组件界面与仿真求解稳定性

This commit is contained in:
ljz committed 2026-08-02 00:57:48 +08:00
1 parent e7177ab03e
commit 410ef535e8
34 files changed
+3340 -251

No files matched your search

@@ -0,0 +1,217 @@
import {
SYMBOL_ACCENT,
SYMBOL_FILL,
SYMBOL_MUTED,
SYMBOL_STROKE,
SymbolSvg,
} from "./primitives";
const MECHANICAL_LINE_WIDTH = 1.8;
const mechanicalStroke = {
fill: "none",
stroke: SYMBOL_STROKE,
strokeLinecap: "round" as const,
strokeLinejoin: "round" as const,
strokeWidth: MECHANICAL_LINE_WIDTH,
};
function MechanicalSocket({ side }: { side: "left" | "right" }) {
const facingLeft = side === "left";
return (
<g {...mechanicalStroke}>
<path d={facingLeft ? "M2 24h7" : "M55 24h7"} />
<path d={facingLeft ? "M15 19H9v10h6" : "M49 19h6v10h-6"} />
</g>
);
}
function GuideHatching({ y, upward }: { y: number; upward: boolean }) {
const direction = upward ? -1 : 1;
return (
<g stroke={SYMBOL_MUTED} strokeWidth="1">
{[14, 22, 30, 38, 46].map((x) => (
<path
d={`M${x - 3} ${y + direction * 3}L${x + 3} ${y - direction * 3}`}
key={x}
/>
))}
</g>
);
}
export function AmesimF000Symbol() {
return (
<SymbolSvg className="component-symbol-amesim-f000" domain="mechanical">
<path d="M41 24h21" {...mechanicalStroke} />
<rect
fill={SYMBOL_FILL}
height="28"
rx="1"
stroke={SYMBOL_STROKE}
strokeWidth="2.2"
width="18"
x="23"
y="12"
/>
<path d="M27 26h10" stroke={SYMBOL_ACCENT} strokeWidth="2" />
</SymbolSvg>
);
}
export function AmesimForcSymbol() {
return (
<SymbolSvg className="component-symbol-amesim-forc" domain="mechanical">
<g
fill="none"
stroke={SYMBOL_ACCENT}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.8"
>
<path d="M2 24h15" />
<path d="m11 19 6 5-6 5" />
</g>
<circle
cx="32"
cy="24"
fill={SYMBOL_FILL}
r="12"
stroke={SYMBOL_STROKE}
strokeWidth="2"
/>
<text
dominantBaseline="central"
fill={SYMBOL_STROKE}
fontFamily="Arial, sans-serif"
fontSize="13"
fontWeight="600"
textAnchor="middle"
x="32"
y="24"
>
F
</text>
<path d="M44 24h6M50 18v12M50 18h8M50 30h8M58 18v12M58 24h4" {...mechanicalStroke} />
</SymbolSvg>
);
}
export function AmesimMecmas21Symbol() {
return (
<SymbolSvg className="component-symbol-amesim-mecmas21" domain="mechanical">
<GuideHatching upward y={5} />
<GuideHatching upward={false} y={43} />
<path d="M10 8h44M10 40h44" stroke={SYMBOL_MUTED} strokeWidth="1.3" />
<MechanicalSocket side="left" />
<MechanicalSocket side="right" />
<rect
fill={SYMBOL_FILL}
height="26"
rx="1"
stroke={SYMBOL_STROKE}
strokeWidth="2"
width="34"
x="15"
y="11"
/>
<text
dominantBaseline="central"
fill={SYMBOL_STROKE}
fontFamily="Arial, sans-serif"
fontSize="12"
fontWeight="600"
textAnchor="middle"
x="31"
y="28"
>
M
</text>
<path
d="M22 18h15m-5-4 5 4-5 4"
fill="none"
stroke={SYMBOL_ACCENT}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.8"
/>
</SymbolSvg>
);
}
export function AmesimLstp00aSymbol() {
return (
<SymbolSvg className="component-symbol-amesim-lstp00a" domain="mechanical">
<path d="M2 24h8M54 24h8" {...mechanicalStroke} />
<g transform="rotate(90 32 24)">
<path d="M32 2v7M32 39v7" {...mechanicalStroke} />
<path d="M27 9V5h10v4M27 39v4h10v-4" {...mechanicalStroke} />
<rect
fill={SYMBOL_FILL}
height="3"
stroke={SYMBOL_STROKE}
strokeWidth="1.6"
width="46"
x="9"
y="10"
/>
<rect
fill={SYMBOL_FILL}
height="3"
stroke={SYMBOL_STROKE}
strokeWidth="1.6"
width="46"
x="9"
y="31"
/>
<rect
fill={SYMBOL_FILL}
height="3"
stroke={SYMBOL_STROKE}
strokeWidth="1.6"
width="46"
x="9"
y="39"
/>
<path
d="M14 13v4c0 2 12 2 12 4s-12 2-12 4 12 2 12 6"
fill="none"
stroke={SYMBOL_ACCENT}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
/>
<path d="M36 18v-5M36 18h14v6H36v7M40 22h6" {...mechanicalStroke} />
</g>
</SymbolSvg>
);
}
export function AmesimLmechn1Symbol() {
const leftPortRows = [7, 12, 17, 22, 27, 32, 37, 42];
return (
<SymbolSvg className="component-symbol-amesim-lmechn1" domain="mechanical">
<rect
fill={SYMBOL_FILL}
height="44"
rx="1"
stroke={SYMBOL_STROKE}
strokeWidth="1.8"
width="12"
x="27"
y="2"
/>
{leftPortRows.map((y) => (
<path
d={`M5 ${y}h22`}
key={y}
stroke={SYMBOL_STROKE}
strokeLinecap="round"
strokeWidth="1.4"
/>
))}
<path d="M39 24h20" stroke={SYMBOL_STROKE} strokeWidth="1.8" />
<circle cx="33" cy="24" fill={SYMBOL_ACCENT} r="2.2" />
</SymbolSvg>
);
}