docs(web): full UI surface inventory, illustrated manual, panel screenshots
Interface design document and manual now share one authoritative surface inventory (333 surfaces across 9 categories, gap 0), and every chapter carries real Playwright screenshots of the panels it documents. - tools/fcweb: ui-surface-scan/ui-surface-inventory (deterministic --check), build-ui-doc renders panel catalog, workbench matrix and mapping tables; blank toolbar crops (<1 KB) are skipped and pruned instead of embedded - web/tools/manual: generate-panel-index (ch16), audit-ui-gaps, generate-final-status, generate-gaps-doc; pager is per-chapter so the manual no longer overflows horizontally - manual: 130 screenshot references / 128 PNGs, panel sections for ch02-ch13 - web/src: utility menus stop click propagation (menu reopened on item click); workbench shell gains an OPFS document picker so workbench.html can bind a real document instead of the fixed workbench-document id; Sketcher panel moves from the command column to the main stage Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ export function UtilityMenus({ onPreferences, onShortcuts, onToggleDock, onPalet
|
||||
`}</style>
|
||||
<button type="button" aria-expanded={open === "Tools"}
|
||||
onClick={() => setOpen(previous => previous === "Tools" ? "" : "Tools")}>Tools
|
||||
{open === "Tools" && <div className="dropdown" role="menu" aria-label="Tools">
|
||||
{open === "Tools" && <div className="dropdown" role="menu" aria-label="Tools" onClick={event => event.stopPropagation()}>
|
||||
<button type="button" onClick={() => { setOpen(""); onPreferences(); }}>Preferences…</button>
|
||||
<button type="button" onClick={() => { setOpen(""); onShortcuts(); }}>Customize shortcuts…</button>
|
||||
<button type="button" onClick={() => { setOpen(""); onPalette(); }}>Command palette… (Ctrl+Shift+P)</button>
|
||||
@@ -24,14 +24,14 @@ export function UtilityMenus({ onPreferences, onShortcuts, onToggleDock, onPalet
|
||||
</button>
|
||||
<button type="button" aria-expanded={open === "Windows"}
|
||||
onClick={() => setOpen(previous => previous === "Windows" ? "" : "Windows")}>Windows
|
||||
{open === "Windows" && <div className="dropdown" role="menu" aria-label="Windows">
|
||||
{open === "Windows" && <div className="dropdown" role="menu" aria-label="Windows" onClick={event => event.stopPropagation()}>
|
||||
<button type="button" onClick={() => { setOpen(""); onToggleDock(); }}>Selection / Report views</button>
|
||||
<span>Tile / floating docks: P3</span>
|
||||
</div>}
|
||||
</button>
|
||||
<button type="button" aria-expanded={open === "Help"}
|
||||
onClick={() => setOpen(previous => previous === "Help" ? "" : "Help")}>Help
|
||||
{open === "Help" && <div className="dropdown" role="menu" aria-label="Help">
|
||||
{open === "Help" && <div className="dropdown" role="menu" aria-label="Help" onClick={event => event.stopPropagation()}>
|
||||
<button type="button" onClick={() => { setOpen(""); window.alert("FreeCAD 1.2 Web · desktop parity shell"); }}>About FreeCAD</button>
|
||||
<a href="/help.html" target="_blank" rel="noopener">Online Help</a>
|
||||
</div>}
|
||||
|
||||
@@ -35,7 +35,7 @@ import { SurfaceGeomFillTask } from "./surface-geomfill-task.js";
|
||||
import { SandboxArchiveTask } from "./sandbox-archive-task.js";
|
||||
import { PlotAxesTask } from "./plot-axes-task.js";
|
||||
import { PointsMergeTask } from "./points-merge-task.js";
|
||||
import { POINTS_COMMAND_PRESENTATION, POINTS_MENU_ORDER, POINTS_TOOLBAR_ORDER } from "./points-command-presentation.js";
|
||||
import { POINTS_COMMAND_PRESENTATION } from "./points-command-presentation.js";
|
||||
import { createSuccess as spreadsheetSuccess } from "./facade-envelope.js";
|
||||
import { StartPreferencesEditor } from "./start-preferences.js";
|
||||
import { RobotWorkbenchUi } from "./robot-workbench-ui.js";
|
||||
@@ -43,6 +43,24 @@ import { RobotToolShapeTask } from "./robot-tool-shape-task.js";
|
||||
import { RobotWaypointTask } from "./robot-waypoint-task.js";
|
||||
import { ROBOT_WAYPOINT_COMMANDS } from "./robot-waypoint-adapter.js";
|
||||
import { RobotDressUpTask } from "./robot-dressup-task.js";
|
||||
import { SurfacePanel } from "./workbenches/Surface/index.js";
|
||||
import { InspectionPanel } from "./workbenches/Inspection/index.js";
|
||||
import { PointsPanel } from "./workbenches/Points/index.js";
|
||||
import { RobotPanel } from "./workbenches/Robot/index.js";
|
||||
import { MaterialPanel } from "./workbenches/Material/index.js";
|
||||
import { ReverseEngineeringPanel } from "./workbenches/ReverseEngineering/index.js";
|
||||
import { FemPanel } from "./workbenches/Fem/index.js";
|
||||
import { SandboxPanel } from "./workbenches/Sandbox/index.js";
|
||||
import { MeshPanel } from "./workbenches/Mesh/index.js";
|
||||
import { BimPanel } from "./workbenches/BIM/index.js";
|
||||
import { MeshPartPanel } from "./workbenches/MeshPart/index.js";
|
||||
import { AssemblyPanel } from "./workbenches/Assembly/index.js";
|
||||
import { TechDrawPanel } from "./workbenches/TechDraw/index.js";
|
||||
import { DraftPanel } from "./workbenches/Draft/index.js";
|
||||
import { PartDesignPanel } from "./workbenches/PartDesign/index.js";
|
||||
import { PartPanel } from "./workbenches/Part/index.js";
|
||||
import { SketcherPanel } from "./workbenches/Sketcher/index.js";
|
||||
import { SpreadsheetWorkspace } from "./workbenches/Spreadsheet/index.js";
|
||||
import { RobotJointTask } from "./robot-joint-task.js";
|
||||
import { RobotPlaybackTask, RobotPoseView, RobotTrajectoryView } from "./robot-playback-task.js";
|
||||
import type { RobotScene } from "./robot-scene.js";
|
||||
@@ -159,7 +177,6 @@ import { BimIfcOpenShellUpdateTask } from "./bim-ifcopenshell-update-task.js";
|
||||
import { bimFrameCommands } from "./bim-desktop-adapter.js";
|
||||
import { BimLibraryTask } from "./bim-library-task.js";
|
||||
import { saveBimFrameDocument, bimExternalUrl } from "./bim-desktop-adapter.js";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { prepareBimDesktopArgs, bimNudgeSetting, orderBimAddSelection } from "./bim-desktop-adapter.js";
|
||||
import { BimSelectedTask } from "./bim-selected-task.js";
|
||||
import { ASSEMBLY_FIXTURE } from "./assembly-facade.js";
|
||||
@@ -250,7 +267,7 @@ import { MATERIAL_FIXTURE } from "./material-facade.js";
|
||||
import { MATERIAL_INSPECT_FIXTURE } from "./material-inspect-facade.js";
|
||||
import { MATERIAL_PYTHON_FIXTURE } from "./material-python-facade.js";
|
||||
import { MATERIAL_PERSISTENCE_FIXTURE } from "./material-persistence-facade.js";
|
||||
import { writeDocumentFile, writeRawStep } from "./storage.js";
|
||||
import { listDocumentFiles, readDocumentFile, writeDocumentFile, writeRawStep } from "./storage.js";
|
||||
import { PARTDESIGN_FIXTURE } from "./partdesign-facade.js";
|
||||
import { PART_FIXTURE } from "./part-facade.js";
|
||||
import { PART_IO_FIXTURE } from "./part-io-facade.js";
|
||||
@@ -270,7 +287,7 @@ import { PythonFamilyDispatcher } from "./python-family-dispatcher.js";
|
||||
import { listWebCommands, WebCommandRuntime, type WebCommandDescriptor } from "./command-runtime.js";
|
||||
import { nativeSourceDecision } from "./native-source-policy.js";
|
||||
import { PythonApiCallDispatcher } from "./python-api-call.js";
|
||||
import { installNavigation, readNavigationContext, updateNavigationContext } from "./navigation.js";
|
||||
import { readNavigationContext, updateNavigationContext } from "./navigation.js";
|
||||
import { installUiAccessibility } from "./ui-accessibility.js";
|
||||
import { PluginRegistry } from "./plugin-registry.js";
|
||||
import { createWorkbenchCommandRequest, type WorkbenchCommandRecord } from "./workbench-command-facade.js";
|
||||
@@ -450,12 +467,39 @@ function KeyboardShortcutEditor({ busy, run, initial }: { busy: boolean; run: (e
|
||||
</fieldset>;
|
||||
}
|
||||
|
||||
function App() {
|
||||
const router = useMemo(() => new WebModuleRouter(), []);
|
||||
export interface WorkbenchShellProps {
|
||||
/** Workbench id; falls back to the URL, then "Part". */
|
||||
module?: string;
|
||||
/** Preselected command; it is highlighted, never auto-run. */
|
||||
command?: string | null;
|
||||
/** Document the panels act on; falls back to the URL. */
|
||||
documentId?: string;
|
||||
/** Shared router when embedded. Owned (and disposed) by this shell when omitted. */
|
||||
router?: WebModuleRouter;
|
||||
/** True only for the /workbench.html entry: emits the global stylesheet, header and navigation. */
|
||||
standalone?: boolean;
|
||||
/** Notified on module switches so the host can keep its own selection in sync. */
|
||||
onModuleChange?: (module: string) => void;
|
||||
}
|
||||
|
||||
export function WorkbenchShell({
|
||||
module: moduleProp, command: commandProp, documentId: documentIdProp,
|
||||
router: routerProp, standalone = true, onModuleChange,
|
||||
}: WorkbenchShellProps) {
|
||||
const ownsRouter = routerProp === undefined;
|
||||
const router = useMemo(() => routerProp ?? new WebModuleRouter(), [routerProp]);
|
||||
const showClippingRequest = useRef<Record<string, unknown> | null>(null);
|
||||
const navigationContext = useMemo(() => readNavigationContext(), []);
|
||||
const initialModule = WEB_MODULE_REGISTRY.some((item) => item.module === navigationContext.module) ? navigationContext.module! : "Part";
|
||||
const requestedModule = moduleProp ?? navigationContext.module;
|
||||
const initialModule = WEB_MODULE_REGISTRY.some((item) => item.module === requestedModule) ? requestedModule! : "Part";
|
||||
const [module, setModule] = useState(initialModule);
|
||||
useEffect(() => {
|
||||
if (moduleProp && moduleProp !== module) {
|
||||
setModule(moduleProp);
|
||||
onModuleChange?.(moduleProp);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [moduleProp]);
|
||||
const workbenchSwitch = useRef<{ cancelled: boolean } | null>(null);
|
||||
const [switchingWorkbenches, setSwitchingWorkbenches] = useState(false);
|
||||
const switchDialog = useRef<HTMLDialogElement>(null);
|
||||
@@ -474,6 +518,11 @@ function App() {
|
||||
const [response, setResponse] = useState<FacadeResponse | null>(null);
|
||||
const [status, setStatus] = useState("选择模块和命令");
|
||||
const [busy, setBusy] = useState(false);
|
||||
// OPFS documents saved from project.html (or an earlier workbench session).
|
||||
// Selecting one runs Std_Open so this shell stops depending on the fixed
|
||||
// "workbench-document" placeholder id.
|
||||
const [opfsDocuments, setOpfsDocuments] = useState<string[]>([]);
|
||||
const [opfsPick, setOpfsPick] = useState("");
|
||||
const [draftNativePreview, setDraftNativePreview] = useState<{ paths: number[][][]; points: number[][] } | null>();
|
||||
const draftPrimitiveOwner = useRef("");
|
||||
const [draftHoverPoint, setDraftHoverPoint] = useState<number[] | null>(null);
|
||||
@@ -489,6 +538,13 @@ function App() {
|
||||
window.addEventListener("freecad-session-closed", close);
|
||||
return () => window.removeEventListener("freecad-session-closed", close);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
listDocumentFiles()
|
||||
.then((names: string[]) => { if (!cancelled) setOpfsDocuments(names); })
|
||||
.catch(() => { if (!cancelled) setOpfsDocuments([]); });
|
||||
return () => { cancelled = true; };
|
||||
}, [module, sessionClosed]);
|
||||
const [commandRuntime] = useState(() => new WebCommandRuntime(router));
|
||||
useEffect(() => {
|
||||
let chooser: HTMLDialogElement | undefined;
|
||||
@@ -560,7 +616,13 @@ function App() {
|
||||
const [sketchView, setSketchView] = useState<SketcherViewState | null>(null);
|
||||
const [nativeDocuments, setNativeDocuments] = useState<Record<string, NativeDocumentTreeState>>({});
|
||||
const sketchCamera = useRef<number[]>();
|
||||
const [documentSelection, setDocumentSelection] = useState<{ documentId: string; selection: Array<{ documentId: string; object: string; subelements?: string[] }> }>({ documentId: navigationContext.documentId ?? "workbench-document", selection: [] });
|
||||
const initialDocumentId = documentIdProp ?? navigationContext.documentId ?? "workbench-document";
|
||||
const [documentSelection, setDocumentSelection] = useState<{ documentId: string; selection: Array<{ documentId: string; object: string; subelements?: string[] }> }>({ documentId: initialDocumentId, selection: [] });
|
||||
// Embedded hosts own the document: follow their active document instead of the URL.
|
||||
useEffect(() => {
|
||||
if (!documentIdProp) return;
|
||||
setDocumentSelection(previous => previous.documentId === documentIdProp ? previous : { documentId: documentIdProp, selection: [] });
|
||||
}, [documentIdProp]);
|
||||
const [detailTaskClosed, setDetailTaskClosed] = useState(false);
|
||||
useEffect(() => { setDetailTaskClosed(false); }, [module, command, documentSelection.documentId]);
|
||||
useEffect(() => {
|
||||
@@ -991,9 +1053,10 @@ function App() {
|
||||
&& ["Part_Slice", "Part_SliceApart"].includes(navigationContext.command ?? "") ? `Part:desktop:${navigationContext.command}` : null);
|
||||
const [stage, setStage] = useState<WorkbenchStage>("ready");
|
||||
useEffect(() => {
|
||||
if (!workbenchSwitch.current) updateNavigationContext({ documentId: documentSelection.documentId, module, command: command ?? undefined });
|
||||
}, [documentSelection.documentId, module, command]);
|
||||
useEffect(() => () => { plugins.dispose(); router.dispose(); }, [plugins, router]);
|
||||
if (!standalone || !workbenchSwitch.current) return;
|
||||
updateNavigationContext({ documentId: documentSelection.documentId, module, command: command ?? undefined });
|
||||
}, [standalone, documentSelection.documentId, module, command]);
|
||||
useEffect(() => () => { plugins.dispose(); if (ownsRouter) router.dispose(); }, [plugins, router]);
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const manifestUrl = params.get("moduleManifest");
|
||||
@@ -1264,6 +1327,10 @@ function App() {
|
||||
}
|
||||
const desktopRecord = moduleMatrixRecords.find((item) => item.kind === "desktop-gui" && item.command === command
|
||||
&& (activationCommand !== undefined || item.id === selectedMatrixId || selectedMatrixId === null))
|
||||
// Std_Open lives in the Std matrix, but every workbench needs it to attach a
|
||||
// real document instead of the fixed "workbench-document" placeholder.
|
||||
?? (command === "Std_Open"
|
||||
? allMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Std_Open") : undefined)
|
||||
?? (module === "ReverseEngineering" && ["Mesh_RemeshGmsh", "Mesh_VertexCurvature", "Mesh_CurvatureInfo"].includes(command ?? "")
|
||||
? allMatrixRecords.find(item => item.kind === "desktop-gui" && item.module === "Mesh" && item.command === command) : undefined)
|
||||
?? ((module === "Web" || module === "Std") && (isStructureCommand(command ?? "") || command === "Std_Group")
|
||||
@@ -2435,9 +2502,12 @@ function App() {
|
||||
}}>Return to workspace</button>
|
||||
</section>;
|
||||
const structureCommand = command?.replace(/^(Web|Std):desktop:/, "");
|
||||
return <div>
|
||||
<style>{css}</style>
|
||||
<style>{desktopParityCss}{tableButtonParityCss}{materialParityCss}{radioParityCss}{checkboxParityCss}{spinBoxParityCss}{lineEditParityCss}{sketcherStatefulCss}{notificationLabelParityCss}{validationStateParityCss}{urlLabelParityCss}{groupBoxParityCss}{sliderParityCss}{progressParityCss}{dialogParityCss}{tabWidgetParityCss}{dateEditParityCss}{comboPopupParityCss}{pushButtonParityCss}{toolButtonParityCss}{listBoxParityCss}{nativeTreeParityCss}</style>
|
||||
const parityCss = `${desktopParityCss}${tableButtonParityCss}${materialParityCss}${radioParityCss}${checkboxParityCss}${spinBoxParityCss}${lineEditParityCss}${sketcherStatefulCss}${notificationLabelParityCss}${validationStateParityCss}${urlLabelParityCss}${groupBoxParityCss}${sliderParityCss}${progressParityCss}${dialogParityCss}${tabWidgetParityCss}${dateEditParityCss}${comboPopupParityCss}${pushButtonParityCss}${toolButtonParityCss}${listBoxParityCss}${nativeTreeParityCss}`;
|
||||
// Embedded inside project.html the #app-prefixed parity rules must not escape the shell.
|
||||
const scopedParityCss = standalone ? parityCss : parityCss.replaceAll("#app", ".fc-workbench-embed");
|
||||
return <div className={standalone ? undefined : "fc-workbench-embed"}>
|
||||
{standalone && <style>{css}</style>}
|
||||
<style>{scopedParityCss}</style>
|
||||
<dialog ref={switchDialog} aria-label="Workbench switching" onCancel={event => {
|
||||
event.preventDefault(); if (workbenchSwitch.current) workbenchSwitch.current.cancelled = true;
|
||||
}}>
|
||||
@@ -3184,9 +3254,10 @@ function App() {
|
||||
{module === "Mesh" && command === "Mesh_BuildRegularSolid" && <MeshPrimitiveTask
|
||||
response={response} busy={busy} execute={args => void run(undefined, args)}
|
||||
onCreated={(documentId, object) => setDocumentSelection({ documentId, selection: [{ documentId, object }] })} />}
|
||||
{module === "Part" && command === "Part_Primitives" && <PartPrimitivesTask
|
||||
key={documentSelection.documentId} router={router} documentId={documentSelection.documentId}
|
||||
response={response} busy={busy} execute={args => void run(undefined, args)} />}
|
||||
{module === "Part" && ["Part_Primitives", "Part_Box", "Part_Cone", "Part_Cylinder", "Part_Sphere", "Part_Torus"].includes(command ?? "") && <PartPrimitivesTask
|
||||
key={`${command}-${documentSelection.documentId}`} router={router} documentId={documentSelection.documentId}
|
||||
response={response} busy={busy} execute={args => void run(undefined, args)}
|
||||
presetPrimitive={({ Part_Box: "Box", Part_Cone: "Cone", Part_Cylinder: "Cylinder", Part_Sphere: "Sphere", Part_Torus: "Torus" } as const)[command as "Part_Box"]} />}
|
||||
{module === "Part" && command && ["Part_Import", "Part_ImportCurveNet"].includes(command) && <PartImportTask key={command} router={router} curveNet={command === "Part_ImportCurveNet"}
|
||||
documentId={documentSelection.documentId} response={response} busy={busy} execute={args => void run(undefined, args)} />}
|
||||
{module === "Part" && command === "Part_Export" && <PartExportTask
|
||||
@@ -3544,58 +3615,26 @@ function App() {
|
||||
{module === "Test" && ["Test_Test", "Test_TestAll", "Test_TestDoc", "Test_TestBase"].includes(command ?? "") && TestSuiteChooser && <TestSuiteChooser
|
||||
key={command} command={command!} response={response} busy={busy} execute={args => void run(undefined, args)}
|
||||
onClose={() => { setCommand(null); setSelectedMatrixId(null); setResponse(null); }} />}
|
||||
{module === "TechDraw" && command === "TechDraw_HoleShaftFit" && <TechDrawFitTask
|
||||
key={`${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} response={response} busy={busy}
|
||||
execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_DecorateLine" && <TechDrawLineDecorationTask
|
||||
key={`${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} selection={documentSelection.selection}
|
||||
busy={busy} response={response} execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_ProjectionGroup" && <TechDrawProjectionGroupTask
|
||||
key={`${documentSelection.documentId}:${techDrawPage}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} page={techDrawPage} response={response} busy={busy}
|
||||
execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_FaceCenterLine"
|
||||
&& !documentSelection.selection.some(item => (item.subelements ?? []).some(sub => sub.startsWith("Face")))
|
||||
&& <TechDrawCenterLineTask
|
||||
key={`${documentSelection.documentId}:${techDrawPage}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} page={techDrawPage} response={response} busy={busy}
|
||||
execute={args => void run(undefined, args)} onActive={setCenterLineTaskActive} />}
|
||||
{module === "TechDraw" && ["TechDraw_Hatch", "TechDraw_GeometricHatch"].includes(command ?? "") && <TechDrawHatchTask
|
||||
key={`${command}:${documentSelection.documentId}:${techDrawPage}:${JSON.stringify(documentSelection.selection)}`}
|
||||
command={command!} documentId={documentSelection.documentId} page={techDrawPage}
|
||||
response={response} busy={busy} execute={args => void run(undefined, args)} onActive={setHatchTaskActive} />}
|
||||
{module === "TechDraw" && command === "TechDraw_Balloon" && <TechDrawBalloonTask
|
||||
key={`${documentSelection.documentId}:${techDrawPage}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} page={techDrawPage} selected={documentSelection.selection.length === 1}
|
||||
response={response} busy={busy} execute={args => void run(undefined, args)}
|
||||
onPlacement={setBalloonPlacement} pagePoint={balloonPagePoint} onActive={setBalloonTaskActive} />}
|
||||
{module === "TechDraw" && command === "TechDraw_LeaderLine" && <TechDrawLeaderLineTask
|
||||
key={`${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} page={techDrawPage} response={response} busy={busy}
|
||||
execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_WeldSymbol" && <TechDrawWeldTask
|
||||
key={documentSelection.documentId} documentId={documentSelection.documentId}
|
||||
selection={documentSelection.selection} busy={busy} router={router} onActive={setWeldTaskActive}
|
||||
execute={args => run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_SurfaceFinishSymbols" && <TechDrawSurfaceFinishTask
|
||||
documentId={documentSelection.documentId} page={techDrawPage} selection={documentSelection.selection}
|
||||
busy={busy} response={response} execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_DimensionRepair" && <TechDrawDimensionRepairTask
|
||||
key={documentSelection.documentId} documentId={documentSelection.documentId}
|
||||
selection={documentSelection.selection} busy={busy} router={router}
|
||||
execute={args => run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_ComplexSection" && <TechDrawComplexSectionTask
|
||||
key={documentSelection.documentId} documentId={documentSelection.documentId}
|
||||
page={techDrawPage} selection={documentSelection.selection} response={response} busy={busy} execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TechDraw_SectionView" && <TechDrawSectionViewTask
|
||||
key={`${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}`} documentId={documentSelection.documentId}
|
||||
selection={documentSelection.selection} busy={busy} execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && command === "TaskDimension" && <TechDrawDimensionTask
|
||||
key={`${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}`}
|
||||
documentId={documentSelection.documentId} response={response} busy={busy}
|
||||
execute={args => void run(undefined, args)} />}
|
||||
{module === "TechDraw" && <TechDrawPanel
|
||||
command={command}
|
||||
router={router}
|
||||
documentId={documentSelection.documentId}
|
||||
selection={documentSelection.selection}
|
||||
page={techDrawPage}
|
||||
response={response}
|
||||
busy={busy}
|
||||
clip={techDrawClip}
|
||||
execute={args => run(undefined, args)}
|
||||
read={() => void run("read")}
|
||||
selectObject={object => setDocumentSelection({ documentId: documentSelection.documentId,
|
||||
selection: [{ documentId: documentSelection.documentId, object }] })}
|
||||
onCenterLineActive={setCenterLineTaskActive}
|
||||
onHatchActive={setHatchTaskActive}
|
||||
onBalloonPlacement={setBalloonPlacement}
|
||||
balloonPagePoint={balloonPagePoint}
|
||||
onBalloonActive={setBalloonTaskActive}
|
||||
onWeldActive={setWeldTaskActive}
|
||||
/>}
|
||||
{module === "Test" && (draftGroups?.documentId === documentSelection.documentId
|
||||
? <TestMdiViewHost key={`draft:${documentSelection.documentId}`} documentId={documentSelection.documentId}>
|
||||
<DraftGeometryView state={draftGroups} select={object => {
|
||||
@@ -3604,17 +3643,15 @@ function App() {
|
||||
}} />
|
||||
</TestMdiViewHost>
|
||||
: <p role="status">当前文档没有已加载的 MDI 视图</p>)}
|
||||
{module === "TechDraw" && command === "TechDraw_ClipGroup" && techDrawClip
|
||||
&& techDrawClip.document === documentSelection.documentId && <section aria-label="Clip group">
|
||||
<p>{techDrawClip.object} — {techDrawClip.page}: {techDrawClip.width} × {techDrawClip.height} mm</p>
|
||||
<p>{techDrawClip.members.length} views; frame {techDrawClip.showFrame ? "shown" : "hidden"}</p>
|
||||
</section>}
|
||||
{module === "TechDraw" && command === "TechDraw_ActiveView" && <TechDrawActiveView
|
||||
key={documentSelection.documentId} documentId={documentSelection.documentId} response={response} busy={busy}
|
||||
read={() => void run("read")} execute={args => void run(undefined, args)} select={object => setDocumentSelection({ documentId: documentSelection.documentId,
|
||||
selection: [{ documentId: documentSelection.documentId, object }] })} />}
|
||||
{draftWorkflowCommand && draftGroupArgs && <DraftWorkflowTask command={command ?? ""} args={draftPrimitive ? { ...primitiveDefaults(draftGroupArgs, currentDraftPlane), ...draftGroupArgs } : draftGroupArgs} update={updateDraftGroupArgs} busy={busy}
|
||||
{draftGroupArgs && (draftWorkflowCommand || draftGeometryCommand) && <DraftPanel
|
||||
command={command}
|
||||
busy={busy}
|
||||
showWorkflow={Boolean(draftWorkflowCommand)}
|
||||
showGeometry={Boolean(draftGeometryCommand)}
|
||||
args={draftGroupArgs}
|
||||
workflowArgs={draftPrimitive ? { ...primitiveDefaults(draftGroupArgs, currentDraftPlane), ...draftGroupArgs } : draftGroupArgs}
|
||||
state={draftGroups?.documentId === documentSelection.documentId ? draftGroups : undefined}
|
||||
update={updateDraftGroupArgs}
|
||||
edit={{ documentId: documentSelection.documentId, selection: documentSelection.selection,
|
||||
execute: async values => {
|
||||
const result = await run(undefined, values);
|
||||
@@ -3623,57 +3660,9 @@ function App() {
|
||||
const state = draftGroupState(result);
|
||||
if (!state) throw new Error("No native edit points returned. Refresh nodes for the current document.");
|
||||
return state;
|
||||
} }} /> }
|
||||
{draftWorkflowCommand && /Draft_(Fillet|Hatch|Heal)$/.test(command ?? "") && <section aria-label="Draft parameters">
|
||||
{(command === "Draft_Fillet" ? [["radius", "Radius", 1]]
|
||||
: command === "Draft_Hatch" ? [["scale", "Scale", 1], ["rotation", "Rotation", 0]] : []).map(([field, label, fallback]) =>
|
||||
<label key={String(field)}>{label}<input type="number" step="any" disabled={busy}
|
||||
value={Number(draftGroupArgs[String(field)] ?? fallback)}
|
||||
onChange={event => updateDraftGroupArgs({ [String(field)]: event.target.valueAsNumber })} /></label>)}
|
||||
{(command === "Draft_Fillet" ? [["chamfer", "Chamfer", false], ["delete", "Delete originals", false]]
|
||||
: command === "Draft_Hatch" ? [["translate", "Translate pattern", true]]
|
||||
: [["delete", "Delete replaced objects", true], ["reparent", "Restore group membership", true]]).map(([field, label, fallback]) =>
|
||||
<label key={String(field)}><input type="checkbox" disabled={busy}
|
||||
checked={Boolean(draftGroupArgs[String(field)] ?? fallback)}
|
||||
onChange={event => updateDraftGroupArgs({ [String(field)]: event.target.checked })} />{label}</label>)}
|
||||
{command === "Draft_Hatch" && <>
|
||||
<label>PAT file<input type="file" accept=".pat" disabled={busy} onChange={event => {
|
||||
const file = event.target.files?.[0];
|
||||
if (file) void file.text().then(patContent => {
|
||||
const patterns = patContent.split(/\r?\n/).filter(line => line.startsWith("*")).map(line => line.split(",")[0].slice(1).trim());
|
||||
updateDraftGroupArgs({ patContent, pattern: patterns[0] ?? "" });
|
||||
}).catch(error => setStatus(String(error)));
|
||||
}} /></label>
|
||||
<label>Pattern<select disabled={busy} value={String(draftGroupArgs.pattern ?? "")}
|
||||
onChange={event => updateDraftGroupArgs({ pattern: event.target.value })}>
|
||||
<option value="">Select pattern</option>
|
||||
{String(draftGroupArgs.patContent ?? "").split(/\r?\n/).filter(line => line.startsWith("*")).map(line => line.split(",")[0].slice(1).trim())
|
||||
.filter((name, index, names) => names.indexOf(name) === index).map(name => <option key={name} value={name}>{name}</option>)}
|
||||
</select></label>
|
||||
</>}
|
||||
</section>}
|
||||
{draftWorkflowCommand && /Draft_(Mirror|Label)$/.test(command ?? "") && <section aria-label="Draft placement">
|
||||
{((command ?? "").endsWith("Draft_Mirror")
|
||||
? [["p1", [0, 0, 0]], ["p2", [0, 10, 0]]]
|
||||
: [["targetPoint", [0, 0, 0]], ["position", [30, 30, 0]], ["normal", [0, 0, 1]]]
|
||||
).map(([field, fallback]) => {
|
||||
const key = field as string;
|
||||
const defaults = fallback as number[];
|
||||
return <fieldset key={key}><legend>{key}</legend>{[0, 1, 2].map(axis => <label key={axis}>{"XYZ"[axis]}<input type="number" step="any" disabled={busy}
|
||||
value={Number((draftGroupArgs?.[key] as number[] | undefined)?.[axis] ?? defaults[axis])}
|
||||
onChange={event => {
|
||||
const value = [...((draftGroupArgs?.[key] as number[] | undefined) ?? defaults)];
|
||||
value[axis] = Number(event.target.value); updateDraftGroupArgs({ [key]: value });
|
||||
}} /></label>)}</fieldset>;
|
||||
})}
|
||||
{(command ?? "").endsWith("Draft_Label") && <>
|
||||
<label>Text <input disabled={busy} value={String(draftGroupArgs?.text ?? "Label")} onChange={event => updateDraftGroupArgs({ text: event.target.value })} /></label>
|
||||
<label>Label type <input disabled={busy} value={String(draftGroupArgs?.labelType ?? "Custom")} onChange={event => updateDraftGroupArgs({ labelType: event.target.value })} /></label>
|
||||
<label>Direction <select disabled={busy} value={String(draftGroupArgs?.direction ?? "Horizontal")} onChange={event => updateDraftGroupArgs({ direction: event.target.value })}><option>Horizontal</option><option>Vertical</option></select></label>
|
||||
<label>Distance <input type="number" step="any" disabled={busy} value={Number(draftGroupArgs?.distance ?? -10)} onChange={event => updateDraftGroupArgs({ distance: Number(event.target.value) })} /></label>
|
||||
</>}
|
||||
</section>}
|
||||
{draftGeometryCommand && draftGroupArgs && <DraftGeometryTask command={command ?? ""} args={draftGroupArgs} update={updateDraftGroupArgs} busy={busy} />}
|
||||
} }}
|
||||
onStatus={setStatus}
|
||||
/>}
|
||||
{module === "Draft" && (draftPrimitive || ["Draft_Line", "Draft_Wire", "Draft_Move", "Draft_Mirror", "Draft_Offset"].includes(draftViewportCommand)) && <section aria-label="Draft viewport drawing">
|
||||
{draftPrimitive && <>
|
||||
<p aria-live="polite">{draftViewportCommand === "Draft_Point" ? "Pick placement point, then Finish" : draftGroupArgs.primitiveStage === 1 ? draftViewportCommand === "Draft_Polygon" ? "Pick radius point, or choose a tangent edge" : "Pick opposite corner" : draftGroupArgs.primitiveStage === 2 ? "Ready to finish; numeric values remain editable" : draftViewportCommand === "Draft_Polygon" ? "Pick polygon center" : "Pick first corner"}</p>
|
||||
@@ -3853,84 +3842,33 @@ function App() {
|
||||
if (scale.every(value => Number.isFinite(value) && Math.abs(value) >= 1e-10)) updateDraftGroupArgs({ scale });
|
||||
}
|
||||
} : undefined} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_CreateAssembly" && <AssemblyCreateTask
|
||||
key="Assembly_CreateAssembly"
|
||||
{module === "Assembly" && <AssemblyPanel
|
||||
command={command}
|
||||
router={router}
|
||||
documentId={documentSelection.documentId}
|
||||
create={({ documentId: id, assembly }) => {
|
||||
desktopCommands.setActiveAssembly(id, assembly);
|
||||
setDocumentSelection({ documentId: id, selection: [] });
|
||||
setCommand("Assembly_InsertLink");
|
||||
setSelectedMatrixId("Assembly:desktop:Assembly_InsertLink");
|
||||
}}
|
||||
close={() => { setCommand(null); setSelectedMatrixId(null); setResponse(null); }} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_InsertLink" && <AssemblyInsertLinkTask
|
||||
key={`${documentSelection.documentId}:Assembly_InsertLink`}
|
||||
documentId={documentSelection.documentId}
|
||||
selection={documentSelection.selection}
|
||||
busy={busy}
|
||||
assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
execute={(args, id) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_InsertLink");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-insert-link", "command_unavailable", "Insert Link command is unavailable"));
|
||||
taskPanelGeneration={taskPanelGeneration}
|
||||
hasCommand={name => moduleMatrixRecords.some(item => item.kind === "desktop-gui" && item.command === name)}
|
||||
execute={(name, args, id) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === name);
|
||||
if (!record) return null;
|
||||
if (name === "Assembly_ActivateAssembly" && args.action !== "read") {
|
||||
setBusy(true);
|
||||
return desktopCommands.execute(record, args, id).finally(() => setBusy(false));
|
||||
}
|
||||
return desktopCommands.execute(record, args, id);
|
||||
}}
|
||||
close={() => { setCommand(null); setSelectedMatrixId(null); setResponse(null); }} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_ActivateAssembly" && <AssemblyActivationTask
|
||||
key={documentSelection.documentId} documentId={documentSelection.documentId} blocked={busy}
|
||||
failure={(id, code, message) => createFailure(id, code, message)}
|
||||
createAssembly={(id, assembly) => {
|
||||
desktopCommands.setActiveAssembly(id, assembly);
|
||||
setDocumentSelection({ documentId: id, selection: [] });
|
||||
}}
|
||||
setSelection={(id, selection) => setDocumentSelection({ documentId: id, selection })}
|
||||
close={() => { setCommand(null); setSelectedMatrixId(null); setResponse(null); }}
|
||||
execute={async (args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_ActivateAssembly");
|
||||
if (!record) return createFailure("assembly-activation", "command_unavailable", "Activation command is unavailable");
|
||||
if (args.action === "read") return desktopCommands.execute(record, args, documentId);
|
||||
setBusy(true);
|
||||
try { return await desktopCommands.execute(record, args, documentId); }
|
||||
finally { setBusy(false); }
|
||||
}} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_ActivateAssembly" && <AssemblyExplodedViewTask
|
||||
key="Assembly_ActivateAssembly"
|
||||
documentId={documentSelection.documentId} assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
selection={documentSelection.selection} select={(documentId, selection) => setDocumentSelection({ documentId, selection })}
|
||||
execute={(args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_CreateView");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-viewport-edit", "command_unavailable", "Assembly viewport edit command is unavailable"));
|
||||
return desktopCommands.execute(record, args, documentId);
|
||||
}} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_CreateView" && <AssemblyExplodedViewTask
|
||||
key="Assembly_CreateView"
|
||||
documentId={documentSelection.documentId} assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
selection={documentSelection.selection} select={(documentId, selection) => setDocumentSelection({ documentId, selection })}
|
||||
execute={(args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_CreateView");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-exploded-view", "command_unavailable", "Exploded view command is unavailable"));
|
||||
return desktopCommands.execute(record, args, documentId);
|
||||
}} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_CreateSimulation" && <AssemblySimulationTask
|
||||
key={`${documentSelection.documentId}:${desktopCommands.getActiveAssembly(documentSelection.documentId) ?? ""}`}
|
||||
documentId={documentSelection.documentId} assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
selection={documentSelection.selection} select={(documentId, selection) => setDocumentSelection({ documentId, selection })}
|
||||
execute={(args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_CreateSimulation");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-simulation", "command_unavailable", "Simulation command is unavailable"));
|
||||
return desktopCommands.execute(record, args, documentId);
|
||||
}} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_CreateBom"
|
||||
&& moduleMatrixRecords.some(item => item.kind === "desktop-gui" && item.command === "Assembly_CreateBom") && <AssemblyBomTask
|
||||
key={`${documentSelection.documentId}:${taskPanelGeneration}`}
|
||||
documentId={documentSelection.documentId} assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
selection={documentSelection.selection} select={(documentId, selection) => setDocumentSelection({ documentId, selection })}
|
||||
execute={(args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_CreateBom");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-bom", "command_unavailable", "BOM command is unavailable"));
|
||||
return desktopCommands.execute(record, args, documentId);
|
||||
}} />}
|
||||
{module === "Assembly" && command?.replace(/^Assembly:desktop:/, "") === "Assembly_InsertNewPart" && <AssemblyNewPartTask
|
||||
key={`${documentSelection.documentId}:${desktopCommands.getActiveAssembly(documentSelection.documentId) ?? ""}`}
|
||||
router={router} documentId={documentSelection.documentId} assembly={desktopCommands.getActiveAssembly(documentSelection.documentId)}
|
||||
selection={documentSelection.selection} select={(documentId, selection) => setDocumentSelection({ documentId, selection })}
|
||||
execute={(args, documentId) => {
|
||||
const record = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Assembly_InsertNewPart");
|
||||
if (!record) return Promise.resolve(createFailure("assembly-new-part", "command_unavailable", "New Part command is unavailable"));
|
||||
return desktopCommands.execute(record, args, documentId);
|
||||
}} />}
|
||||
onCommand={name => { setCommand(name); setSelectedMatrixId(name ? `Assembly:desktop:${name}` : null); }}
|
||||
/>}
|
||||
{module === "Robot" && command?.replace(/^Robot:desktop:/, "") !== "Robot_AddToolShape" && <RobotJointTask
|
||||
key={`joints:${documentSelection.documentId}:${JSON.stringify(documentSelection.selection)}:${response?.requestId ?? ""}`}
|
||||
requested={true}
|
||||
@@ -4145,7 +4083,7 @@ function App() {
|
||||
style={{ display: "block", maxWidth: "100%", maxHeight: 480, objectFit: "contain" }} />
|
||||
</figure>)}
|
||||
</section>}
|
||||
<header className="top"><span className="brand">FC</span><span>FreeCAD 1.2 Web</span><strong className="title">统一工作台</strong></header>
|
||||
{standalone && <header className="top"><span className="brand">FC</span><span>FreeCAD 1.2 Web</span><strong className="title">统一工作台</strong></header>}
|
||||
{module === "Robot" && <RobotWorkbenchUi router={router} documentId={documentSelection.documentId}
|
||||
disabled={busy || sessionClosed || switchingWorkbenches}
|
||||
available={name => moduleMatrixRecords.some(item => item.kind === "desktop-gui" && item.command === name)}
|
||||
@@ -4219,12 +4157,13 @@ function App() {
|
||||
<option value="2">Stack Up</option>
|
||||
<option value="3">Stack Down</option>
|
||||
</select></label>}
|
||||
{module === "MeshPart" && (command === "MeshPart" || command === "MeshPart:desktop:MeshPart") &&
|
||||
<nav aria-label="MeshPart toolbar"><button disabled={busy} onClick={() => {
|
||||
setCommand("MeshPart_Mesher");
|
||||
setPayloadText(commandPayload("MeshPart", "MeshPart_Mesher"));
|
||||
{module === "MeshPart" && <MeshPartPanel module={module} command={command} resolve={() => undefined}
|
||||
enabled={() => !busy}
|
||||
activate={(name) => {
|
||||
setCommand(name);
|
||||
setPayloadText(commandPayload("MeshPart", name));
|
||||
setResponse(null);
|
||||
}}>Create mesh from shape</button></nav>}
|
||||
}} />}
|
||||
{partDesignChildren && <label>Command <select aria-label="PartDesign group command"
|
||||
disabled={busy || !partDesignGroupArgs}
|
||||
value={String(partDesignGroupArgs?.childCommand ?? partDesignChildren[0])}
|
||||
@@ -4383,6 +4322,30 @@ function App() {
|
||||
</aside>
|
||||
<aside>
|
||||
<h2 className="heading">{module} commands</h2>
|
||||
<details className="workbench-document-picker">
|
||||
<summary>文档 · 打开 OPFS FCStd</summary>
|
||||
<label>OPFS 文档
|
||||
<select aria-label="Workbench document" value={opfsPick}
|
||||
disabled={busy || !opfsDocuments.length}
|
||||
onChange={event => setOpfsPick(event.target.value)}>
|
||||
<option value="">{opfsDocuments.length ? "选择 OPFS 文档" : "OPFS 中没有文档"}</option>
|
||||
{opfsDocuments.map(name => <option key={name} value={name}>{name}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<button type="button" disabled={busy || !opfsPick}
|
||||
onClick={() => void (async () => {
|
||||
// Documents saved by project.html live in freecad-documents, so read the
|
||||
// bytes and hand the open adapter a File instead of a stored-file key.
|
||||
try {
|
||||
const bytes = await readDocumentFile(opfsPick);
|
||||
await run(undefined, { runtimeOwner: "PartBox", operation: "open",
|
||||
files: [new File([bytes], opfsPick, { type: "application/octet-stream" })] }, "Std_Open");
|
||||
} catch (error) { setStatus(error instanceof Error ? error.message : String(error)); }
|
||||
})()}>
|
||||
打开所选文档
|
||||
</button>
|
||||
<p role="status">当前文档:{documentSelection.documentId || "未绑定"}</p>
|
||||
</details>
|
||||
{module === "TemplatePyMod" && <TemplatePyModCommandSurfaces busy={busy || pythonQtActive}
|
||||
hasDocument={Boolean(documentSelection.documentId)}
|
||||
available={name => moduleMatrixRecords.some(item => item.kind === "desktop-gui" && item.command === name)}
|
||||
@@ -4439,72 +4402,31 @@ function App() {
|
||||
}} />
|
||||
{module === "Points" && (() => {
|
||||
const selectedCount = documentSelection.selection.filter(item => item.documentId === documentSelection.documentId).length;
|
||||
const enabled = (name: string) => !busy && (name === "Points_Import" || name === "Points_Convert" || name === "Points_Export" || name === "Points_PolyCut"
|
||||
const pointsEnabled = (name: string) => !busy && (name === "Points_Import" || name === "Points_Convert" || name === "Points_Export" || name === "Points_PolyCut"
|
||||
? selectedCount > 0 : name === "Points_Structure" ? selectedCount === 1 : selectedCount > 1);
|
||||
const activate = (name: string) => {
|
||||
const activatePoints = (name: string) => {
|
||||
const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name);
|
||||
setCommand(name); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload("Points", name)); setResponse(null);
|
||||
setStatus(enabled(name) ? POINTS_COMMAND_PRESENTATION.find(item => item.command === name)?.statusTip ?? "准备执行 Points 命令" : "当前选择不满足 Points 命令条件");
|
||||
setStatus(pointsEnabled(name) ? POINTS_COMMAND_PRESENTATION.find(item => item.command === name)?.statusTip ?? "准备执行 Points 命令" : "当前选择不满足 Points 命令条件");
|
||||
};
|
||||
const renderEntry = (name: string, key: string, role: "menuitem" | "button") => {
|
||||
const item = POINTS_COMMAND_PRESENTATION.find(entry => entry.command === name)!;
|
||||
const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name);
|
||||
const label = item.menuText.replace(/…$/, "");
|
||||
return <button key={key} type="button" role={role} data-command={name} data-help-page={name} data-command-icon={item.icon}
|
||||
className={`command ${name === command ? "selected" : ""}`} disabled={!enabled(name)} onClick={() => activate(name)}
|
||||
title={item.toolTipText} aria-label={item.menuText} data-desktop-command-id={matrix?.id}>
|
||||
<span aria-hidden="true" className="points-command-icon" data-icon-name={item.icon} />{label}
|
||||
</button>;
|
||||
};
|
||||
return <section aria-label="Points Tools" className="points-entrypoints">
|
||||
<h3 className="heading">Points Tools</h3>
|
||||
<div role="toolbar" aria-label="Points Tools" data-desktop-toolbar="Points Tools">
|
||||
{POINTS_TOOLBAR_ORDER.map((entry, index) => <React.Fragment key={`${entry}-${index}`}>
|
||||
{entry === "Separator" ? <span role="separator" aria-orientation="vertical" /> : renderEntry(entry, `toolbar-${entry}`, "button")}
|
||||
</React.Fragment>)}
|
||||
</div>
|
||||
<nav aria-label="Points menu" className="points-menu" data-desktop-menu="&Points">
|
||||
<h4>&Points</h4><div role="menubar" aria-label="&Points">
|
||||
{POINTS_MENU_ORDER.map((entry, index) => <React.Fragment key={`${entry}-${index}`}>
|
||||
{entry === "Separator" ? <span role="separator" aria-orientation="horizontal" /> : renderEntry(entry, `menu-${entry}`, "menuitem")}
|
||||
</React.Fragment>)}
|
||||
</div>
|
||||
</nav>
|
||||
</section>;
|
||||
return <PointsPanel module={module} command={command} activate={activatePoints} enabled={pointsEnabled}
|
||||
resolve={name => commandDescriptors.find(item => item.command === name)}
|
||||
matrixId={name => moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name)?.id} />;
|
||||
})()}
|
||||
{module === "ReverseEngineering" && (() => {
|
||||
const groups = [
|
||||
{ label: "Surface Reconstruction", commands: ["Reen_PoissonReconstruction", "Reen_ViewTriangulation"] },
|
||||
{ label: "Segmentation", commands: ["Mesh_RemeshGmsh", "Mesh_VertexCurvature", "Mesh_CurvatureInfo", "Reen_Segmentation", "Reen_SegmentationManual", "Reen_SegmentationFromComponents", "Reen_MeshBoundary"] },
|
||||
{ label: "Approximation", commands: ["Reen_ApproxPlane", "Reen_ApproxCylinder", "Reen_ApproxSphere", "Reen_ApproxPolynomial", "Reen_ApproxSurface", "Reen_ApproxCurve"] },
|
||||
];
|
||||
const available = (name: string) => moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name)
|
||||
?? allMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === "Mesh" && record.command === name);
|
||||
const activate = (name: string) => {
|
||||
const activateReen = (name: string) => {
|
||||
const matrix = available(name);
|
||||
setCommand(name); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload("ReverseEngineering", name)); setResponse(null);
|
||||
setStatus(matrix ? "准备执行 Reverse Engineering 命令" : "该 Reverse Engineering 命令当前不可用");
|
||||
};
|
||||
const render = (name: string, role: "menuitem" | "button") => {
|
||||
const matrix = available(name);
|
||||
if (!matrix) return null;
|
||||
const label = name.replace(/^Reen_/, "").replace(/^Mesh_/, "").replace(/([a-z])([A-Z])/g, "$1 $2");
|
||||
return <button key={`${role}-${name}`} type="button" role={role} data-command={name}
|
||||
data-desktop-command-id={matrix.id} className={`command ${command === name ? "selected" : ""}`}
|
||||
disabled={busy} onClick={() => activate(name)} title={name} aria-label={label}><span>{label}</span></button>;
|
||||
};
|
||||
return <section aria-label="Reverse Engineering workbench commands" className="reverseengineering-entrypoints">
|
||||
<h3 className="heading">Reverse Engineering</h3>
|
||||
<div role="toolbar" aria-label="Reverse Engineering toolbar" data-desktop-toolbar="Reverse Engineering">
|
||||
{render("Reen_ApproxSurface", "button")}
|
||||
</div>
|
||||
<nav aria-label="Reverse Engineering menu" data-desktop-menu="&Reverse Engineering">
|
||||
<h4>&Reverse Engineering</h4>
|
||||
{groups.map(group => <div key={group.label} role="group" aria-label={group.label}>
|
||||
<h5>{group.label}</h5><div role="menubar" aria-label={group.label}>{group.commands.map(name => render(name, "menuitem"))}</div>
|
||||
</div>)}
|
||||
</nav>
|
||||
</section>;
|
||||
return <ReverseEngineeringPanel module={module} command={command} activate={activateReen}
|
||||
resolve={name => {
|
||||
const matrix = available(name);
|
||||
return matrix ? { id: matrix.id, module: "ReverseEngineering", command: name, worker: null, category: "boundary", runnable: false, reason: matrix.capabilityReason ?? "desktop Reverse Engineering command" } : undefined;
|
||||
}}
|
||||
enabled={() => !busy} />;
|
||||
})()}
|
||||
{module === "Sandbox" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
@@ -4513,46 +4435,16 @@ function App() {
|
||||
const record = matrixByCommand.get(name);
|
||||
return record ? { id: record.id, module: "Sandbox", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop Sandbox command is restricted" } : undefined;
|
||||
})();
|
||||
type SandboxCommand = (typeof commandDescriptors)[number];
|
||||
const present = (names: string[]) => names.map(sandboxItem).filter((item): item is SandboxCommand => Boolean(item));
|
||||
const sandboxMenuGroups = [
|
||||
{ label: "Threads", items: ["Sandbox_Thread", "Sandbox_TestThread", "Sandbox_SaveThread", "Sandbox_WorkerThread", "Sandbox_SeqThread", "Sandbox_BlockThread", "Sandbox_NoThread"], nested: { label: "Python Threads", items: ["Sandbox_PythonLockThread", "Sandbox_NolockPython", "Sandbox_PySideThread", "Sandbox_PythonThread", "Sandbox_PythonMainThread"] }, trailing: ["Sandbox_Dialog", "Sandbox_FileDialog"] },
|
||||
{ label: "Misc", items: ["Sandbox_EventLoop", "Sandbox_MeshLoad", "Sandbox_MeshLoaderBoost", "Sandbox_MeshLoaderFuture", "Sandbox_MeshTestJob", "Sandbox_MeshTestRef", "Sandbox_CryptographicHash", "Sandbox_MengerSponge"] },
|
||||
{ label: "Widgets", items: ["Std_GrabWidget", "Std_ImageNode", "Sandbox_WidgetShape", "Sandbox_GDIWidget", "Sandbox_RedirectPaint", "Std_TestGraphicsView", "Std_TestTaskBox"] },
|
||||
].map(group => ({ ...group, items: present(group.items), nested: group.nested && { ...group.nested, items: present(group.nested.items) }, trailing: group.trailing && present(group.trailing) }));
|
||||
const sandboxToolbar = present(["Sandbox_Thread", "Sandbox_WorkerThread", "Sandbox_SeqThread", "Sandbox_BlockThread", "Sandbox_NoThread", "Sandbox_Dialog", "Sandbox_FileDialog"]);
|
||||
const sandboxCommands = [...sandboxMenuGroups.flatMap(group => [...group.items, ...(group.nested?.items ?? []), ...(group.trailing ?? [])]), ...sandboxToolbar.filter(item => !sandboxMenuGroups.some(group => [...group.items, ...(group.nested?.items ?? []), ...(group.trailing ?? [])].includes(item)))];
|
||||
const activateSandbox = (item: typeof sandboxCommands[number]) => {
|
||||
setCommand(item.command);
|
||||
const matrix = moduleMatrixRecords.find((record) => record.kind === "desktop-gui" && record.module === module && record.command === item.command);
|
||||
const activateSandbox = (name: string) => {
|
||||
const item = sandboxItem(name);
|
||||
setCommand(name);
|
||||
const matrix = moduleMatrixRecords.find((record) => record.kind === "desktop-gui" && record.module === module && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null);
|
||||
setPayloadText(commandPayload(module, item.command));
|
||||
setPayloadText(commandPayload(module, name));
|
||||
setResponse(null);
|
||||
setStatus(item.runnable ? "准备执行 Sandbox 命令" : `受限:${item.reason}`);
|
||||
setStatus(item?.runnable ? "准备执行 Sandbox 命令" : `受限:${item?.reason ?? "unknown Sandbox command"}`);
|
||||
};
|
||||
const renderSandboxEntry = (item: typeof sandboxCommands[number], role: "menuitem" | "button") =>
|
||||
<button type="button" role={role} data-command={item.command} data-help-page={item.command.replace(/^.*:desktop:/, "")}
|
||||
className={`command ${item.command === command ? "selected" : ""}`} onClick={() => activateSandbox(item)}
|
||||
aria-label={item.command} title={item.reason ?? "Sandbox command"}>
|
||||
<span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small>
|
||||
</button>;
|
||||
return <section aria-label="Sandbox workbench commands" className="sandbox-entrypoints">
|
||||
<h3 className="heading">Sandbox Tools</h3>
|
||||
<div role="toolbar" aria-label="Sandbox Tools" data-desktop-toolbar="Sandbox Tools">
|
||||
{sandboxToolbar.map((item) => renderSandboxEntry(item, "button"))}
|
||||
</div>
|
||||
<nav aria-label="Sandbox menu" className="sandbox-menu" data-desktop-menu="&Sandbox">
|
||||
<h4>&Sandbox</h4><div role="menubar" aria-label="&Sandbox">
|
||||
{sandboxMenuGroups.map(group => <div key={group.label} role="group" aria-label={group.label} data-sandbox-group={group.label}>
|
||||
<h5>{group.label}</h5><div role="menubar" aria-label={group.label}>
|
||||
{group.items.map(item => renderSandboxEntry(item, "menuitem"))}
|
||||
{group.nested && <div role="group" aria-label={group.nested.label} data-sandbox-group={group.nested.label}><h6>{group.nested.label}</h6><div role="menubar" aria-label={group.nested.label}>{group.nested.items.map(item => renderSandboxEntry(item, "menuitem"))}</div></div>}
|
||||
{group.trailing?.map(item => renderSandboxEntry(item, "menuitem"))}
|
||||
</div>
|
||||
</div>)}
|
||||
</div>
|
||||
</nav>
|
||||
</section>;
|
||||
return <SandboxPanel module={module} command={command} resolve={sandboxItem} activate={activateSandbox} />;
|
||||
})()}
|
||||
{module === "Surface" && (() => {
|
||||
type SurfaceCommand = WebCommandDescriptor;
|
||||
@@ -4562,21 +4454,15 @@ function App() {
|
||||
const record = matrixByCommand.get(name);
|
||||
return record ? { id: record.id, module: "Surface", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop Surface command is restricted" } : undefined;
|
||||
})();
|
||||
const present = (names: string[]) => names.map(surfaceItem).filter((item): item is SurfaceCommand => Boolean(item));
|
||||
const surfaceCommands = present(["Surface_Filling", "Surface_GeomFillSurface", "Surface_Sections", "Surface_ExtendFace", "Surface_CurveOnMesh", "Surface_BlendCurve"]);
|
||||
const activateSurface = (item: SurfaceCommand) => {
|
||||
setCommand(item.command);
|
||||
const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === item.command);
|
||||
const activateSurface = (name: string) => {
|
||||
setCommand(name);
|
||||
const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null);
|
||||
setPayloadText(commandPayload(module, item.command)); setResponse(null);
|
||||
setStatus(item.runnable ? "准备执行 Surface 命令" : `受限:${item.reason}`);
|
||||
setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const item = surfaceItem(name);
|
||||
setStatus(item?.runnable ? "准备执行 Surface 命令" : `受限:${item?.reason ?? "unknown Surface command"}`);
|
||||
};
|
||||
const renderSurface = (item: SurfaceCommand, role: "menuitem" | "button") => <button type="button" role={role} data-command={item.command} data-help-page={item.command.replace(/^.*:desktop:/, "")} className={`command ${item.command === command ? "selected" : ""}`} onClick={() => activateSurface(item)} aria-label={item.command} title={item.reason ?? "Surface command"}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>;
|
||||
return <section aria-label="Surface workbench commands" className="surface-entrypoints">
|
||||
<h3 className="heading">Surface Tools</h3>
|
||||
<div role="toolbar" aria-label="Surface" data-desktop-toolbar="Surface">{surfaceCommands.map(item => renderSurface(item, "button"))}</div>
|
||||
<nav aria-label="Surface menu" className="surface-menu" data-desktop-menu="&Surface"><h4>&Surface</h4><div role="menubar" aria-label="&Surface">{surfaceCommands.map(item => renderSurface(item, "menuitem"))}</div></nav>
|
||||
</section>;
|
||||
return <SurfacePanel module={module} command={command} resolve={surfaceItem} activate={activateSurface} />;
|
||||
})()}
|
||||
{module === "Inspection" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
@@ -4585,115 +4471,66 @@ function App() {
|
||||
const record = matrixByCommand.get(name);
|
||||
return record ? { id: record.id, module: "Inspection", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop Inspection command is restricted" } : undefined;
|
||||
})();
|
||||
const inspectionCommands = ["Inspection_VisualInspection", "Inspection_InspectElement"].map(inspectionItem).filter((item): item is WebCommandDescriptor => Boolean(item));
|
||||
const activateInspection = (item: WebCommandDescriptor) => {
|
||||
setCommand(item.command); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === item.command);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null);
|
||||
setStatus(item.runnable ? "准备执行 Inspection 命令" : `受限:${item.reason}`);
|
||||
const activateInspection = (name: string) => {
|
||||
setCommand(name); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const item = inspectionItem(name);
|
||||
setStatus(item?.runnable ? "准备执行 Inspection 命令" : `受限:${item?.reason ?? "unknown Inspection command"}`);
|
||||
};
|
||||
return <nav aria-label="Inspection menu" className="inspection-menu" data-desktop-menu="&Inspection"><h4>&Inspection</h4><div role="menubar" aria-label="&Inspection">{inspectionCommands.map(item => <button key={item.command} type="button" role="menuitem" data-command={item.command} data-help-page={item.command} className={`command ${item.command === command ? "selected" : ""}`} onClick={() => activateInspection(item)} aria-label={item.command} title={item.reason ?? "Inspection command"}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>)}</div></nav>;
|
||||
return <InspectionPanel module={module} command={command} resolve={inspectionItem} activate={activateInspection} />;
|
||||
})()}
|
||||
{module === "Mesh" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
const matrixByCommand = new Map(moduleMatrixRecords.filter(item => item.kind === "desktop-gui").map(item => [item.command, item]));
|
||||
const meshItem = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "Mesh", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop Mesh command is restricted" } : undefined; })();
|
||||
const present = (names: string[]) => names.map(meshItem).filter((item): item is WebCommandDescriptor => Boolean(item));
|
||||
const menuGroups = [
|
||||
{ label: "Analyze", items: ["Mesh_Evaluation", "Mesh_EvaluateFacet", "Mesh_CurvatureInfo", "Mesh_EvaluateSolid", "Mesh_BoundingBox"] },
|
||||
{ label: "Boolean", items: ["Mesh_Union", "Mesh_Intersection", "Mesh_Difference"] },
|
||||
{ label: "Cutting", items: ["Mesh_PolyCut", "Mesh_PolyTrim", "Mesh_TrimByPlane", "Mesh_SectionByPlane", "Mesh_CrossSections"] },
|
||||
].map(group => ({ ...group, commands: present(group.items) }));
|
||||
const directMenu = present(["Mesh_Import", "Mesh_Export", "Mesh_FromPartShape", "Mesh_RemeshGmsh", "Mesh_VertexCurvature", "Mesh_HarmonizeNormals", "Mesh_FlipNormals", "Mesh_FillupHoles", "Mesh_FillInteractiveHole", "Mesh_AddFacet", "Mesh_RemoveComponents", "Mesh_RemoveCompByHand", "Mesh_Segmentation", "Mesh_SegmentationBestFit", "Mesh_Smoothing", "Mesh_Decimating", "Mesh_Scale", "Mesh_BuildRegularSolid", "Mesh_Merge", "Mesh_SplitComponents"]);
|
||||
const toolbars = [
|
||||
{ label: "Mesh Tools", commands: present(["Mesh_Import", "Mesh_Export", "Mesh_FromPartShape", "Mesh_BuildRegularSolid"]) },
|
||||
{ label: "Mesh Modify", commands: present(["Mesh_HarmonizeNormals", "Mesh_FlipNormals", "Mesh_FillupHoles", "Mesh_FillInteractiveHole", "Mesh_AddFacet", "Mesh_RemoveComponents", "Mesh_Smoothing", "Mesh_RemeshGmsh", "Mesh_Decimating", "Mesh_Scale"]) },
|
||||
{ label: "Mesh Boolean", commands: present(["Mesh_Union", "Mesh_Intersection", "Mesh_Difference"]) },
|
||||
{ label: "Mesh Cutting", commands: present(["Mesh_PolyCut", "Mesh_PolyTrim", "Mesh_TrimByPlane", "Mesh_SectionByPlane", "Mesh_CrossSections"]) },
|
||||
{ label: "Mesh Segmentation", commands: present(["Mesh_Merge", "Mesh_SplitComponents", "Mesh_Segmentation", "Mesh_SegmentationBestFit"]) },
|
||||
{ label: "Mesh Analyze", commands: present(["Mesh_Evaluation", "Mesh_EvaluateFacet", "Mesh_VertexCurvature", "Mesh_CurvatureInfo", "Mesh_EvaluateSolid", "Mesh_BoundingBox"]) },
|
||||
];
|
||||
const commandBars = [{ label: "Mesh Tools", commands: present(["Mesh_Import", "Mesh_Export", "Mesh_PolyCut"]) }];
|
||||
const activate = (item: WebCommandDescriptor) => { setCommand(item.command); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行 Mesh 命令" : `受限:${item.reason}`); };
|
||||
const render = (item: WebCommandDescriptor, role: "menuitem" | "button") => <button key={item.command} type="button" role={role} data-command={item.command} data-help-page={item.command} className={`command ${item.command === command ? "selected" : ""}`} onClick={() => activate(item)} aria-label={item.command} title={item.reason ?? "Mesh command"}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>;
|
||||
return <section aria-label="Mesh workbench commands" className="mesh-entrypoints"><h3 className="heading">Mesh Tools</h3>{toolbars.map(toolbar => <div key={toolbar.label} role="toolbar" aria-label={toolbar.label} data-desktop-toolbar={toolbar.label}>{toolbar.commands.map(item => render(item, "button"))}</div>)}{commandBars.map(bar => <div key={`commandbar-${bar.label}`} role="toolbar" aria-label={`Command bar ${bar.label}`} data-desktop-commandbar={bar.label}>{bar.commands.map(item => render(item, "button"))}</div>)}<nav aria-label="Meshes menu" className="mesh-menu" data-desktop-menu="&Meshes"><h4>&Meshes</h4><div role="menubar" aria-label="&Meshes">{directMenu.slice(0, 4).map(item => render(item, "menuitem"))}<div role="group" aria-label="Analyze" data-mesh-group="Analyze">{menuGroups[0].commands.map(item => render(item, "menuitem"))}</div>{directMenu.slice(4, 17).map(item => render(item, "menuitem"))}{directMenu.slice(17, 18).map(item => render(item, "menuitem"))}<div role="group" aria-label="Boolean" data-mesh-group="Boolean">{menuGroups[1].commands.map(item => render(item, "menuitem"))}</div><div role="group" aria-label="Cutting" data-mesh-group="Cutting">{menuGroups[2].commands.map(item => render(item, "menuitem"))}</div>{directMenu.slice(18).map(item => render(item, "menuitem"))}</div></nav></section>;
|
||||
const activateMesh = (name: string) => {
|
||||
setCommand(name); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const item = meshItem(name); setStatus(item?.runnable ? "准备执行 Mesh 命令" : `受限:${item?.reason ?? "unknown Mesh command"}`);
|
||||
};
|
||||
return <MeshPanel module={module} command={command} resolve={meshItem} activate={activateMesh} />;
|
||||
})()}
|
||||
{module === "Material" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
const matrix = moduleMatrixRecords.find(item => item.kind === "desktop-gui" && item.command === "Material_Edit");
|
||||
const item: WebCommandDescriptor = descriptorByCommand.get("Material_Edit") ?? { id: matrix?.id ?? "Material:desktop:Material_Edit", module: "Material", command: "Material_Edit", worker: null, category: "boundary", runnable: false, reason: matrix?.capabilityReason ?? "desktop Material command is restricted" };
|
||||
const activate = () => { setCommand(item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行 Material 命令" : `受限:${item.reason}`); };
|
||||
const render = (role: "menuitem" | "button") => <button type="button" role={role} data-command={item.command} data-help-page={item.command} className={`command ${item.command === command ? "selected" : ""}`} onClick={activate} aria-label={item.command} title={item.reason ?? "Material command"}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>;
|
||||
return <section aria-label="Material workbench commands" className="material-entrypoints"><h3 className="heading">Material Tools</h3><div role="toolbar" aria-label="Material" data-desktop-toolbar="Material">{render("button")}</div><nav aria-label="Material menu" className="material-menu" data-desktop-menu="&Material"><h4>&Material</h4><div role="menubar" aria-label="&Material">{render("menuitem")}</div></nav></section>;
|
||||
const activateMaterial = () => { setCommand(item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行 Material 命令" : `受限:${item.reason}`); };
|
||||
return <MaterialPanel module={module} command={command} resolve={() => item} activate={activateMaterial} />;
|
||||
})()}
|
||||
{module === "Robot" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
const matrixByCommand = new Map(moduleMatrixRecords.filter(item => item.kind === "desktop-gui").map(item => [item.command, item]));
|
||||
const robotItem = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "Robot", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop Robot command is restricted" } : undefined; })();
|
||||
const present = (names: string[]) => names.map(robotItem).filter((item): item is WebCommandDescriptor => Boolean(item));
|
||||
const insert = present(["Robot_AddToolShape"]);
|
||||
const exportTrajectory = present(["Robot_ExportKukaCompact", "Robot_ExportKukaFull"]);
|
||||
const menuItems = present(["Robot_CreateTrajectory", "Robot_CreateTrajectory", "Robot_InsertWaypoint", "Robot_InsertWaypointPreselect", "Robot_Edge2Trac", "Robot_SetHomePos", "Robot_RestoreHomePos", "Robot_SetDefaultOrientation", "Robot_SetDefaultValues", "Robot_Simulate"]);
|
||||
const toolbarItems = present(["Robot_Create", "Robot_CreateTrajectory", "Robot_InsertWaypoint", "Robot_InsertWaypointPreselect", "Robot_Edge2Trac", "Robot_TrajectoryDressUp", "Robot_TrajectoryCompound", "Robot_SetHomePos", "Robot_RestoreHomePos", "Robot_Simulate"]);
|
||||
const activate = (item: WebCommandDescriptor) => { setCommand(item.command); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行 Robot 命令" : `受限:${item.reason}`); };
|
||||
const render = (item: WebCommandDescriptor, role: "menuitem" | "button", index: number) => <button key={`${role}-${item.command}-${index}`} type="button" role={role} data-command={item.command} data-help-page={item.command} className={`command ${item.command === command ? "selected" : ""}`} onClick={() => activate(item)} aria-label={item.command} title={item.reason ?? "Robot command"}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>;
|
||||
return <section aria-label="Robot workbench commands" className="robot-entrypoints"><h3 className="heading">Robot Tools</h3><div role="toolbar" aria-label="Robot" data-desktop-toolbar="Robot">{toolbarItems.map((item, index) => render(item, "button", index))}</div><nav aria-label="Robot menu" className="robot-menu" data-desktop-menu="&Robot"><h4>&Robot</h4><div role="menubar" aria-label="&Robot"><div role="group" aria-label="Insert Robot" data-robot-group="Insert Robot">{insert.map((item, index) => render(item, "menuitem", index))}</div>{menuItems.slice(0, 1).map((item, index) => render(item, "menuitem", index))}{menuItems.slice(1).map((item, index) => render(item, "menuitem", index + 1))}<div role="group" aria-label="Export Trajectory" data-robot-group="Export Trajectory">{exportTrajectory.map((item, index) => render(item, "menuitem", index))}</div></div></nav></section>;
|
||||
const activateRobot = (name: string) => {
|
||||
setCommand(name); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.module === module && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const item = robotItem(name); setStatus(item?.runnable ? "准备执行 Robot 命令" : `受限:${item?.reason ?? "unknown Robot command"}`);
|
||||
};
|
||||
return <RobotPanel module={module} command={command} resolve={robotItem} activate={activateRobot} />;
|
||||
})()}
|
||||
{module === "Fem" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
const matrixByCommand = new Map(moduleMatrixRecords.filter(item => item.kind === "desktop-gui").map(item => [item.command, item]));
|
||||
const item = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "Fem", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop FEM command is restricted" } : undefined; })();
|
||||
const present = (names: string[]) => names.map(item).filter((entry): entry is WebCommandDescriptor => Boolean(entry));
|
||||
const groups = {
|
||||
Materials: ["FEM_MaterialSolid", "FEM_MaterialFluid", "FEM_MaterialMechanicalNonlinear", "FEM_MaterialReinforced", "FEM_MaterialEditor"],
|
||||
"Element Geometry": ["FEM_ElementGeometry1D", "FEM_ElementRotation1D", "FEM_ElementGeometry2D", "FEM_ElementFluid1D"],
|
||||
"Electromagnetic Boundary Conditions": ["FEM_ConstraintElectromagnetic", "FEM_ConstraintCurrentDensity", "FEM_ConstraintMagnetization", "FEM_ConstraintElectricChargeDensity"],
|
||||
"Fluid Boundary Conditions": ["FEM_ConstraintInitialFlowVelocity", "FEM_ConstraintInitialPressure", "FEM_ConstraintFlowVelocity"],
|
||||
"Geometrical Analysis Features": ["FEM_ConstraintPlaneRotation", "FEM_ConstraintSectionPrint", "FEM_ConstraintTransform"],
|
||||
"Mechanical Boundary Conditions and Loads": ["FEM_ConstraintFixed", "FEM_ConstraintRigidBody", "FEM_ConstraintDisplacement", "FEM_ConstraintContact", "FEM_ConstraintTie", "FEM_ConstraintSpring", "FEM_ConstraintForce", "FEM_ConstraintPressure", "FEM_ConstraintCentrif", "FEM_ConstraintSelfWeight"],
|
||||
"Thermal Boundary Conditions and Loads": ["FEM_ConstraintInitialTemperature", "FEM_ConstraintHeatflux", "FEM_ConstraintTemperature", "FEM_ConstraintBodyHeatSource"],
|
||||
"Overwrite Constants": ["FEM_ConstantVacuumPermittivity"],
|
||||
const femItem = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "Fem", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop FEM command is restricted" } : undefined; })();
|
||||
const activateFem = (name: string) => {
|
||||
setCommand(name); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const entry = femItem(name); setStatus(entry?.runnable ? "准备执行 FEM 命令" : `受限:${entry?.reason ?? "unknown FEM command"}`);
|
||||
};
|
||||
const toolbars = {
|
||||
Model: ["FEM_Analysis", ...groups.Materials, ...groups["Element Geometry"]],
|
||||
"Electromagnetic Boundary Conditions": ["FEM_CompEmConstraints"],
|
||||
"Fluid Boundary Conditions": groups["Fluid Boundary Conditions"],
|
||||
"Geometrical Analysis Features": groups["Geometrical Analysis Features"],
|
||||
"Mechanical Boundary Conditions and Loads": groups["Mechanical Boundary Conditions and Loads"],
|
||||
"Thermal Boundary Conditions and Loads": groups["Thermal Boundary Conditions and Loads"],
|
||||
Mesh: ["FEM_MeshNetgenFromShape", "FEM_MeshGmshFromShape", "FEM_MeshBoundaryLayer", "FEM_MeshRegion", "FEM_MeshGroup", "FEM_FEMMesh2Mesh"],
|
||||
Solve: ["FEM_CompSolvers", "FEM_CompMechEquations", "FEM_CompEmEquations", "FEM_EquationFlow", "FEM_EquationFlux", "FEM_EquationHeat", "FEM_SolverControl", "FEM_SolverRun"],
|
||||
Results: ["FEM_ResultsPurge", "FEM_ResultShow"],
|
||||
Utilities: ["FEM_ClippingPlaneAdd", "FEM_ClippingPlaneRemoveAll", "FEM_Examples"],
|
||||
};
|
||||
const modelItems = ["FEM_Analysis", ...groups.Materials, ...groups["Element Geometry"], ...groups["Electromagnetic Boundary Conditions"], ...groups["Fluid Boundary Conditions"], ...groups["Geometrical Analysis Features"], ...groups["Mechanical Boundary Conditions and Loads"], ...groups["Thermal Boundary Conditions and Loads"], ...groups["Overwrite Constants"]];
|
||||
const meshItems = ["FEM_MeshNetgenFromShape", "FEM_MeshGmshFromShape", "FEM_MeshBoundaryLayer", "FEM_MeshRegion", "FEM_MeshGroup", "FEM_CreateElementsSet", "FEM_FEMMesh2Mesh"];
|
||||
const solveItems = toolbars.Solve;
|
||||
const resultsItems = toolbars.Results;
|
||||
const utilsItems = toolbars.Utilities;
|
||||
const activate = (entry: WebCommandDescriptor) => { setCommand(entry.command); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === entry.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, entry.command)); setResponse(null); setStatus(entry.runnable ? "准备执行 FEM 命令" : `受限:${entry.reason}`); };
|
||||
const render = (entry: WebCommandDescriptor, role: "menuitem" | "button", index: number) => <button key={`${role}-${entry.command}-${index}`} type="button" role={role} data-command={entry.command} data-help-page={entry.command} className={`command ${entry.command === command ? "selected" : ""}`} onClick={() => activate(entry)} aria-label={entry.command} title={entry.reason ?? "FEM command"}><span>{entry.command}</span><small>{entry.category} · {entry.worker ?? "no worker"}</small></button>;
|
||||
const renderGroup = (label: string, names: string[]) => <div role="group" aria-label={label} data-fem-group={label}>{present(names).map((entry, index) => render(entry, "menuitem", index))}</div>;
|
||||
return <section aria-label="FEM workbench commands" className="fem-entrypoints"><h3 className="heading">FEM Tools</h3>{Object.entries(toolbars).map(([label, names]) => <div key={label} role="toolbar" aria-label={label} data-desktop-toolbar={label}>{present(names).map((entry, index) => render(entry, "button", index))}</div>)}<nav aria-label="FEM menu" className="fem-menu" data-desktop-menu="&FEM"><h4>&FEM</h4><div role="menubar" aria-label="&FEM"><div role="group" aria-label="Model" data-fem-group="Model">{present(modelItems).map((entry, index) => render(entry, "menuitem", index))}</div>{renderGroup("Mesh", meshItems)}{renderGroup("Solve", solveItems)}{renderGroup("Results", resultsItems)}{renderGroup("Utilities", utilsItems)}</div></nav></section>;
|
||||
return <FemPanel module={module} command={command} resolve={femItem} activate={activateFem} />;
|
||||
})()}
|
||||
{module === "BIM" && (() => {
|
||||
const descriptorByCommand = new Map(commandDescriptors.map(item => [item.command, item]));
|
||||
const matrixByCommand = new Map(allMatrixRecords.filter(item => item.kind === "desktop-gui").map(item => [item.command, item]));
|
||||
const item = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "BIM", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop BIM command is restricted" } : undefined; })();
|
||||
const present = (names: string[]) => names.map(item).filter((entry): entry is WebCommandDescriptor => Boolean(entry));
|
||||
const groups = {
|
||||
Drafting: ["BIM_Sketch", "Draft_Line", "Draft_Wire", "Draft_Rectangle", "BIM_ArcTools", "Draft_Circle", "Draft_Ellipse", "Draft_Polygon", "BIM_SplineTools", "Draft_Point", "Draft_Fillet"],
|
||||
BIM: ["Arch_Site", "Arch_Building", "Arch_Level", "Arch_Space", "Arch_Wall", "Arch_CurtainWall", "BIM_Column", "BIM_Beam", "BIM_Slab", "BIM_Door", "Arch_Window", "Arch_Pipe", "Arch_PipeConnector", "Arch_Stairs", "Arch_Roof", "Arch_Panel", "Arch_Frame", "Arch_Fence", "Arch_Truss", "Arch_Equipment", "Arch_Rebar", "BIM_GenericTools"],
|
||||
Annotation: ["BIM_DimensionAligned", "BIM_DimensionHorizontal", "BIM_DimensionVertical", "BIM_Text", "BIM_Leader", "Draft_Label", "Draft_Hatch", "BIM_AxisTools", "Arch_Grid", "Arch_SectionPlane", "BIM_Create2DViews", "BIM_TDPage", "BIM_TDView"],
|
||||
Modify: ["Draft_Move", "Draft_Rotate", "Draft_Scale", "Draft_Mirror", "BIM_CloneTools", "BIM_Copy", "BIM_SimpleCopy", "BIM_Compound", "BIM_OffsetTools", "Draft_Trimex", "Draft_Join", "Draft_Split", "Draft_Stretch", "Draft_Draft2Sketch", "Draft_Upgrade", "Draft_Downgrade", "Arch_Add", "Arch_Remove", "BIM_ArrayTools", "Arch_CutPlane", "BIM_Extrude", "BIM_BooleanTools"],
|
||||
Manage: ["BIM_Setup", "BIM_ProjectManager", "BIM_Windows", "BIM_IfcManageTools", "BIM_Layers", "BIM_Material", "BIM_ReportTools", "BIM_Preflight", "Draft_AnnotationStyleEditor"],
|
||||
Utilities: ["BIM_TogglePanels", "BIM_Trash", "BIM_WPView", "Draft_SelectGroup", "Draft_Slope", "Draft_WorkingPlaneProxy", "Draft_AddConstruction", "Arch_SplitMesh", "Arch_MeshToShape", "Arch_SelectNonSolidMeshes", "Arch_RemoveShape", "Arch_CloseHoles", "Arch_MergeWalls", "Arch_Check", "Arch_ToggleIfcBrepFlag", "Arch_ToggleSubs", "Arch_Survey", "BIM_Diff", "BIM_IfcExplorer", "Arch_IfcSpreadsheet", "BIM_ImagePlane", "BIM_Unclone", "BIM_Rewire", "BIM_Glue", "BIM_Reextrude", "Arch_PanelTools", "Arch_StructureTools", "BIM_Project"],
|
||||
const bimItem = (name: string): WebCommandDescriptor | undefined => descriptorByCommand.get(name) ?? (() => { const record = matrixByCommand.get(name); return record ? { id: record.id, module: "BIM", command: name, worker: null, category: "boundary", runnable: false, reason: record.capabilityReason ?? "desktop BIM command is restricted" } : undefined; })();
|
||||
const activateBim = (name: string) => {
|
||||
setCommand(name); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === name);
|
||||
setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, name)); setResponse(null);
|
||||
const entry = bimItem(name); setStatus(entry?.runnable ? "准备执行 BIM 命令" : `受限:${entry?.reason ?? "unknown BIM command"}`);
|
||||
};
|
||||
const toolbars = { Drafting: groups.Drafting, Snapping: [], BIM: groups.BIM, Annotation: groups.Annotation, "Modify general": ["Draft_Move", "Draft_Rotate", "Draft_Scale", "Draft_Mirror", "BIM_CloneTools", "BIM_Copy", "BIM_SimpleCopy", "BIM_Compound"], "Modify 2D": ["BIM_OffsetTools", "Draft_Trimex", "Draft_Join", "Draft_Split", "Draft_Stretch", "Draft_Draft2Sketch"], "Modify objects": ["Draft_Upgrade", "Draft_Downgrade", "Arch_Add", "Arch_Remove"], "Modify 3D": ["BIM_ArrayTools", "Arch_CutPlane", "BIM_Extrude", "BIM_BooleanTools"], Manage: groups.Manage };
|
||||
const activate = (entry: WebCommandDescriptor) => { setCommand(entry.command); const matrix = moduleMatrixRecords.find(record => record.kind === "desktop-gui" && record.command === entry.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, entry.command)); setResponse(null); setStatus(entry.runnable ? "准备执行 BIM 命令" : `受限:${entry.reason}`); };
|
||||
const render = (entry: WebCommandDescriptor, role: "menuitem" | "button", index: number) => <button key={`${role}-${entry.command}-${index}`} type="button" role={role} data-command={entry.command} data-help-page={entry.command} className={`command ${entry.command === command ? "selected" : ""}`} onClick={() => activate(entry)} aria-label={entry.command} title={entry.reason ?? "BIM command"}><span>{entry.command}</span><small>{entry.category} · {entry.worker ?? "no worker"}</small></button>;
|
||||
return <section aria-label="BIM workbench commands" className="bim-entrypoints"><h3 className="heading">BIM Tools</h3>{Object.entries(toolbars).map(([label, names]) => <div key={label} role="toolbar" aria-label={label} data-desktop-toolbar={label}>{present(names).map((entry, index) => render(entry, "button", index))}</div>)}<nav aria-label="BIM menu" className="bim-menu" data-desktop-menu="BIM"><h4>BIM</h4><div role="menubar" aria-label="BIM">{Object.entries(groups).map(([label, names]) => <div key={label} role="group" aria-label={label} data-bim-group={label}>{present(names).map((entry, index) => render(entry, "menuitem", index))}</div>)}</div></nav></section>;
|
||||
return <BimPanel module={module} command={command} resolve={bimItem} activate={activateBim} />;
|
||||
})()}
|
||||
{commandDescriptors.filter(item => module !== "Points" && module !== "Sandbox" && module !== "Surface" && module !== "Inspection" && module !== "Mesh" && module !== "Material" && module !== "Robot" && module !== "Fem" && module !== "BIM").map((item) => <button data-help-page={item.command.replace(/^.*:desktop:/, "")} className={`command ${item.command === command ? "selected" : ""}`} key={item.id} onClick={() => { if (module === "Part" && item.command === "Part_SectionCut") setSectionCutOpen(true); if (module === "Assembly" && item.command === "Assembly_CreateBom") setTaskPanelGeneration(value => value + 1); setCommand(item.command); const matrix = moduleMatrixRecords.find((record) => record.kind === "desktop-gui" && record.module === module && record.command === item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行命令" : `受限:${item.reason}`); }}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>)}
|
||||
{commandDescriptors.filter(item => module !== "Points" && module !== "Sandbox" && module !== "Surface" && module !== "Inspection" && module !== "Mesh" && module !== "Material" && module !== "Robot" && module !== "Fem" && module !== "BIM").map((item) => <button data-command={item.command} data-help-page={item.command.replace(/^.*:desktop:/, "")} className={`command ${item.command === command ? "selected" : ""}`} key={item.id} onClick={() => { if (module === "Part" && item.command === "Part_SectionCut") setSectionCutOpen(true); if (module === "Assembly" && item.command === "Assembly_CreateBom") setTaskPanelGeneration(value => value + 1); setCommand(item.command); const matrix = moduleMatrixRecords.find((record) => record.kind === "desktop-gui" && record.module === module && record.command === item.command); setSelectedMatrixId(matrix?.id ?? null); setPayloadText(commandPayload(module, item.command)); setResponse(null); setStatus(item.runnable ? "准备执行命令" : `受限:${item.reason}`); }}><span>{item.command}</span><small>{item.category} · {item.worker ?? "no worker"}</small></button>)}
|
||||
<h2 className="heading">命令参数</h2>
|
||||
{module === "Assembly" && <AssemblySolverMessages key={documentSelection.documentId}
|
||||
router={router} dispatcher={desktopCommands} documentId={documentSelection.documentId} busy={busy}
|
||||
@@ -4907,36 +4744,6 @@ function App() {
|
||||
<button type="button" onClick={() => void closeSketchSession()}>Close sketch (Esc)</button>
|
||||
<button type="button" onClick={() => void closeSketchSession()}>Cancel editing</button>
|
||||
</section>}
|
||||
{(module === "Sketcher" || sketchSession) && sketchInteraction && <>
|
||||
<button type="button" disabled={busy} onClick={() => void saveSketchDocument()}>Save and reopen sketch document</button>
|
||||
<SketcherInteractionTask state={sketchInteraction} busy={busy} execute={editSketchInteraction}
|
||||
selectedEdges={documentSelection.selection.filter(item => item.object === sketchInteraction.objectHandle)
|
||||
.flatMap(item => item.subelements ?? []).flatMap(sub => /^Edge[1-9][0-9]*$/.test(sub) ? [Number(sub.slice(4)) - 1] : [])}
|
||||
selectedSubelements={documentSelection.selection.filter(item => item.object === sketchInteraction.objectHandle).flatMap(item => item.subelements ?? [])}
|
||||
hoveredSubelement={sketchElementHover}
|
||||
onSelection={subelements => setDocumentSelection({ documentId: sketchInteraction.documentHandle,
|
||||
selection: subelements.length ? [{ documentId: sketchInteraction.documentHandle, object: sketchInteraction.objectHandle, subelements }] : [] })}
|
||||
centerBounds={sketchConstraints?.constraintTools.centerBounds} />
|
||||
</>}
|
||||
{(module === "Sketcher" || sketchSession) && sketchConstraints && sketchInteraction
|
||||
&& sketchConstraints.documentHandle === sketchInteraction.documentHandle
|
||||
&& sketchConstraints.objectHandle === sketchInteraction.objectHandle && <SketcherConstraintTask
|
||||
key={`${sketchConstraints.documentHandle}/${sketchConstraints.objectHandle}`}
|
||||
state={sketchConstraints} interaction={sketchInteraction.interaction} busy={busy} execute={editSketchInteraction} onHover={setSketchElementHover}
|
||||
selection={documentSelection.selection.filter(item => item.object === sketchConstraints.objectHandle)
|
||||
.flatMap(item => item.subelements ?? [])}
|
||||
onSelection={subelements => setDocumentSelection({ documentId: sketchConstraints.documentHandle,
|
||||
selection: subelements.length ? [{ documentId: sketchConstraints.documentHandle,
|
||||
object: sketchConstraints.objectHandle, subelements }] : [] })} />}
|
||||
{(module === "Sketcher" || sketchSession) && sketchView && <SketcherViewTask state={sketchView} camera={sketchCamera}
|
||||
snapshot={sketchSession?.camera} forceOrtho={sketchSession?.forceOrtho}
|
||||
onCameraChange={(rotation) => {
|
||||
if (!sketchView.view.sectionEnabled || !sketchSession || sketchSession.closing) return;
|
||||
const record = moduleMatrixRecords.find(item => item.command === "Sketcher_ViewSection" && item.kind === "desktop-gui");
|
||||
if (record) void executeSketchCommand(record, { refreshCamera: true, cameraRotation: rotation }, sketchSession.documentId)
|
||||
.then(reply => { if (!sketchSession.closing) setSketchView(sketcherViewState(record, reply) ?? null); })
|
||||
.catch(error => setStatus(String(error)));
|
||||
}} />}
|
||||
{module === "Sketcher" && command?.replace(/^Sketcher:desktop:/, "") === "Sketcher_MapSketch" && (() => {
|
||||
let args: Record<string, unknown>;
|
||||
try {
|
||||
@@ -5123,6 +4930,45 @@ function App() {
|
||||
{moduleMatrixRecords.length > 0 ? <div className="matrix-list"><h2 className="heading">GUI / Web matrix</h2>{moduleMatrixRecords.map((item) => <button data-help-page={item.kind === "desktop-gui" ? item.command : undefined} className={`command ${item.id === selectedMatrixRecord?.id ? "selected" : ""}`} key={item.id} onClick={() => { setSelectedMatrixId(item.id); if (item.command === "Std_TestTaskBox" || (module === "Assembly" && item.command === "Assembly_CreateBom")) setTaskPanelGeneration(value => value + 1); if (item.kind === "desktop-gui" || item.kind === "web-command") { if (module === "Part" && item.command === "Part_SectionCut") setSectionCutOpen(true); setCommand(item.command); setPayloadText(item.kind === "web-command" ? commandPayload(module, item.command) : "{}"); setResponse(null); setStatus("输入命令参数后执行"); } }}><span>{item.command}</span><small>{item.kind} · {item.disposition}</small></button>)}</div> : null}
|
||||
</aside>
|
||||
<main className="stage"><section>
|
||||
{/* Sketcher editing belongs on the stage: in the narrow command column the
|
||||
drawing fieldset and constraint rows were cut off and required scrolling. */}
|
||||
<SketcherPanel
|
||||
visible={Boolean(module === "Sketcher" || sketchSession)}
|
||||
interaction={sketchInteraction}
|
||||
constraints={sketchConstraints}
|
||||
view={sketchView}
|
||||
camera={sketchCamera}
|
||||
session={sketchSession}
|
||||
busy={busy}
|
||||
selectedEdges={documentSelection.selection.filter(item => item.object === sketchInteraction?.objectHandle)
|
||||
.flatMap(item => item.subelements ?? []).flatMap(sub => /^Edge[1-9][0-9]*$/.test(sub) ? [Number(sub.slice(4)) - 1] : [])}
|
||||
selectedSubelements={documentSelection.selection.filter(item => item.object === sketchInteraction?.objectHandle).flatMap(item => item.subelements ?? [])}
|
||||
constraintSelection={documentSelection.selection.filter(item => item.object === sketchConstraints?.objectHandle)
|
||||
.flatMap(item => item.subelements ?? [])}
|
||||
hoveredSubelement={sketchElementHover}
|
||||
onHover={setSketchElementHover}
|
||||
onSelect={(documentId, object, subelements) => setDocumentSelection({ documentId,
|
||||
selection: subelements.length ? [{ documentId, object, subelements }] : [] })}
|
||||
execute={editSketchInteraction}
|
||||
save={() => void saveSketchDocument()}
|
||||
onCameraChange={(rotation) => {
|
||||
if (!sketchView?.view.sectionEnabled || !sketchSession || sketchSession.closing) return;
|
||||
const record = moduleMatrixRecords.find(item => item.command === "Sketcher_ViewSection" && item.kind === "desktop-gui");
|
||||
if (record) void executeSketchCommand(record, { refreshCamera: true, cameraRotation: rotation }, sketchSession.documentId)
|
||||
.then(reply => { if (!sketchSession.closing) setSketchView(sketcherViewState(record, reply) ?? null); })
|
||||
.catch(error => setStatus(String(error)));
|
||||
}} />
|
||||
{module === "PartDesign" && <PartDesignPanel router={router} />}
|
||||
{module === "Spreadsheet" && <SpreadsheetWorkspace router={router} />}
|
||||
{module === "Part" && <PartPanel
|
||||
disabled={() => busy}
|
||||
activate={action => {
|
||||
setCommand(action.command);
|
||||
setPayloadText(commandPayload("Part", action.command));
|
||||
setResponse(null);
|
||||
setStatus(`${action.label} — ${action.task}`);
|
||||
}}
|
||||
currentTask="" />}
|
||||
{module === "Fem" && <FemWorkbenchView router={router} documentId={documentSelection.documentId}
|
||||
response={response} refreshToken={response && "requestId" in response ? response.requestId : ""} />}
|
||||
{graphicsView && <SandboxGraphicsView key={graphicsView.id} router={router}
|
||||
@@ -5241,15 +5087,13 @@ function App() {
|
||||
</figure>)}
|
||||
</section></main>
|
||||
</DockOverlayHost>
|
||||
<footer className="workbench-status-bar" aria-label="Status bar"><p role="status" className={`status ${response?.kind === "error" ? "error" : response?.kind === "result" ? "ok" : ""}`}>{status}</p></footer>
|
||||
{standalone && <footer className="workbench-status-bar" aria-label="Status bar"><p role="status" className={`status ${response?.kind === "error" ? "error" : response?.kind === "result" ? "ok" : ""}`}>{status}</p></footer>}
|
||||
</AssemblyComponentContextMenu>
|
||||
</div>;
|
||||
}
|
||||
|
||||
installNavigation("workbench", readNavigationContext());
|
||||
installUiAccessibility();
|
||||
|
||||
createRoot(document.querySelector<HTMLDivElement>("#app")!).render(<App />);
|
||||
// The standalone bootstrap lives in workbench-entry.tsx so this module stays
|
||||
// side-effect free and can be rendered inside project-shell.
|
||||
import { partDesignCommandGroups } from "./partdesign-desktop-adapter.js";
|
||||
import { BimSolidTask } from "./bim-solid-task.js";
|
||||
import { TestTranslationTask } from "./test-desktop-output.js";
|
||||
|
||||
Reference in New Issue
Block a user