commit 70fb7d59a00a81ee1b3ad811e081423af77b948d Author: NFC666 <2954834129@qq.com> Date: Tue Oct 13 23:28:48 2026 +0800 first commit: 机械设计/机械原理考研笔记(齿轮、轮系知识点 + 配图 + 练习 + 考纲对照) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8a8695 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# ===== 参考资料(体积大 310M,仅本地保留,不纳入版本库)===== +知识库/ + +# ===== 工具工作数据(本机专属,无需同步)===== +.workbuddy/ + +# ===== Obsidian 会话状态(易变,无需同步)===== +.obsidian/workspace.json +.obsidian/workspace-mobile.json +.obsidian/cache + +# ===== 系统文件 ===== +.DS_Store +Thumbs.db +desktop.ini + +# ===== 临时文件 ===== +*.tmp +~$* +*.zip diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..caf1c88 --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,3 @@ +[ + "position-restore" +] \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..639b90d --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..42a46ec --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": true +} \ No newline at end of file diff --git a/.obsidian/plugins/position-restore/main.js b/.obsidian/plugins/position-restore/main.js new file mode 100644 index 0000000..b1dd043 --- /dev/null +++ b/.obsidian/plugins/position-restore/main.js @@ -0,0 +1,13 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +https://github.com/aisahpA/obsidian-position-restore +*/ + +"use strict";var rt=Object.defineProperty;var an=Object.getOwnPropertyDescriptor;var ln=Object.getOwnPropertyNames;var dn=Object.prototype.hasOwnProperty;var cn=(r,e)=>{for(var t in e)rt(r,t,{get:e[t],enumerable:!0})},pn=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ln(e))!dn.call(r,n)&&n!==t&&rt(r,n,{get:()=>e[n],enumerable:!(i=an(e,n))||i.enumerable});return r};var hn=r=>pn(rt({},"__esModule",{value:!0}),r);var os={};cn(os,{default:()=>tt});module.exports=hn(os);var it=require("obsidian");var Wt=require("obsidian");var ie=require("obsidian");var Dt=require("obsidian");var st={"lastPosition.heading":"Last position","lastPosition.intro":"Every note remembers where its cursor sat and how far it was scrolled, and opening it again lands on that spot, with no flash at the top first and no jump afterwards.","openAndRestore.heading":"Open & restore","openAndRestore.linkOpenPosition.name":"When opening from a link","openAndRestore.linkOpenPosition.desc":"When you click a wikilink with no # heading or ^ block target: open at the file start, or return to the saved position. A link that names a target is landed by Obsidian itself, on the spot you clicked, and is out of reach here; other ways of opening (file explorer, search results, bookmarks, quick switcher) are unaffected too and land on the saved position.","openAndRestore.linkOpenPosition.options.start":"File start","openAndRestore.linkOpenPosition.options.restore":"Saved position","openAndRestore.restoreBreadcrumb.name":"Name the restored section","openAndRestore.restoreBreadcrumb.desc":"After a position is restored, briefly show the heading path of where you landed, but only when no heading is visible on screen. Nothing is shown when a heading is already in view (you can see where you are), when the note has only one heading, or when the note has exactly one level-1 heading, which is usually just the note title and already on the tab.","openAndRestore.flashLandingLine.name":"Mark the landing line","openAndRestore.flashLandingLine.desc":"Mark where you land: after a restore or back/forward, editing view marks the cursor line. In reading view, only a jump to a section marks that section.","recordingRules.heading":"Recording rules","recordingRules.folders.name":"Excluded folders","recordingRules.folders.desc":"Don't record the cursor/scroll position for files in these folders and their subfolders.","recordingRules.folders.list.empty":"No folders excluded","recordingRules.folders.add":"Add folder","recordingRules.folders.search.placeholder":"Type to search folders...","recordingRules.folders.search.empty":"No folders found","recordingRules.minLinesToRecord.name":"Do not record files shorter than","recordingRules.minLinesToRecord.desc":`Don't record the cursor/scroll position for a note with fewer lines than this value; views other than a note are not measured by line count. Set to "0" to disable this filter.`,"recordingRules.frontmatterExclude.name":"Exclude by frontmatter property/value","recordingRules.frontmatterExclude.desc":"Exclude a whole class of notes by frontmatter: a file matching any entry in the list is not recorded.","recordingRules.frontmatterExclude.formName":"A property name on its own (`status`): any file carrying the property is skipped, whatever its value.","recordingRules.frontmatterExclude.formValue":"A name with a value (`status: archived`): only files whose value equals it are skipped. yes/no/on/off compare as booleans; an array matches when any one element does.","recordingRules.frontmatterExclude.list.empty":"No properties excluded","recordingRules.frontmatterExclude.add":"Add property","recordingRules.frontmatterExclude.search.placeholder":"Type to search properties...","recordingRules.frontmatterExclude.search.empty":"No properties found","recordingRules.frontmatterExclude.value.title":"Exclude when {0} equals","recordingRules.frontmatterExclude.value.name":"Value","recordingRules.frontmatterExclude.value.desc":"Leave empty to exclude any file that has this property, whatever its value.","recordingRules.frontmatterExclude.value.placeholder":"e.g. true","recordingRules.frontmatterExclude.duplicate":"{0} is already in the list","recordingRules.escapeHatch.name":"Per-file override property","recordingRules.escapeHatch.desc":"This page can also be bypassed one file at a time: in its frontmatter, `{0}: false` means never record it \u2014 while `{0}: true` means record it anyway, over excluded folders, the minimum-length filter and the property rule above. Only true and false mean anything; write anything else and it reads as if you had never written the property.","recordingRules.recordBaseScroll.name":"Record scroll position for Base files","recordingRules.recordBaseScroll.desc":"A Base has no line numbers to anchor to the way Markdown does, so the only thing worth saving is the pixel offset you scrolled to. That stops meaning anything once the screen size differs: two devices syncing the database would overwrite each other's number. Off by default. This switch concerns Base alone. PDF reading positions are already remembered natively on each device, and images and other non-Markdown files have no scroll state worth keeping.","dataStorage.heading":"Data storage","dataStorage.dbFileName.name":"Database file","dataStorage.dbFileName.desc":"JSON file that stores position records.","dataStorage.dbFileName.current":"Current path: {0}","dataStorage.dbFileName.change":"Change","dataStorage.dbFileName.modal.title":"Set database file","dataStorage.dbFileName.modal.default":"Use default","dataStorage.dbFileName.modal.cancel":"Cancel","dataStorage.dbFileName.apply":"Confirm and apply","dataStorage.dbFileName.pickFolder":"Choose folder","dataStorage.dbFileName.pickFile":"Pick an existing JSON file in the vault","dataStorage.dbFileName.search.placeholder":"Type to search JSON files in the vault","dataStorage.dbFileName.search.empty":"No JSON file found","dataStorage.dbFileName.messages.default":"Using the default database file.","dataStorage.dbFileName.messages.invalid":"The database file must be a vault-relative path ending in .json.","dataStorage.dbFileName.messages.exists":"A file already exists at that path but is not a valid position database. Nothing was changed \u2014 pick another file or remove it first.","dataStorage.dbFileName.mergeHint":"If the chosen file already exists, its records are merged into the current database before moving there. If it does not exist, the current database is simply moved to it.","dataStorage.dbFileName.messages.merged":"Adopted the existing database file and merged {0} record(s) from it.","dataStorage.dbFileName.messages.moveFailed":"Failed to move the database file: {0}","dataStorage.dbFileName.messages.set":"Database file set to {0}","dataStorage.dbFileName.syncLocal":'Inside the plugin folder (the default). Obsidian Sync does not carry this file out of the plugin folder; to take positions to another device, click "Change" and point the path inside the vault. Whether other sync clients carry it depends on whether they sync the plugin folder.',"dataStorage.dbFileName.syncVault":"Inside the vault. This is an ordinary vault file, which any sync client can carry.","dataStorage.dbFileName.syncHidden":'Inside a hidden folder. Some sync clients skip folders whose name starts with ".".',"dataStorage.dbFileName.syncSummary":"Will Obsidian Sync carry this file?","dataStorage.dbFileName.syncHint":'Obsidian Sync takes only data.json, main.js, manifest.json and styles.css out of a community plugin folder, so the database never leaves the device it was written on while it sits in the default location. To make positions follow you between devices, point this setting at a path inside the vault \u2014 the buttons below pick or create the folder for you \u2014 and enable "Sync all other types" in Obsidian Sync on every device. Folders whose name starts with "." are never synced by Obsidian Sync, so choose an ordinary vault folder.',"dataStorage.corruptDb.notice":"Position Restore: The database file could not be parsed (a sync client may have been rewriting it). A copy was kept at {0}. Starting from empty \u2014 positions are re-recorded as you open notes.","dataStorage.corruptDb.noticeNoCopy":"Position Restore: The database file could not be parsed (a sync client may have been rewriting it) and no copy could be written, so its positions are unrecoverable. Starting from empty \u2014 positions are re-recorded as you open notes (see the console for details).","dataStorage.legacyDb.notice":"Position Restore: the data file is in the format an older version of the plugin wrote. Every position in it was read, and the next save writes the whole file in the current format. If another device still runs an older version, update it too: the older version cannot read the new file, treats it as empty and rewrites it whole, so only the notes opened on that device survive. While versions differ, every sync can drop a batch of positions.","dataStorage.legacyDb.noticeOverwritten":"Position Restore: the data file was just rewritten in the older format by a device that has not been updated yet. The older version cannot read the new file, so it wrote back only its own positions; everything another device had recorded in the new format is gone from the file. What this device recorded is untouched and goes back on the next save. Update the plugin on your other devices, or this repeats on every sync.","dataStorage.entries.name":"Entry count","dataStorage.entries.desc":"Currently recording positions for {0} files, up to 750 entries. When the limit is exceeded, the records sitting at the default position that have gone unvisited the longest are dropped first, then the rest least-recently-visited. Each pass drops well past the limit, so it does not trim again on every save.","dataStorage.entries.atDefault":"Of these, {0} sit at the default position (the first line after the frontmatter) and hold no actual position.","hotkeys.name":"Hotkeys","hotkeys.unbound":"Not bound","hotkeys.hint":"To bind one: use the keyboard button on this row to open Settings \u2192 Hotkeys. A bound key only fires from a physical keyboard.","hotkeys.open":"Open hotkey settings","hotkeys.openFailed":"Could not open the hotkey settings. Go to Settings \u2192 Hotkeys and find this plugin's commands there.","navHistory.heading":"Back and forward","navHistory.steps.heading":"Steps recorded","navHistory.intro":`Walk back through the order you came, VSCode-style "navigate back" / "navigate forward". Each of these takes a step: opening another note; jumping somewhere inside one, by a link, the outline or a search result; switching tabs; opening a view with no file behind it, such as the graph; and a cursor move that crosses many lines at once (desktop only). A switch inside one tab travels on Obsidian's own per-tab history, so PDF, canvas and the other views this plugin cannot reposition come back too. This history belongs to the device it was made on: it does not sync with the vault, and it survives restarts.`,"navHistory.hotkeys.desc":"One command per direction, walking the steps above. Neither is bound by default, so run either by name from the command palette.","navHistory.stackCap.name":"Back/forward steps kept","navHistory.stackCap.desc":"Maximum number of entries kept in the navigation history. When exceeded, the oldest entries are dropped first.","navHistory.recordActivation.name":"Record tab switches","navHistory.recordActivation.desc":"Clicking another tab pushes a step. Turned off, switching tabs stops leaving steps and the history keeps file opens and in-file jumps, except for views with no file behind them, such as the graph, which still take one: without that step, back from the graph would overshoot to an earlier note.","navHistory.teleportMinLines.name":"Minimum lines in one cursor move","navHistory.teleportMinLines.desc":"A cursor move crossing at least this many lines in one action, whether that is clicking a spot far away in the note, a go-to-line command, or a keyboard motion that crosses many lines at once, counts as an in-file jump and pushes a step. Set 0 to never record one, which is the default, since a step inferred from a cursor move is one the reader never asked for. Desktop only: the phone and tablet apps run no such detection.","navHistory.commands.navigateBack":"Navigate back","navHistory.commands.navigateForward":"Navigate forward","noteEdge.commands.top":"Go to top of note","noteEdge.commands.bottom":"Go to bottom of note","recentFiles.name":"Recent files","recentFiles.rules.heading":"What gets listed","recentFiles.display.heading":"Display","recentFiles.intro":"A list of the notes you opened recently: one row per note, with the main area's file-less views (the graph above all) taking a row each too, and a row opens that note. The filter can also search the headings inside each note: whichever ones it matches are drawn as rows beneath it, and one jumps straight to that section. The list belongs to the device it was made on: it does not sync with the vault, and it survives restarts.","recentFiles.folders.name":"Folders not listed","recentFiles.folders.desc":"Files in these folders are not added to the recent files list. Pinned rows are not affected.","recentFiles.folders.list.empty":"Every folder is listed.","recentFiles.folders.add":"Add folder","recentFiles.frontmatterExclude.name":"Properties not listed","recentFiles.frontmatterExclude.desc":"Exclude a whole class of notes by frontmatter: a file matching any entry in the list is never added to the recent files list. Pinned rows are not affected.","recentFiles.frontmatterExclude.formName":"A property name on its own (`status`): any file carrying the property is left out, whatever its value.","recentFiles.frontmatterExclude.formValue":"A name with a value (`status: archived`): only files whose value equals it are left out. yes/no/on/off compare as booleans; an array matches when any one element does.","recentFiles.frontmatterExclude.list.empty":"Every file is listed.","recentFiles.frontmatterExclude.add":"Add property","recentFiles.excludeImages.name":"Leave out images","recentFiles.excludeImages.desc":"Opening an image file no longer adds it to the recent files list. Turning this on also drops the image rows already on the list (pinned rows are left alone); turning it off starts listing images again, but the rows it dropped do not come back.","recentFiles.cap.name":"Notes to remember","recentFiles.cap.desc":"How many notes the recent files list remembers (a view counts as one). Past that, the ones you have not opened for the longest are dropped; lowering it takes effect at once, and what it drops does not come back. Pinned rows do not count.","recentFiles.outlineSearch.name":"Search headings","recentFiles.outlineSearch.desc":"Whether the filter matches the headings inside each note, on top of its name (and its aliases and path). On: every heading it matches is drawn as a row beneath that note, five at most, and clicking one jumps to it. Off: a query only ever names the note itself.","recentFiles.pathDisplay.name":"Folder path in the list","recentFiles.pathDisplay.desc":"Whether a row shows the folder its note sits in, on every row or only where another row on screen shares the name, and on which side of the name. The side also decides which half gives way when the row runs out of width: the one laid out last drops to a second line.","recentFiles.pathDisplay.options.smart":"Only when names repeat","recentFiles.pathDisplay.options.before":"Always, before the name","recentFiles.pathDisplay.options.after":"Always, after the name","recentFiles.rowTime.name":"Time on each row","recentFiles.rowTime.desc":"Show how long ago each row was last visited. That is the last time you were there, and not the file's modification time. The exact moment is one hover away, on the label itself.","recentFiles.titleProperty.name":"Name from a property","recentFiles.titleProperty.desc":"Which frontmatter property a row shows as the note's name. Pick \u201CTitle\u201D or \u201CAliases\u201D, or type a custom property name; leave empty (off) to keep the file name. A list value uses its first item.","recentFiles.titleProperty.placeholder":"e.g. title","recentFiles.titleProperty.off":"Off (file name)","recentFiles.titleProperty.optTitle":"Title (title)","recentFiles.titleProperty.optAliases":"Aliases (aliases)","recentFiles.titleProperty.custom":"Custom property\u2026","recentFiles.age.now":"now","recentFiles.age.m":"m ago","recentFiles.age.h":"h ago","recentFiles.age.d":"d ago","recentFiles.age.w":"w ago","recentFiles.age.mo":"mo ago","recentFiles.age.y":"y ago","recentFiles.title":"title:","recentFiles.aliases":"aliases:","recentFiles.openInNewTab":"Open in new tab","recentFiles.openHereInNewTab":"Open here in a new tab","recentFiles.forget":"Remove from recent files","recentFiles.clearList":"Clear the whole list","recentFiles.rowMenu":"More actions","recentFiles.pin":"Pin to top","recentFiles.unpin":"Unpin","recentFiles.unpinExcluded":"Unpin and remove from list","recentFiles.unpin.removedByRule":"Unpinned: this row matches the \u201C{0}\u201D rule and was removed from the list.","recentFiles.unpin.removed":"Unpinned. The row was removed from the list.","recentFiles.unpin.undo":"Undo","recentFiles.pinUp":"Move up","recentFiles.pinDown":"Move down","recentFiles.pinFirst":"Move to front","recentFiles.pinLast":"Move to end","recentFiles.commands.open":"Browse recent files","recentFiles.commands.openSidebar":"Open recent files in sidebar","recentFiles.hotkeys.desc":"Two ways into the list: a dialog that answers once and closes, or a panel that stays in the sidebar. Neither is bound by default, so the command palette opens either by name.","recentFiles.graphView":"Graph view","recentFiles.viewBadge":"View","recentFiles.searchPlaceholder":"Filter by note name or text\u2026","recentFiles.clearFilter":"Clear filter","recentFiles.close":"Close","recentFiles.noMatch":"No matching entry.","recentFiles.empty":"Nowhere to go.","recentFiles.moreHits":"{0} more matching sections","previewFocus.recentFiles.name":"Where hovering a row opens the note","previewFocus.recentFiles.desc":"Where the preview card opens a note hovered on a row: at its top, or where you last left off in that note. The latter is exactly where clicking the row lands you, visible without actually opening the note, but it costs a wait: the card draws the whole note from the top first and only then moves to that line, so on a long note you first see an empty card that then jumps over. Notes with no saved position still open at the top. Rows produced by a heading search are unaffected; they always preview that section directly.","previewFocus.recentFiles.options.head":"Note top","previewFocus.recentFiles.options.line":"Where you left off","previewFocus.fileExplorer.name":"Where a file list preview opens the note","previewFocus.fileExplorer.desc":"When you hover a file in Obsidian's own file list, where the preview card opens the note: at its top (Obsidian's native behavior), or where you last left off in that note. The saved spot costs a wait: the card draws the whole note from the top first and only then moves to that line, so on a long note it flashes empty and then jumps. The line used is the last one recorded; it is not recomputed against the note's current contents, so after the note has been edited on another device the preview may stop somewhere other than where you left it. Notes with no saved position still open at the top.","previewFocus.fileExplorer.options.head":"Note top","previewFocus.fileExplorer.options.line":"Where you left off"};var Nt={"lastPosition.heading":"\u6700\u540E\u4F4D\u7F6E","lastPosition.intro":"\u6BCF\u7BC7\u7B14\u8BB0\u90FD\u8BB0\u5F97\u5149\u6807\u505C\u5728\u54EA\u4E00\u884C\u3001\u6EDA\u5230\u4E86\u54EA\u91CC\uFF0C\u518D\u6B21\u6253\u5F00\u76F4\u63A5\u843D\u56DE\u90A3\u4E00\u5904\uFF0C\u4E0D\u4F1A\u5148\u5728\u6587\u4EF6\u9876\u90E8\u95EA\u4E00\u4E0B\u518D\u8DF3\u8FC7\u53BB\u3002","openAndRestore.heading":"\u6253\u5F00\u4E0E\u6062\u590D","openAndRestore.linkOpenPosition.name":"\u70B9\u53CC\u94FE\u6253\u5F00\u65F6","openAndRestore.linkOpenPosition.desc":"\u70B9\u4E0D\u5E26 # \u6807\u9898\u6216 ^ \u5757\u76EE\u6807\u7684\u53CC\u94FE\u65F6\uFF0C\u4ECE\u6587\u4EF6\u5F00\u5934\u6253\u5F00\uFF0C\u8FD8\u662F\u56DE\u5230\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E\u3002\u5E26\u76EE\u6807\u7684\u53CC\u94FE\u7531 Obsidian \u81EA\u5DF1\u843D\u5230\u4F60\u70B9\u7684\u90A3\u4E00\u5904\uFF0C\u8FD9\u91CC\u7BA1\u4E0D\u7740\uFF1B\u5176\u5B83\u6253\u5F00\u65B9\u5F0F\uFF08\u6587\u4EF6\u5217\u8868\u3001\u641C\u7D22\u7ED3\u679C\u3001\u4E66\u7B7E\u3001\u5FEB\u901F\u5207\u6362\u5668\uFF09\u4E5F\u4E0D\u53D7\u5F71\u54CD\uFF0C\u4E00\u5F8B\u56DE\u5230\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E\u3002","openAndRestore.linkOpenPosition.options.start":"\u6587\u4EF6\u5F00\u5934","openAndRestore.linkOpenPosition.options.restore":"\u5DF2\u4FDD\u5B58\u7684\u4F4D\u7F6E","openAndRestore.restoreBreadcrumb.name":"\u6253\u5F00\u7B14\u8BB0\u65F6\u63D0\u793A\u6240\u5728\u5C0F\u8282","openAndRestore.restoreBreadcrumb.desc":"\u6062\u590D\u4F4D\u7F6E\u540E\uFF0C\u5982\u679C\u8FD9\u4E00\u5C4F\u91CC\u770B\u4E0D\u5230\u4EFB\u4F55\u5C0F\u8282\u6807\u9898\uFF0C\u5C31\u5728\u7B14\u8BB0\u4E2D\u95F4\u77ED\u6682\u663E\u793A\u4F60\u6240\u5728\u7684\u5C0F\u8282\u8DEF\u5F84\u3002\u6807\u9898\u5DF2\u7ECF\u5728\u5C4F\u5E55\u4E0A\u65F6\u4E0D\u663E\u793A\uFF08\u4E00\u773C\u5C31\u80FD\u770B\u51FA\u843D\u5728\u54EA\u4E00\u8282\uFF09\uFF1B\u6574\u7BC7\u53EA\u6709\u4E00\u4E2A\u6807\u9898\u65F6\u4E5F\u4E0D\u663E\u793A\uFF1B\u6574\u7BC7\u53EA\u6709\u4E00\u4E2A\u4E00\u7EA7\u6807\u9898\u65F6\uFF0C\u90A3\u591A\u534A\u5C31\u662F\u6587\u7AE0\u6807\u9898\uFF0C\u6807\u7B7E\u9875\u4E0A\u5DF2\u7ECF\u5199\u7740\uFF0C\u4E0D\u518D\u5FF5\u4E00\u904D\u3002","openAndRestore.flashLandingLine.name":"\u6807\u51FA\u843D\u70B9\u90A3\u4E00\u884C","openAndRestore.flashLandingLine.desc":"\u6807\u51FA\u5230\u8FBE\u7684\u4F4D\u7F6E\uFF1A\u6062\u590D\u4F4D\u7F6E\u6216\u524D\u8FDB/\u540E\u9000\u540E\uFF0C\u7F16\u8F91\u6A21\u5F0F\u6807\u51FA\u5149\u6807\u6240\u5728\u884C\uFF1B\u9605\u8BFB\u6A21\u5F0F\u53EA\u5728\u8DF3\u8F6C\u5230\u5C0F\u8282\u65F6\u6807\u51FA\u8BE5\u5C0F\u8282\u3002","recordingRules.heading":"\u8BB0\u5F55\u89C4\u5219","recordingRules.folders.name":"\u6392\u9664\u7684\u6587\u4EF6\u5939","recordingRules.folders.desc":"\u4E0D\u8BB0\u5F55\u8FD9\u4E9B\u6587\u4EF6\u5939\u53CA\u5B50\u6587\u4EF6\u5939\u4E2D\u6587\u4EF6\u7684\u5149\u6807\u548C\u6EDA\u52A8\u4F4D\u7F6E\u3002","recordingRules.folders.list.empty":"\u672A\u6392\u9664\u4EFB\u4F55\u6587\u4EF6\u5939","recordingRules.folders.add":"\u6DFB\u52A0\u6587\u4EF6\u5939","recordingRules.folders.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u6587\u4EF6\u5939\u2026","recordingRules.folders.search.empty":"\u672A\u627E\u5230\u6587\u4EF6\u5939","recordingRules.minLinesToRecord.name":"\u4E0D\u8BB0\u5F55\u8FC7\u77ED\u6587\u4EF6","recordingRules.minLinesToRecord.desc":"\u884C\u6570\u5C11\u4E8E\u6B64\u503C\u7684\u7B14\u8BB0\u4E0D\u8BB0\u5F55\u5B83\u7684\u5149\u6807\u548C\u6EDA\u52A8\u4F4D\u7F6E\uFF0C\u5176\u5B83\u89C6\u56FE\u4E0D\u770B\u884C\u6570\u3002\u8BBE\u4E3A\u201C0\u201D\u53EF\u5173\u95ED\u8FD9\u6761\u8FC7\u6EE4\u3002","recordingRules.frontmatterExclude.name":"\u6309 frontmatter \u5C5E\u6027/\u503C\u6392\u9664","recordingRules.frontmatterExclude.desc":"\u6309 frontmatter \u6392\u9664\u4E00\u6574\u7C7B\u7B14\u8BB0\uFF1A\u547D\u4E2D\u5217\u8868\u91CC\u4EFB\u4E00\u6761\u76EE\u7684\u6587\u4EF6\uFF0C\u4E0D\u8BB0\u5F55\u5B83\u7684\u4F4D\u7F6E\u3002","recordingRules.frontmatterExclude.formName":"\u53EA\u5199\u5C5E\u6027\u540D\uFF08\u5982 `status`\uFF09\uFF1A\u6587\u4EF6\u53EA\u8981\u5E26\u8FD9\u4E2A\u5C5E\u6027\u5C31\u4E0D\u8BB0\u5F55\uFF0C\u4E0D\u8BBA\u503C\u662F\u591A\u5C11\u3002","recordingRules.frontmatterExclude.formValue":"\u5199\u6210 `\u5C5E\u6027: \u503C`\uFF08\u5982 `status: archived`\uFF09\uFF1A\u53EA\u6709\u503C\u76F8\u7B49\u624D\u4E0D\u8BB0\u5F55\u3002yes/no/on/off \u6309\u5E03\u5C14\u6BD4\u8F83\uFF1B\u6570\u7EC4\u91CC\u4EFB\u4E00\u5143\u7D20\u76F8\u7B49\u5373\u7B97\u547D\u4E2D\u3002","recordingRules.frontmatterExclude.list.empty":"\u672A\u6392\u9664\u4EFB\u4F55\u5C5E\u6027","recordingRules.frontmatterExclude.add":"\u6DFB\u52A0\u5C5E\u6027","recordingRules.frontmatterExclude.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u5C5E\u6027\u2026","recordingRules.frontmatterExclude.search.empty":"\u672A\u627E\u5230\u5C5E\u6027","recordingRules.frontmatterExclude.value.title":"{0} \u7B49\u4E8E\u4EE5\u4E0B\u503C\u65F6\u6392\u9664","recordingRules.frontmatterExclude.value.name":"\u503C","recordingRules.frontmatterExclude.value.desc":"\u7559\u7A7A\u8868\u793A\u53EA\u8981\u6587\u4EF6\u542B\u8BE5\u5C5E\u6027\u5373\u6392\u9664\uFF0C\u65E0\u8BBA\u5176\u503C\u5982\u4F55\u3002","recordingRules.frontmatterExclude.value.placeholder":"\u5982 true","recordingRules.frontmatterExclude.duplicate":"{0} \u5DF2\u5728\u5217\u8868\u4E2D","recordingRules.escapeHatch.name":"\u5355\u6587\u4EF6\u8986\u76D6\u5C5E\u6027","recordingRules.escapeHatch.desc":"\u4E5F\u53EF\u4EE5\u7ED5\u8FC7\u8FD9\u4E2A\u9875\u9762\uFF0C\u8BA9\u67D0\u4E00\u7BC7\u81EA\u5DF1\u51B3\u5B9A\uFF1A\u5728\u5B83\u7684 frontmatter \u91CC\u5199 `{0}: false`\uFF0C\u8FD9\u7BC7\u6C38\u4E0D\u8BB0\u5F55\uFF1B\u5199 `{0}: true`\uFF0C\u5219\u8FDE\u6392\u9664\u7684\u6587\u4EF6\u5939\u3001\u6700\u77ED\u884C\u6570\u548C\u4E0A\u9762\u7684\u5C5E\u6027\u89C4\u5219\u4E00\u8D77\u538B\u8FC7\u53BB\uFF0C\u7167\u8BB0\u4E0D\u8BEF\u3002\u53EA\u8BA4 true / false\uFF0C\u5199\u522B\u7684\u503C\u7B49\u4E8E\u6CA1\u5199\u3002","recordingRules.recordBaseScroll.name":"\u8BB0\u5F55 Base \u6587\u4EF6\u7684\u6EDA\u52A8\u4F4D\u7F6E","recordingRules.recordBaseScroll.desc":"Base \u6587\u4EF6\u4E0D\u50CF Markdown \u90A3\u6837\u6709\u884C\u53F7\u53EF\u4F9B\u951A\u5B9A\uFF0C\u80FD\u5B58\u7684\u53EA\u6709\u6EDA\u8FC7\u7684\u50CF\u7D20\u6570\uFF0C\u5C4F\u5E55\u5C3A\u5BF8\u4E00\u53D8\u5C31\u5BF9\u4E0D\u4E0A\uFF0C\u6570\u636E\u6587\u4EF6\u8DE8\u8BBE\u5907\u540C\u6B65\u65F6\u8FD8\u4F1A\u88AB\u53E6\u4E00\u53F0\u8BBE\u5907\u7684\u8BB0\u5F55\u8986\u76D6\uFF0C\u6240\u4EE5\u9ED8\u8BA4\u5173\u7740\u3002\u8FD9\u4E2A\u5F00\u5173\u53EA\u7BA1 Base\u3002PDF \u7684\u9605\u8BFB\u4F4D\u7F6E Obsidian \u539F\u751F\u5DF2\u5728\u6BCF\u53F0\u8BBE\u5907\u4E0A\u8BB0\u4F4F\uFF1B\u56FE\u7247\u7B49\u5176\u4ED6\u975E Markdown \u6587\u4EF6\uFF0C\u4E5F\u6CA1\u6709\u503C\u5F97\u8BB0\u5F55\u7684\u6EDA\u52A8\u72B6\u6001\u3002","dataStorage.heading":"\u6570\u636E\u5B58\u50A8","dataStorage.dbFileName.name":"\u6570\u636E\u6587\u4EF6","dataStorage.dbFileName.desc":"\u4FDD\u5B58\u4F4D\u7F6E\u8BB0\u5F55\u7684 JSON \u6587\u4EF6\u3002","dataStorage.dbFileName.current":"\u5F53\u524D\u8DEF\u5F84\uFF1A{0}","dataStorage.dbFileName.change":"\u66F4\u6539","dataStorage.dbFileName.modal.title":"\u8BBE\u7F6E\u6570\u636E\u6587\u4EF6","dataStorage.dbFileName.modal.default":"\u6062\u590D\u9ED8\u8BA4","dataStorage.dbFileName.modal.cancel":"\u53D6\u6D88","dataStorage.dbFileName.apply":"\u786E\u8BA4\u5E76\u5E94\u7528","dataStorage.dbFileName.pickFolder":"\u9009\u62E9\u6587\u4EF6\u5939","dataStorage.dbFileName.pickFile":"\u4ECE\u4ED3\u5E93\u5DF2\u6709\u7684 JSON \u6587\u4EF6\u4E2D\u9009\u62E9","dataStorage.dbFileName.search.placeholder":"\u8F93\u5165\u4EE5\u641C\u7D22\u4ED3\u5E93\u5185\u7684 JSON \u6587\u4EF6","dataStorage.dbFileName.search.empty":"\u672A\u627E\u5230 JSON \u6587\u4EF6","dataStorage.dbFileName.messages.default":"\u5F53\u524D\u4F7F\u7528\u9ED8\u8BA4\u6570\u636E\u6587\u4EF6\u3002","dataStorage.dbFileName.messages.invalid":"\u6570\u636E\u6587\u4EF6\u5FC5\u987B\u662F\u4ED3\u5E93\u5185\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4E14\u9700\u4EE5 .json \u7ED3\u5C3E\u3002","dataStorage.dbFileName.messages.exists":"\u8BE5\u8DEF\u5F84\u5DF2\u5B58\u5728\u6587\u4EF6\uFF0C\u4F46\u5B83\u4E0D\u662F\u6709\u6548\u7684\u672C\u63D2\u4EF6\u6570\u636E\u6587\u4EF6\u3002\u672A\u505A\u4EFB\u4F55\u6539\u52A8\uFF0C\u8BF7\u53E6\u9009\u6587\u4EF6\u6216\u5148\u624B\u52A8\u5220\u9664\u5B83\u3002","dataStorage.dbFileName.mergeHint":"\u82E5\u6240\u9009\u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u4F1A\u5148\u5C06\u5176\u4E2D\u7684\u8BB0\u5F55\u5408\u5E76\u5230\u5F53\u524D\u6570\u636E\uFF0C\u518D\u79FB\u52A8\u8FC7\u53BB\uFF1B\u6587\u4EF6\u4E0D\u5B58\u5728\u65F6\u5219\u76F4\u63A5\u79FB\u52A8\u3002","dataStorage.dbFileName.messages.merged":"\u5DF2\u91C7\u7528\u73B0\u6709\u6570\u636E\u6587\u4EF6\uFF0C\u5E76\u5408\u5E76\u4E86\u5176\u4E2D {0} \u6761\u8BB0\u5F55\u3002","dataStorage.dbFileName.messages.moveFailed":"\u79FB\u52A8\u6570\u636E\u6587\u4EF6\u5931\u8D25\uFF1A{0}","dataStorage.dbFileName.messages.set":"\u6570\u636E\u6587\u4EF6\u5DF2\u8BBE\u4E3A {0}","dataStorage.dbFileName.syncLocal":"\u4F4D\u4E8E\u63D2\u4EF6\u76EE\u5F55\u5185\uFF08\u9ED8\u8BA4\uFF09\u3002Obsidian Sync \u4E0D\u4F1A\u4ECE\u63D2\u4EF6\u76EE\u5F55\u5E26\u8D70\u8FD9\u4E2A\u6587\u4EF6\uFF1B\u60F3\u8BA9\u4F4D\u7F6E\u8DDF\u7740\u6362\u8BBE\u5907\uFF0C\u70B9\u300C\u66F4\u6539\u300D\u628A\u8DEF\u5F84\u6539\u5230\u4ED3\u5E93\u5185\u3002\u5176\u4ED6\u540C\u6B65\u5DE5\u5177\u662F\u5426\u5E26\u8D70\u5B83\uFF0C\u53D6\u51B3\u4E8E\u5B83\u4EEC\u4F1A\u4E0D\u4F1A\u540C\u6B65\u63D2\u4EF6\u76EE\u5F55\u3002","dataStorage.dbFileName.syncVault":"\u4F4D\u4E8E\u4ED3\u5E93\u5185\u3002\u8FD9\u662F\u4E00\u4E2A\u666E\u901A\u4ED3\u5E93\u6587\u4EF6\uFF0C\u4EFB\u4F55\u540C\u6B65\u5DE5\u5177\u90FD\u80FD\u540C\u6B65\u5B83\u3002","dataStorage.dbFileName.syncHidden":"\u4F4D\u4E8E\u9690\u85CF\u6587\u4EF6\u5939\u5185\u3002\u90E8\u5206\u540C\u6B65\u5DE5\u5177\u4F1A\u8DF3\u8FC7\u4EE5\u201C.\u201D\u5F00\u5934\u7684\u6587\u4EF6\u5939\u3002","dataStorage.dbFileName.syncSummary":"\u8FD9\u4E2A\u6587\u4EF6\u4F1A\u88AB Obsidian Sync \u540C\u6B65\u5417\uFF1F","dataStorage.dbFileName.syncHint":"Obsidian Sync \u53EA\u4F1A\u4ECE\u793E\u533A\u63D2\u4EF6\u76EE\u5F55\u4E2D\u540C\u6B65 data.json\u3001main.js\u3001manifest.json \u548C styles.css\uFF0C\u56E0\u6B64\u6570\u636E\u6587\u4EF6\u7559\u5728\u9ED8\u8BA4\u4F4D\u7F6E\u65F6\u4E0D\u4F1A\u79BB\u5F00\u5199\u5165\u5B83\u7684\u90A3\u53F0\u8BBE\u5907\u3002\u60F3\u8BA9\u4F4D\u7F6E\u5728\u8BBE\u5907\u4E4B\u95F4\u8DDF\u7740\u4F60\u8D70\uFF0C\u8BF7\u628A\u6570\u636E\u6587\u4EF6\u6307\u5411\u4ED3\u5E93\u5185\u7684\u8DEF\u5F84\uFF08\u7528\u4E0B\u65B9\u7684\u6309\u94AE\u9009\u62E9\u6216\u65B0\u5EFA\u6587\u4EF6\u5939\uFF09\uFF0C\u5E76\u5728\u6BCF\u53F0\u8BBE\u5907\u7684 Obsidian Sync \u4E2D\u5F00\u542F\u201C\u540C\u6B65\u5176\u4ED6\u6240\u6709\u7C7B\u578B\u6587\u4EF6\u201D\u3002\u4EE5\u201C.\u201D\u5F00\u5934\u7684\u6587\u4EF6\u5939\u6C38\u8FDC\u4E0D\u4F1A\u88AB Obsidian Sync \u540C\u6B65\uFF0C\u8BF7\u9009\u62E9\u666E\u901A\u7684\u4ED3\u5E93\u6587\u4EF6\u5939\u3002","dataStorage.corruptDb.notice":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF08\u53EF\u80FD\u6B63\u88AB\u540C\u6B65\u5DE5\u5177\u6539\u5199\uFF09\uFF0C\u5DF2\u4FDD\u7559\u4E00\u4EFD\u526F\u672C\uFF1A{0}\u3002\u672C\u6B21\u4ECE\u7A7A\u6570\u636E\u7EE7\u7EED\uFF0C\u91CD\u65B0\u6253\u5F00\u7B14\u8BB0\u4F1A\u91CD\u65B0\u8BB0\u5F55\u4F4D\u7F6E\u3002","dataStorage.corruptDb.noticeNoCopy":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u65E0\u6CD5\u89E3\u6790\uFF08\u53EF\u80FD\u6B63\u88AB\u540C\u6B65\u5DE5\u5177\u6539\u5199\uFF09\uFF0C\u4E14\u672A\u80FD\u5199\u51FA\u526F\u672C\uFF0C\u5176\u4E2D\u7684\u4F4D\u7F6E\u8BB0\u5F55\u65E0\u6CD5\u627E\u56DE\u3002\u672C\u6B21\u4ECE\u7A7A\u6570\u636E\u7EE7\u7EED\uFF0C\u91CD\u65B0\u6253\u5F00\u7B14\u8BB0\u4F1A\u91CD\u65B0\u8BB0\u5F55\u4F4D\u7F6E\uFF08\u8BE6\u60C5\u89C1\u63A7\u5236\u53F0\uFF09\u3002","dataStorage.legacyDb.notice":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u662F\u65E7\u7248\u63D2\u4EF6\u5199\u5165\u7684\u683C\u5F0F\uFF0C\u4F4D\u7F6E\u8BB0\u5F55\u5DF2\u5168\u90E8\u8BFB\u51FA\uFF0C\u4E0B\u6B21\u4FDD\u5B58\u65F6\u4F1A\u4EE5\u65B0\u7248\u683C\u5F0F\u6574\u4EFD\u5199\u56DE\u3002\u82E5\u5176\u4ED6\u8BBE\u5907\u4E0A\u7684\u672C\u63D2\u4EF6\u4ECD\u662F\u65E7\u7248\uFF0C\u8BF7\u4E00\u5E76\u66F4\u65B0\uFF1A\u65E7\u7248\u8BFB\u4E0D\u61C2\u65B0\u7248\u6587\u4EF6\uFF0C\u4F1A\u628A\u5B83\u5F53\u6210\u7A7A\u6587\u4EF6\u6574\u4EFD\u91CD\u5199\uFF0C\u53EA\u5269\u90A3\u53F0\u8BBE\u5907\u81EA\u5DF1\u6253\u5F00\u8FC7\u7684\u7B14\u8BB0\u3002\u4E24\u7AEF\u7248\u672C\u4E0D\u4E00\u81F4\u65F6\uFF0C\u6BCF\u540C\u6B65\u4E00\u6B21\u5C31\u53EF\u80FD\u4E22\u4E00\u6279\u4F4D\u7F6E\u3002","dataStorage.legacyDb.noticeOverwritten":"Position Restore\uFF1A\u6570\u636E\u6587\u4EF6\u521A\u88AB\u53E6\u4E00\u53F0\u5C1A\u672A\u66F4\u65B0\u7684\u8BBE\u5907\u91CD\u5199\u6210\u65E7\u7248\u683C\u5F0F\u3002\u65E7\u7248\u8BFB\u4E0D\u61C2\u65B0\u7248\u6587\u4EF6\uFF0C\u53EA\u5199\u56DE\u5B83\u81EA\u5DF1\u90A3\u4E00\u4EFD\uFF0C\u4E8E\u662F\u6587\u4EF6\u4E2D\u7531\u65B0\u7248\u8BB0\u5F55\u7684\u4F4D\u7F6E\u5DF2\u7ECF\u4E0D\u5728\u4E86\u3002\u672C\u673A\u8BB0\u5F55\u7684\u4F4D\u7F6E\u4E0D\u53D7\u5F71\u54CD\uFF0C\u4E0B\u6B21\u4FDD\u5B58\u4F1A\u4E00\u5E76\u5199\u56DE\u3002\u8BF7\u66F4\u65B0\u5176\u4ED6\u8BBE\u5907\u4E0A\u7684\u672C\u63D2\u4EF6\uFF0C\u5426\u5219\u6BCF\u6B21\u540C\u6B65\u90FD\u4F1A\u91CD\u6F14\u4E00\u6B21\u3002","dataStorage.entries.name":"\u8BB0\u5F55\u6570","dataStorage.entries.desc":"\u5F53\u524D\u8BB0\u5F55\u4E86 {0} \u4E2A\u6587\u4EF6\u7684\u4F4D\u7F6E\uFF0C\u6700\u591A 750 \u6761\u3002\u8D85\u51FA\u540E\u5148\u79FB\u9664\u505C\u5728\u9ED8\u8BA4\u4F4D\u7F6E\u3001\u53C8\u8F83\u4E45\u6CA1\u6253\u5F00\u8FC7\u7684\u8BB0\u5F55\uFF0C\u5176\u4F59\u6309\u6700\u4E45\u672A\u8BBF\u95EE\u79FB\u9664\uFF1B\u4E00\u6B21\u4F1A\u591A\u6E05\u6389\u4E00\u4E9B\uFF0C\u4E0D\u4F1A\u8D34\u7740\u4E0A\u9650\u53CD\u590D\u6E05\u3002","dataStorage.entries.atDefault":"\u5176\u4E2D {0} \u4E2A\u505C\u5728\u9ED8\u8BA4\u4F4D\u7F6E\uFF08frontmatter \u4E0B\u9762\u7B2C\u4E00\u884C\uFF09\uFF0C\u6CA1\u6709\u8BB0\u4E0B\u5B9E\u9645\u4F4D\u7F6E\u3002","hotkeys.name":"\u5FEB\u6377\u952E","hotkeys.unbound":"\u672A\u7ED1\u5B9A","hotkeys.hint":"\u60F3\u7ED1\u5230\u67D0\u4E2A\u952E\uFF1A\u7528\u672C\u884C\u7684\u952E\u76D8\u6309\u94AE\u6253\u5F00\u300C\u8BBE\u7F6E \u2192 \u5FEB\u6377\u952E\u300D\u3002\u7ED1\u597D\u4E4B\u540E\u8981\u9760\u7269\u7406\u952E\u76D8\u624D\u6309\u5F97\u51FA\u6765\u3002","hotkeys.open":"\u6253\u5F00\u5FEB\u6377\u952E\u8BBE\u7F6E","hotkeys.openFailed":"\u6CA1\u80FD\u6253\u5F00\u5FEB\u6377\u952E\u8BBE\u7F6E\uFF0C\u8BF7\u5230\u300C\u8BBE\u7F6E \u2192 \u5FEB\u6377\u952E\u300D\u91CC\u627E\u5230\u672C\u63D2\u4EF6\u7684\u547D\u4EE4\u3002","navHistory.heading":"\u524D\u8FDB\u4E0E\u540E\u9000","navHistory.steps.heading":"\u8BB0\u5F55\u54EA\u4E9B\u6B65","navHistory.intro":"\u6309\u4F60\u8D70\u8FC7\u7684\u987A\u5E8F\u5F80\u56DE\u8D70\uFF0C\u7C7B\u4F3C VSCode \u7684\u201C\u540E\u9000 / \u524D\u8FDB\u201D\u3002\u4E0B\u9762\u8FD9\u4E9B\u52A8\u4F5C\u4F1A\u5404\u5360\u4E00\u6B65\uFF1A\u6253\u5F00\u53E6\u4E00\u7BC7\u7B14\u8BB0\uFF1B\u70B9\u94FE\u63A5\u3001\u5927\u7EB2\u6216\u641C\u7D22\u7ED3\u679C\u8DF3\u5230\u7B14\u8BB0\u91CC\u7684\u67D0\u4E00\u5904\uFF1B\u5207\u6362\u6807\u7B7E\u9875\uFF1B\u6253\u5F00\u56FE\u8C31\u8FD9\u7C7B\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\uFF1B\u5149\u6807\u4E00\u6B21\u6027\u8DE8\u8FC7\u5F88\u591A\u884C\u7684\u79FB\u52A8\uFF08\u4EC5\u7535\u8111\u7AEF\uFF09\u3002\u540C\u4E00\u6807\u7B7E\u9875\u5185\u7684\u5207\u6362\u501F Obsidian \u81EA\u5DF1\u7684\u6807\u7B7E\u9875\u5386\u53F2\u8D70\u56DE\u53BB\uFF0CPDF\u3001Canvas \u8FD9\u7C7B\u672C\u63D2\u4EF6\u5B9A\u4F4D\u4E0D\u4E86\u7684\u89C6\u56FE\u4E5F\u7167\u6837\u56DE\u5F97\u53BB\u3002\u8FD9\u4EFD\u5386\u53F2\u53EA\u7559\u5728\u8FD9\u53F0\u8BBE\u5907\u4E0A\uFF0C\u4E0D\u968F\u4ED3\u5E93\u540C\u6B65\uFF1B\u91CD\u542F\u4E4B\u540E\u8FD8\u5728\u3002","navHistory.hotkeys.desc":"\u4E00\u4E2A\u65B9\u5411\u4E00\u4E2A\u547D\u4EE4\uFF0C\u8D70\u7684\u6B63\u662F\u4E0A\u9762\u90A3\u4E9B\u6B65\u3002\u9ED8\u8BA4\u90FD\u4E0D\u7ED1\u5FEB\u6377\u952E\uFF0C\u5728\u547D\u4EE4\u9762\u677F\u91CC\u6309\u540D\u5B57\u8FD0\u884C\u5373\u53EF\u3002","navHistory.stackCap.name":"\u524D\u8FDB/\u540E\u9000\u4FDD\u7559\u6B65\u6570","navHistory.stackCap.desc":"\u5BFC\u822A\u5386\u53F2\u6700\u591A\u4FDD\u7559\u7684\u6761\u76EE\u6570\uFF0C\u8D85\u51FA\u540E\u4F18\u5148\u4E22\u5F03\u6700\u65E7\u7684\u8BB0\u5F55\u3002","navHistory.recordActivation.name":"\u8BB0\u5F55\u6807\u7B7E\u9875\u5207\u6362","navHistory.recordActivation.desc":"\u70B9\u51FB\u5176\u4ED6\u6807\u7B7E\u9875\u4F1A\u5F80\u5386\u53F2\u91CC\u63A8\u5165\u4E00\u6B65\u3002\u5173\u95ED\u540E\uFF0C\u5207\u6807\u7B7E\u9875\u4E0D\u518D\u7559\u4E0B\u6B65\u9AA4\uFF0C\u5386\u53F2\u53EA\u8BB0\u6587\u4EF6\u6253\u5F00\u4E0E\u6587\u4EF6\u5185\u8DF3\u8F6C\uFF1B\u5173\u7CFB\u56FE\u8C31\u8FD9\u7C7B\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\u662F\u4F8B\u5916\uFF0C\u4ECD\u5404\u5360\u4E00\u6B65\uFF0C\u5426\u5219\u5728\u56FE\u8C31\u91CC\u6309\u540E\u9000\u4F1A\u9000\u8FC7\u5934\uFF0C\u843D\u5230\u66F4\u65E9\u7684\u90A3\u4E00\u7BC7\u3002","navHistory.teleportMinLines.name":"\u5149\u6807\u4E00\u6B21\u8DE8\u8D8A\u591A\u5C11\u884C\u624D\u7B97\u4E00\u6B65","navHistory.teleportMinLines.desc":"\u5149\u6807\u4E00\u6B21\u79FB\u52A8\u8DE8\u8FC7\u8FD9\u4E48\u591A\u884C\uFF0C\u5C31\u5F53\u4F5C\u4E00\u6B21\u6587\u4EF6\u5185\u8DF3\u8F6C\uFF0C\u5F80\u5386\u53F2\u91CC\u63A8\u5165\u4E00\u6B65\uFF1A\u5728\u7B14\u8BB0\u91CC\u70B9\u4E00\u4E2A\u5F88\u8FDC\u7684\u4F4D\u7F6E\u3001\u7528\u547D\u4EE4\u8DF3\u5230\u67D0\u4E00\u884C\u3001\u6216\u4E00\u6B21\u8DE8\u8FC7\u5F88\u591A\u884C\u7684\u952E\u76D8\u79FB\u52A8\u3002\u8BBE 0 \u8868\u793A\u5B8C\u5168\u4E0D\u8BB0\u5F55\u8FD9\u7C7B\u79FB\u52A8\uFF0C\u9ED8\u8BA4\u5C31\u662F 0\uFF1A\u8FD9\u7C7B\u6B65\u662F\u63A8\u65AD\u51FA\u6765\u7684\uFF0C\u60F3\u8981\u7684\u4EBA\u81EA\u5DF1\u5B9A\u8DDD\u79BB\u3002\u4EC5\u5728\u7535\u8111\u7AEF\u751F\u6548\uFF0C\u624B\u673A\u548C\u5E73\u677F\u4E0D\u505A\u8FD9\u9879\u68C0\u6D4B\u3002","navHistory.commands.navigateBack":"\u540E\u9000","navHistory.commands.navigateForward":"\u524D\u8FDB","noteEdge.commands.top":"\u8DF3\u5230\u7B14\u8BB0\u5F00\u5934","noteEdge.commands.bottom":"\u8DF3\u5230\u7B14\u8BB0\u672B\u5C3E","recentFiles.name":"\u6700\u8FD1\u6587\u4EF6","recentFiles.rules.heading":"\u6536\u5F55\u89C4\u5219","recentFiles.display.heading":"\u663E\u793A","recentFiles.intro":"\u4E00\u4EFD\u6700\u8FD1\u6253\u5F00\u8FC7\u7684\u7B14\u8BB0\u7684\u6E05\u5355\uFF1A\u4E00\u884C\u5C31\u662F\u4E00\u7BC7\u7B14\u8BB0\uFF0C\u4E3B\u533A\u57DF\u91CC\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\uFF08\u5173\u7CFB\u56FE\u8C31\u8FD9\u7C7B\uFF09\u4E5F\u5404\u5360\u4E00\u884C\uFF0C\u70B9\u4E00\u884C\u5C31\u6253\u5F00\u90A3\u4E00\u7BC7\u3002\u641C\u7D22\u6846\u8FD8\u80FD\u6309\u7B14\u8BB0\u91CC\u7684\u5C0F\u8282\u6807\u9898\u627E\uFF0C\u547D\u4E2D\u54EA\u51E0\u8282\u5C31\u628A\u5B83\u4EEC\u5404\u753B\u4E00\u884C\uFF0C\u70B9\u4E00\u884C\u8DF3\u5230\u90A3\u4E00\u8282\u3002\u8FD9\u4EFD\u6E05\u5355\u662F\u8FD9\u53F0\u8BBE\u5907\u7684\uFF0C\u4E0D\u968F\u4ED3\u5E93\u540C\u6B65\uFF1B\u91CD\u542F\u540E\u4ECD\u5728\u3002","recentFiles.folders.name":"\u4E0D\u6536\u5F55\u7684\u6587\u4EF6\u5939","recentFiles.folders.desc":"\u8FD9\u4E9B\u6587\u4EF6\u5939\u91CC\u7684\u6587\u4EF6\u4E0D\u4F1A\u8FDB\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u5DF2\u7F6E\u9876\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\u3002","recentFiles.folders.list.empty":"\u6240\u6709\u6587\u4EF6\u5939\u90FD\u4F1A\u6536\u5F55\u3002","recentFiles.folders.add":"\u6DFB\u52A0\u6587\u4EF6\u5939","recentFiles.frontmatterExclude.name":"\u4E0D\u6536\u5F55\u7684\u5C5E\u6027","recentFiles.frontmatterExclude.desc":"\u6309 frontmatter \u6392\u9664\u4E00\u6574\u7C7B\u7B14\u8BB0\uFF1A\u547D\u4E2D\u5217\u8868\u91CC\u4EFB\u4E00\u6761\u76EE\u7684\u6587\u4EF6\uFF0C\u4E0D\u4F1A\u8FDB\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u5DF2\u7F6E\u9876\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\u3002","recentFiles.frontmatterExclude.formName":"\u53EA\u5199\u5C5E\u6027\u540D\uFF08\u5982 `status`\uFF09\uFF1A\u6587\u4EF6\u53EA\u8981\u5E26\u8FD9\u4E2A\u5C5E\u6027\u5C31\u4E0D\u6536\u5F55\uFF0C\u4E0D\u8BBA\u503C\u662F\u591A\u5C11\u3002","recentFiles.frontmatterExclude.formValue":"\u5199\u6210 `\u5C5E\u6027: \u503C`\uFF08\u5982 `status: archived`\uFF09\uFF1A\u53EA\u6709\u503C\u76F8\u7B49\u624D\u4E0D\u6536\u5F55\u3002yes/no/on/off \u6309\u5E03\u5C14\u6BD4\u8F83\uFF1B\u6570\u7EC4\u91CC\u4EFB\u4E00\u5143\u7D20\u76F8\u7B49\u5373\u7B97\u547D\u4E2D\u3002","recentFiles.frontmatterExclude.list.empty":"\u6240\u6709\u6587\u4EF6\u90FD\u4F1A\u6536\u5F55\u3002","recentFiles.frontmatterExclude.add":"\u6DFB\u52A0\u5C5E\u6027","recentFiles.excludeImages.name":"\u4E0D\u6536\u5F55\u56FE\u7247","recentFiles.excludeImages.desc":"\u6253\u5F00\u56FE\u7247\u6587\u4EF6\u4E0D\u518D\u8BB0\u5165\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u3002\u6253\u5F00\u8FD9\u9879\u4F1A\u987A\u624B\u6E05\u6389\u5217\u8868\u4E0A\u5DF2\u6709\u7684\u56FE\u7247\u884C\uFF08\u5DF2\u7F6E\u9876\u7684\u4E0D\u6E05\uFF09\uFF1B\u5173\u6389\u4E4B\u540E\u56FE\u7247\u7167\u5E38\u6536\u5F55\uFF0C\u4F46\u88AB\u6E05\u6389\u7684\u884C\u4E0D\u4F1A\u56DE\u6765\u3002","recentFiles.cap.name":"\u8BB0\u4F4F\u591A\u5C11\u7BC7\u7B14\u8BB0","recentFiles.cap.desc":"\u6700\u8FD1\u6587\u4EF6\u5217\u8868\u6700\u591A\u8BB0\u4F4F\u591A\u5C11\u7BC7\u7B14\u8BB0\uFF08\u4E3B\u533A\u57DF\u91CC\u6CA1\u6709\u6587\u4EF6\u7684\u89C6\u56FE\u4E5F\u5404\u7B97\u4E00\u4E2A\uFF09\u3002\u8D85\u4E86\u5C31\u4E22\u6389\u6700\u4E45\u6CA1\u6253\u5F00\u8FC7\u7684\u90A3\u4E9B\uFF1B\u8C03\u5C0F\u4F1A\u7ACB\u523B\u751F\u6548\uFF0C\u4E22\u6389\u7684\u627E\u4E0D\u56DE\u6765\u3002\u7F6E\u9876\u7684\u884C\u4E0D\u5360\u8FD9\u91CC\u7684\u6570\u3002","recentFiles.outlineSearch.name":"\u641C\u7D22\u5C0F\u8282\u6807\u9898","recentFiles.outlineSearch.desc":"\u641C\u7D22\u6846\u9664\u4E86\u7B14\u8BB0\u540D\uFF08\u4EE5\u53CA\u5B83\u7684\u522B\u540D\u3001\u8DEF\u5F84\uFF09\u4E4B\u5916\uFF0C\u662F\u5426\u4E5F\u5339\u914D\u5404\u7BC7\u7B14\u8BB0\u91CC\u7684\u5C0F\u8282\u6807\u9898\u3002\u5F00\u7740\u65F6\uFF0C\u547D\u4E2D\u7684\u5C0F\u8282\u5404\u753B\u4E00\u884C\u5728\u90A3\u7BC7\u7B14\u8BB0\u4E0B\u9762\uFF08\u6BCF\u7BC7\u6700\u591A 5 \u4E2A\uFF09\uFF0C\u70B9\u4E00\u884C\u5C31\u8DF3\u5230\u90A3\u4E00\u8282\u3002\u5173\u6389\u65F6\u641C\u7D22\u53EA\u8BA4\u7B14\u8BB0\u81EA\u5DF1\u3002","recentFiles.pathDisplay.name":"\u5217\u8868\u91CC\u7684\u8DEF\u5F84","recentFiles.pathDisplay.desc":"\u4E00\u884C\u662F\u5426\u663E\u793A\u7B14\u8BB0\u6240\u5728\u7684\u6587\u4EF6\u5939\uFF1A\u6BCF\u884C\u90FD\u663E\u793A\uFF0C\u8FD8\u662F\u53EA\u5728\u540D\u5B57\u4E0E\u5C4F\u5E55\u4E0A\u522B\u7684\u884C\u649E\u8F66\u65F6\u624D\u663E\u793A\u3002\u663E\u793A\u5728\u540D\u5B57\u7684\u54EA\u4E00\u4FA7\uFF0C\u4E5F\u5C31\u5B9A\u4E0B\u4E86\u884C\u6324\u4E0D\u4E0B\u65F6\u8C01\u8BA9\u4F4D\uFF1A\u6392\u5728\u540E\u9762\u7684\u90A3\u4E00\u534A\u4F1A\u843D\u5230\u7B2C\u4E8C\u884C\u3002","recentFiles.pathDisplay.options.smart":"\u4EC5\u5728\u91CD\u540D\u65F6\u663E\u793A","recentFiles.pathDisplay.options.before":"\u603B\u662F\u663E\u793A\uFF0C\u8DEF\u5F84\u5728\u524D","recentFiles.pathDisplay.options.after":"\u603B\u662F\u663E\u793A\uFF0C\u8DEF\u5F84\u5728\u540E","recentFiles.rowTime.name":"\u6BCF\u884C\u7684\u65F6\u95F4","recentFiles.rowTime.desc":"\u5728\u6BCF\u884C\u4E0A\u663E\u793A\u300C\u8DDD\u4E0A\u6B21\u5230\u8BBF\u8FC7\u4E86\u591A\u4E45\u300D\u3002\u90A3\u662F\u4F60\u4E0A\u4E00\u6B21\u5728\u90A3\u91CC\u7684\u65F6\u95F4\uFF0C\u4E0D\u662F\u6587\u4EF6\u7684\u4FEE\u6539\u65F6\u95F4\uFF1B\u786E\u5207\u65F6\u523B\u60AC\u505C\u5728\u8FD9\u884C\u7684\u65F6\u95F4\u4E0A\u53EF\u4EE5\u770B\u5230\u3002","recentFiles.titleProperty.name":"\u884C\u540D\u53D6\u81EA\u5C5E\u6027","recentFiles.titleProperty.desc":"\u5217\u8868\u91CC\u7528\u54EA\u4E2A frontmatter \u5C5E\u6027\u5F53\u7B14\u8BB0\u540D\u3002\u53EF\u9009\u300C\u6807\u9898 / \u522B\u540D\u300D\uFF0C\u6216\u81EA\u5B9A\u4E49\u4E00\u4E2A\u5C5E\u6027\u540D\uFF1B\u7559\u7A7A\uFF08\u4E0D\u4F7F\u7528\uFF09\u65F6\u663E\u793A\u6587\u4EF6\u540D\u3002\u5C5E\u6027\u503C\u662F\u5217\u8868\u65F6\u53D6\u7B2C\u4E00\u9879\u3002","recentFiles.titleProperty.placeholder":"\u4F8B\u5982 title","recentFiles.titleProperty.off":"\u4E0D\u4F7F\u7528","recentFiles.titleProperty.optTitle":"\u6807\u9898 (title)","recentFiles.titleProperty.optAliases":"\u522B\u540D (aliases)","recentFiles.titleProperty.custom":"\u81EA\u5B9A\u4E49\u5C5E\u6027\u2026","recentFiles.age.now":"\u521A\u521A","recentFiles.age.m":"\u5206\u949F","recentFiles.age.h":"\u5C0F\u65F6","recentFiles.age.d":"\u5929","recentFiles.age.w":"\u5468","recentFiles.age.mo":"\u4E2A\u6708","recentFiles.age.y":"\u5E74","recentFiles.title":"title:","recentFiles.aliases":"aliases:","recentFiles.openInNewTab":"\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00","recentFiles.openHereInNewTab":"\u5728\u6B64\u5904\u6253\u5F00\u65B0\u6807\u7B7E\u9875","recentFiles.forget":"\u4ECE\u6700\u8FD1\u6587\u4EF6\u79FB\u9664","recentFiles.clearList":"\u6E05\u7A7A\u6574\u4E2A\u5217\u8868","recentFiles.rowMenu":"\u66F4\u591A\u64CD\u4F5C","recentFiles.pin":"\u7F6E\u9876","recentFiles.unpin":"\u53D6\u6D88\u7F6E\u9876","recentFiles.unpinExcluded":"\u53D6\u6D88\u7F6E\u9876\u5E76\u79FB\u51FA\u5217\u8868","recentFiles.unpin.removedByRule":"\u5DF2\u53D6\u6D88\u7F6E\u9876\uFF1A\u8BE5\u884C\u547D\u4E2D\u300C{0}\u300D\u89C4\u5219\uFF0C\u5DF2\u79FB\u51FA\u5217\u8868\u3002","recentFiles.unpin.removed":"\u5DF2\u53D6\u6D88\u7F6E\u9876\uFF0C\u8BE5\u884C\u5DF2\u79FB\u51FA\u5217\u8868\u3002","recentFiles.unpin.undo":"\u64A4\u9500","recentFiles.pinUp":"\u4E0A\u79FB","recentFiles.pinDown":"\u4E0B\u79FB","recentFiles.pinFirst":"\u79FB\u5230\u6700\u524D","recentFiles.pinLast":"\u79FB\u5230\u6700\u540E","recentFiles.commands.open":"\u6D4F\u89C8\u6700\u8FD1\u6587\u4EF6","recentFiles.commands.openSidebar":"\u5728\u4FA7\u8FB9\u680F\u6253\u5F00\u6700\u8FD1\u6587\u4EF6","recentFiles.hotkeys.desc":"\u8FDB\u5165\u5217\u8868\u7684\u4E24\u79CD\u65B9\u5F0F\uFF1A\u4E00\u6B21\u6027\u7684\u5F39\u7A97\uFF0C\u6216\u5E38\u9A7B\u4FA7\u8FB9\u680F\u7684\u9762\u677F\u3002\u4E24\u8005\u9ED8\u8BA4\u90FD\u4E0D\u7ED1\u5FEB\u6377\u952E\uFF0C\u5728\u547D\u4EE4\u9762\u677F\u91CC\u6309\u540D\u5B57\u6253\u5F00\u5373\u53EF\u3002","recentFiles.graphView":"\u5173\u7CFB\u56FE\u8C31","recentFiles.viewBadge":"\u89C6\u56FE","recentFiles.searchPlaceholder":"\u6309\u7B14\u8BB0\u540D\u6216\u6587\u672C\u8FC7\u6EE4\u2026","recentFiles.clearFilter":"\u6E05\u7A7A\u7B5B\u9009","recentFiles.close":"\u5173\u95ED","recentFiles.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u5386\u53F2\u3002","recentFiles.empty":"\u6682\u65E0\u53EF\u8DF3\u8F6C\u7684\u4F4D\u7F6E\u3002","recentFiles.moreHits":"\u8FD8\u6709 {0} \u4E2A\u5339\u914D\u7684\u5C0F\u8282","previewFocus.recentFiles.name":"\u60AC\u505C\u4E00\u884C\u65F6\u9884\u89C8\u6253\u5F00\u5728\u54EA\u91CC","previewFocus.recentFiles.desc":"\u60AC\u505C\u5217\u8868\u91CC\u7684\u4E00\u884C\u65F6\uFF0C\u9884\u89C8\u5361\u7247\u628A\u7B14\u8BB0\u6253\u5F00\u5728\u54EA\u513F\uFF1A\u5F00\u5934\uFF0C\u8FD8\u662F\u4F60\u4E0A\u6B21\u79BB\u5F00\u8FD9\u7BC7\u7B14\u8BB0\u65F6\u7684\u4F4D\u7F6E\u3002\u540E\u8005\u5C31\u662F\u76F4\u63A5\u70B9\u51FB\u8FD9\u4E00\u884C\u4F1A\u843D\u5230\u7684\u5730\u65B9\uFF0C\u4E0D\u7528\u771F\u7684\u6253\u5F00\u5C31\u80FD\u5148\u770B\u5230\uFF0C\u4F46\u8981\u591A\u7B49\u4E00\u4E0B\uFF1A\u5361\u7247\u5148\u628A\u6574\u7BC7\u7B14\u8BB0\u4ECE\u5934\u753B\u51FA\u6765\uFF0C\u518D\u632A\u5230\u90A3\u4E00\u884C\uFF0C\u957F\u7B14\u8BB0\u4E0A\u4F1A\u5148\u770B\u5230\u4E00\u5F20\u7A7A\u767D\u5361\u7247\u3001\u7136\u540E\u624D\u8DF3\u8FC7\u53BB\u3002\u6CA1\u8BB0\u4E0B\u4F4D\u7F6E\u7684\u7B14\u8BB0\u4ECD\u4ECE\u5F00\u5934\u663E\u793A\u3002\u641C\u7D22\u5C0F\u8282\u6807\u9898\u5F97\u5230\u7684\u884C\u4E0D\u53D7\u5F71\u54CD\uFF0C\u5B83\u4EEC\u672C\u6765\u5C31\u76F4\u63A5\u9884\u89C8\u90A3\u4E00\u8282\u3002","previewFocus.recentFiles.options.head":"\u7B14\u8BB0\u5F00\u5934","previewFocus.recentFiles.options.line":"\u4E0A\u6B21\u79BB\u5F00\u65F6\u7684\u4F4D\u7F6E","previewFocus.fileExplorer.name":"\u6587\u4EF6\u5217\u8868\u7684\u9884\u89C8\u6253\u5F00\u5728\u54EA\u91CC","previewFocus.fileExplorer.desc":"\u5728 Obsidian \u81EA\u5E26\u7684\u6587\u4EF6\u5217\u8868\u91CC\u60AC\u505C\u4E00\u4E2A\u6587\u4EF6\u65F6\uFF0C\u9884\u89C8\u5361\u7247\u628A\u7B14\u8BB0\u6253\u5F00\u5728\u54EA\u513F\uFF1A\u5F00\u5934\uFF08Obsidian \u539F\u672C\u7684\u884C\u4E3A\uFF09\uFF0C\u8FD8\u662F\u4F60\u4E0A\u6B21\u79BB\u5F00\u8FD9\u7BC7\u7B14\u8BB0\u65F6\u7684\u4F4D\u7F6E\u3002\u9009\u4F4D\u7F6E\u8981\u591A\u7B49\u4E00\u4E0B\uFF1A\u5361\u7247\u5148\u628A\u6574\u7BC7\u7B14\u8BB0\u4ECE\u5934\u753B\u51FA\u6765\uFF0C\u518D\u632A\u5230\u90A3\u4E00\u884C\uFF0C\u957F\u7B14\u8BB0\u4E0A\u4F1A\u5148\u7A7A\u767D\u4E00\u4E0B\u3001\u7136\u540E\u624D\u8DF3\u8FC7\u53BB\u3002\u8FD9\u91CC\u7528\u7684\u662F\u6700\u540E\u8BB0\u4E0B\u7684\u884C\u53F7\uFF0C\u4E0D\u4F1A\u6309\u7B14\u8BB0\u73B0\u5728\u7684\u6837\u5B50\u91CD\u7B97\uFF0C\u6240\u4EE5\u7B14\u8BB0\u5728\u522B\u7684\u8BBE\u5907\u4E0A\u88AB\u589E\u5220\u6539\u8FC7\u540E\uFF0C\u53EF\u80FD\u505C\u4E0D\u5230\u4F60\u79BB\u5F00\u65F6\u7684\u90A3\u4E00\u5904\u3002\u6CA1\u8BB0\u4E0B\u4F4D\u7F6E\u7684\u7B14\u8BB0\u4ECD\u4ECE\u5F00\u5934\u663E\u793A\u3002","previewFocus.fileExplorer.options.head":"\u7B14\u8BB0\u5F00\u5934","previewFocus.fileExplorer.options.line":"\u4E0A\u6B21\u79BB\u5F00\u65F6\u7684\u4F4D\u7F6E"};var un={en:st,zh:Nt},fn=un[(0,Dt.getLanguage)().toLowerCase().split(/[-_]/)[0]]??st;function l(r,...e){let t=fn[r];return e.forEach((i,n)=>{t=t.split(`{${n}}`).join(String(i))}),t}function B(r){return{name:"",searchable:!1,render:e=>{e.setDesc(r),e.settingEl.addClass("position-restore-page-intro")}}}function pe(r,e,t){return{name:l("hotkeys.name"),render:i=>{let n=createFragment();n.createDiv({text:e});let s=n.createEl("ul",{cls:"mod-muted"});for(let o of t)s.createEl("li",{text:`${o.name}: ${gn(r,o.id)}`});n.createDiv({cls:"mod-muted",text:l("hotkeys.hint")}),i.setDesc(n),i.addExtraButton(o=>{o.setIcon("keyboard").setTooltip(l("hotkeys.open")).onClick(()=>vn(r))})}}}function mn(r){let e=ie.Platform.isMacOS,t={Mod:e?"\u2318":"Ctrl",Ctrl:e?"\u2303":"Ctrl",Meta:e?"\u2318":"Win",Shift:e?"\u21E7":"Shift",Alt:e?"\u2325":"Alt"},n=["Mod","Ctrl","Meta","Shift","Alt"].filter(o=>r.modifiers.includes(o)).map(o=>t[o]).join(e?" ":"+"),s;return r.key==="ArrowLeft"?s="\u2190":r.key==="ArrowRight"?s="\u2192":s=r.key,n?`${n}${e?" ":"+"}${s}`:s}function gn(r,e){let i=r.app.hotkeyManager?.getHotkeys(`${r.manifest.id}:${e}`);return!i||i.length===0?l("hotkeys.unbound"):i.map(mn).join(" / ")}function vn(r){let e=r.app.setting;if(!e){new ie.Notice(l("hotkeys.openFailed"));return}e.open();let t=e.openTabById("hotkeys");if(!t){new ie.Notice(l("hotkeys.openFailed"));return}t.setQuery?.(r.manifest.name)}var T=require("obsidian");var D=class extends T.FuzzySuggestModal{constructor(t,i,n){super(t);this.excludedFolders=i;this.onSelect=n;this.setPlaceholder(l("recordingRules.folders.search.placeholder")),this.limit=50,this.emptyStateText=l("recordingRules.folders.search.empty")}getItems(){return this.app.vault.getAllFolders(!1).filter(t=>!this.excludedFolders.some(i=>t.path===i||t.path.startsWith(i+"/"))).sort((t,i)=>t.path.localeCompare(i.path))}getItemText(t){return t.path}onChooseItem(t){this.onSelect(t.path)}},he=class extends T.FuzzySuggestModal{constructor(t,i){super(t);this.onSelect=i;this.setPlaceholder(l("dataStorage.dbFileName.search.placeholder")),this.limit=50,this.emptyStateText=l("dataStorage.dbFileName.search.empty")}getItems(){return this.app.vault.getFiles().filter(t=>t.extension==="json").sort((t,i)=>t.path.localeCompare(i.path))}getItemText(t){return t.path}onChooseItem(t){this.onSelect(t)}},W=class extends T.FuzzySuggestModal{constructor(t,i){super(t);this.onSelect=i;this.setPlaceholder(l("recordingRules.frontmatterExclude.search.placeholder")),this.limit=50,this.emptyStateText=l("recordingRules.frontmatterExclude.search.empty")}getItems(){return Object.values(this.app.metadataCache.getAllPropertyInfos()).map(t=>t.name).sort((t,i)=>t.localeCompare(i))}getItemText(t){return t}onChooseItem(t){this.onSelect(t)}},j=class extends T.Modal{constructor(t,i,n,s){super(t);this.name=i;this.excluded=n;this.onSelect=s}onOpen(){let{contentEl:t}=this;t.createEl("h3",{text:l("recordingRules.frontmatterExclude.value.title",this.name)});let i;new T.Setting(t).setName(l("recordingRules.frontmatterExclude.value.name")).setDesc(l("recordingRules.frontmatterExclude.value.desc")).addText(n=>{i=n,n.setPlaceholder(l("recordingRules.frontmatterExclude.value.placeholder")),n.inputEl.addEventListener("keydown",s=>{s.key==="Enter"&&this.submit(i)})}),new T.Setting(t).addButton(n=>n.setButtonText(l("recordingRules.frontmatterExclude.add")).setCta().onClick(()=>this.submit(i)))}submit(t){let i=t.getValue().trim(),n=i===""?this.name:`${this.name}: ${i}`;if(this.excluded.includes(n)){new T.Notice(l("recordingRules.frontmatterExclude.duplicate",n));return}this.onSelect(n),this.close()}onClose(){this.contentEl.empty()}};var Ct=require("obsidian");function Ot(r,e){let t=e.trim().toLowerCase();if(Array.isArray(r))return r.some(i=>Ot(i,e));if(typeof r=="boolean"){let i={true:!0,false:!1,yes:!0,no:!1,on:!0,off:!1};return t in i&&i[t]===r}return r===null||typeof r=="object"||typeof r!="string"&&typeof r!="number"?!1:r.toString().toLowerCase()===t}function ue(r,e){if(!r||typeof r!="object")return!1;let t=r;for(let i of e){if(!i)continue;let n=i.indexOf(":"),s=(n===-1?i:i.slice(0,n)).trim(),o=n===-1?"":i.slice(n+1).trim();if(!(!s||!Object.prototype.hasOwnProperty.call(t,s))&&(o===""||Ot(t[s],o)))return!0}return!1}function It(r,e){let t=r.vault.getAbstractFileByPath(e);return t instanceof Ct.TFile?r.metadataCache.getFileCache(t)?.frontmatter:void 0}var ot="position-restore";function wn(r){if(typeof r=="boolean")return r;if(typeof r=="string"){let e=r.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}}function yn(r,e){let t={forceRecord:!1,skip:!1};if(!r||typeof r!="object")return t;let n=wn(r[ot]);return n===!0?t.forceRecord=!0:(n===!1||ue(r,e.frontmatterExcludeProperties??[]))&&(t.skip=!0),t}function U(r,e,t){if(!e)return;let i=r.metadataCache.getFileCache(e);if(i)return yn(i.frontmatter,t)}var me=require("obsidian");function Ht(r,e){return e===r.vault.configDir||e.startsWith(`${r.vault.configDir}/`)?"config":e.split("/")[0].startsWith(".")?"hidden":"vault"}var fe=class extends me.Modal{constructor(t,i,n){super(t);this.plugin=i;this.onApply=n}onOpen(){let{contentEl:t}=this;t.createEl("h3",{text:l("dataStorage.dbFileName.modal.title")}),t.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.desc")}),t.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.mergeHint")});let i=t.createEl("details",{cls:"position-restore-db-path-hint"});i.createEl("summary",{text:l("dataStorage.dbFileName.syncSummary")}),i.createEl("p",{cls:"mod-muted",text:l("dataStorage.dbFileName.syncHint")});let n=t.createEl("input",{type:"text",cls:"position-restore-db-path-input",attr:{autocapitalize:"off",autocorrect:"off",autocomplete:"off",spellcheck:"false"}});n.placeholder=this.plugin.database.defaultDbFileName,n.value=this.plugin.settings.dbFileName||"";let s=async()=>{let d=n.value.trim();await this.plugin.database.switchDbFile(d)&&(this.plugin.settings.dbFileName=d,await this.plugin.saveSettings(),new me.Notice(d===""?l("dataStorage.dbFileName.messages.default"):l("dataStorage.dbFileName.messages.set",d)),this.close(),this.onApply())};n.addEventListener("keydown",d=>{d.key==="Enter"&&s()});let o=t.createDiv({cls:"position-restore-db-path-row is-pickers"});o.createEl("button",{text:l("dataStorage.dbFileName.pickFolder")}).addEventListener("click",()=>{let d=n.value.trim()||this.plugin.database.defaultDbFileName,c=d.substring(d.lastIndexOf("/")+1);new D(this.app,[],p=>{n.value=`${p}/${c}`}).open()}),o.createEl("button",{text:l("dataStorage.dbFileName.pickFile")}).addEventListener("click",()=>{new he(this.app,d=>{n.value=d.path}).open()}),o.createEl("button",{text:l("dataStorage.dbFileName.modal.default")}).addEventListener("click",()=>{n.value=""});let a=t.createDiv({cls:"position-restore-db-path-row is-actions"});a.createEl("button",{text:l("dataStorage.dbFileName.modal.cancel")}).addEventListener("click",()=>this.close()),a.createEl("button",{text:l("dataStorage.dbFileName.apply"),cls:"mod-cta"}).addEventListener("click",()=>{s()})}onClose(){this.contentEl.empty()}};function Vt(r){return[{type:"group",items:[B(l("lastPosition.intro"))]},{type:"group",heading:l("openAndRestore.heading"),items:[{name:l("openAndRestore.linkOpenPosition.name"),desc:l("openAndRestore.linkOpenPosition.desc"),control:{type:"dropdown",key:"linkOpenPosition",options:{start:l("openAndRestore.linkOpenPosition.options.start"),restore:l("openAndRestore.linkOpenPosition.options.restore")}}},{name:l("previewFocus.fileExplorer.name"),desc:l("previewFocus.fileExplorer.desc"),control:{type:"dropdown",key:"fileExplorerPreviewFocus",options:{head:l("previewFocus.fileExplorer.options.head"),line:l("previewFocus.fileExplorer.options.line")}}},{name:l("openAndRestore.restoreBreadcrumb.name"),desc:l("openAndRestore.restoreBreadcrumb.desc"),control:{type:"toggle",key:"restoreBreadcrumb"}},{name:l("openAndRestore.flashLandingLine.name"),desc:l("openAndRestore.flashLandingLine.desc"),control:{type:"toggle",key:"flashLandingLine"}}]},{type:"group",heading:l("recordingRules.heading"),items:[{type:"page",name:l("recordingRules.folders.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recordingRules.folders.desc")});let t=r.plugin.settings.excludedFolders;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n+"/"});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recordingRules.folders.list.empty"),items:r.plugin.settings.excludedFolders.map(e=>({name:e+"/"})),onDelete:e=>{let t=r.plugin.settings.excludedFolders.filter((i,n)=>n!==e);r.setValue("excludedFolders",t)},addItem:{name:l("recordingRules.folders.add"),action:()=>{new D(r.app,r.plugin.settings.excludedFolders,e=>{let t=[...r.plugin.settings.excludedFolders,e];r.setValue("excludedFolders",t)}).open()}}}]},{name:l("recordingRules.minLinesToRecord.name"),desc:l("recordingRules.minLinesToRecord.desc"),control:{type:"number",key:"minLinesToRecord",min:0,max:1e5,step:1}},{type:"page",name:l("recordingRules.frontmatterExclude.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recordingRules.frontmatterExclude.desc")}),e.createDiv({cls:"mod-muted",text:l("recordingRules.frontmatterExclude.formName")}),e.createDiv({cls:"mod-muted",text:l("recordingRules.frontmatterExclude.formValue")});let t=r.plugin.settings.frontmatterExcludeProperties;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recordingRules.frontmatterExclude.list.empty"),items:r.plugin.settings.frontmatterExcludeProperties.map(e=>({name:e})),onDelete:e=>{let t=r.plugin.settings.frontmatterExcludeProperties.filter((i,n)=>n!==e);r.setValue("frontmatterExcludeProperties",t)},addItem:{name:l("recordingRules.frontmatterExclude.add"),action:()=>{new W(r.app,e=>{new j(r.app,e,r.plugin.settings.frontmatterExcludeProperties,t=>{let i=[...r.plugin.settings.frontmatterExcludeProperties,t];r.setValue("frontmatterExcludeProperties",i)}).open()}).open()}}}]},{name:l("recordingRules.escapeHatch.name"),desc:l("recordingRules.escapeHatch.desc",ot)},{name:l("recordingRules.recordBaseScroll.name"),desc:l("recordingRules.recordBaseScroll.desc"),control:{type:"toggle",key:"recordBaseScroll"}}]},{type:"group",heading:l("dataStorage.heading"),items:[{name:l("dataStorage.dbFileName.name"),desc:(()=>{let e=r.plugin.settings.dbFileName||r.plugin.database.defaultDbFileName,t=Ht(r.app,e),i=createFragment();return i.createDiv({text:l("dataStorage.dbFileName.desc")}),i.createDiv({cls:"mod-muted",text:l("dataStorage.dbFileName.current",e)}),i.createDiv({cls:"mod-muted",text:t==="config"?l("dataStorage.dbFileName.syncLocal"):t==="hidden"?l("dataStorage.dbFileName.syncHidden"):l("dataStorage.dbFileName.syncVault")}),i})(),render:e=>{e.addButton(t=>{t.setButtonText(l("dataStorage.dbFileName.change")).onClick(()=>new fe(r.app,r.plugin,()=>r.refresh()).open())})}},{name:l("dataStorage.entries.name"),render:e=>{let t=Object.keys(r.plugin.database.db).length,i=createFragment();i.createDiv({text:l("dataStorage.entries.desc",String(t))});let n=r.plugin.database.countDefaultPosition();n>0&&i.createDiv({cls:"mod-muted",text:l("dataStorage.entries.atDefault",String(n))}),e.setDesc(i)}}]}]}function _t(r){return[{type:"group",items:[B(l("navHistory.intro")),pe(r.plugin,l("navHistory.hotkeys.desc"),[{id:"navigate-back",name:l("navHistory.commands.navigateBack")},{id:"navigate-forward",name:l("navHistory.commands.navigateForward")}]),{name:l("navHistory.stackCap.name"),desc:l("navHistory.stackCap.desc"),control:{type:"number",key:"navHistoryCap",min:10,max:500,step:1}}]},{type:"group",heading:l("navHistory.steps.heading"),items:[{name:l("navHistory.recordActivation.name"),desc:l("navHistory.recordActivation.desc"),control:{type:"toggle",key:"navHistoryRecordActivation"}},{name:l("navHistory.teleportMinLines.name"),desc:l("navHistory.teleportMinLines.desc"),control:{type:"number",key:"navHistoryTeleportMinLines",min:0,max:500,step:1}}]}]}function Bt(r){return[{type:"group",items:[B(l("recentFiles.intro")),pe(r.plugin,l("recentFiles.hotkeys.desc"),[{id:"browse-recent-files",name:l("recentFiles.commands.open")},{id:"open-recent-files-sidebar",name:l("recentFiles.commands.openSidebar")}])]},{type:"group",heading:l("recentFiles.rules.heading"),items:[{type:"page",name:l("recentFiles.folders.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recentFiles.folders.desc")});let t=r.plugin.settings.recentFilesExcludeFolders;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n+"/"});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recentFiles.folders.list.empty"),items:r.plugin.settings.recentFilesExcludeFolders.map(e=>({name:e+"/"})),onDelete:e=>{let t=r.plugin.settings.recentFilesExcludeFolders.filter((i,n)=>n!==e);r.setValue("recentFilesExcludeFolders",t)},addItem:{name:l("recentFiles.folders.add"),action:()=>{new D(r.app,r.plugin.settings.recentFilesExcludeFolders,e=>{let t=[...r.plugin.settings.recentFilesExcludeFolders,e];r.setValue("recentFilesExcludeFolders",t)}).open()}}}]},{type:"page",name:l("recentFiles.frontmatterExclude.name"),desc:(()=>{let e=createFragment();e.createDiv({text:l("recentFiles.frontmatterExclude.desc")}),e.createDiv({cls:"mod-muted",text:l("recentFiles.frontmatterExclude.formName")}),e.createDiv({cls:"mod-muted",text:l("recentFiles.frontmatterExclude.formValue")});let t=r.plugin.settings.recentFilesExcludeProperties;if(t.length===0)return e;let i=e.createEl("ul",{cls:"mod-muted"});for(let n of t.slice(0,5))i.createEl("li",{text:n});return t.length>5&&i.createEl("li",{text:"..."}),e})(),items:[{type:"list",emptyState:l("recentFiles.frontmatterExclude.list.empty"),items:r.plugin.settings.recentFilesExcludeProperties.map(e=>({name:e})),onDelete:e=>{let t=r.plugin.settings.recentFilesExcludeProperties.filter((i,n)=>n!==e);r.setValue("recentFilesExcludeProperties",t)},addItem:{name:l("recentFiles.frontmatterExclude.add"),action:()=>{new W(r.app,e=>{new j(r.app,e,r.plugin.settings.recentFilesExcludeProperties,t=>{let i=[...r.plugin.settings.recentFilesExcludeProperties,t];r.setValue("recentFilesExcludeProperties",i)}).open()}).open()}}}]},{name:l("recentFiles.excludeImages.name"),desc:l("recentFiles.excludeImages.desc"),control:{type:"toggle",key:"recentFilesExcludeImages"}},{name:l("recentFiles.cap.name"),desc:l("recentFiles.cap.desc"),control:{type:"number",key:"recentFilesCap",min:20,max:500,step:10}}]},{type:"group",heading:l("recentFiles.display.heading"),items:[{name:l("recentFiles.outlineSearch.name"),desc:l("recentFiles.outlineSearch.desc"),control:{type:"toggle",key:"recentFilesOutlineSearch"}},{name:l("recentFiles.pathDisplay.name"),desc:l("recentFiles.pathDisplay.desc"),control:{type:"dropdown",key:"recentFilesPathDisplay",options:{smart:l("recentFiles.pathDisplay.options.smart"),before:l("recentFiles.pathDisplay.options.before"),after:l("recentFiles.pathDisplay.options.after")}}},{name:l("recentFiles.rowTime.name"),desc:l("recentFiles.rowTime.desc"),control:{type:"toggle",key:"recentFilesRowTime"}},{name:l("recentFiles.titleProperty.name"),desc:l("recentFiles.titleProperty.desc"),render:e=>{let t=r.plugin.settings.recentFilesTitleProperty,i=t==="title"||t==="aliases",n;e.addDropdown(s=>{s.addOption("",l("recentFiles.titleProperty.off")),s.addOption("title",l("recentFiles.titleProperty.optTitle")),s.addOption("aliases",l("recentFiles.titleProperty.optAliases")),s.addOption("__custom__",l("recentFiles.titleProperty.custom")),s.setValue(i?t:t===""?"":"__custom__"),s.onChange(o=>{o==="__custom__"?n.inputEl.setCssProps({display:""}):(n.inputEl.setCssProps({display:"none"}),r.setValue("recentFilesTitleProperty",o))})}),e.addText(s=>{n=s,s.setPlaceholder(l("recentFiles.titleProperty.placeholder")),s.setValue(i?"":t),s.inputEl.addEventListener("blur",()=>{r.setValue("recentFilesTitleProperty",s.getValue().trim())})}),n.inputEl.setCssProps({display:i||t===""?"none":""})}},{name:l("previewFocus.recentFiles.name"),desc:l("previewFocus.recentFiles.desc"),control:{type:"dropdown",key:"recentFilesPreviewFocus",options:{head:l("previewFocus.recentFiles.options.head"),line:l("previewFocus.recentFiles.options.line")}}}]}]}var bn=new Set(["recentFilesOutlineSearch","recentFilesPathDisplay","recentFilesRowTime","recentFilesTitleProperty"]),En=new Set,ge=class extends Wt.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t}getControlValue(e){return this.plugin.settings[e]}async setControlValue(e,t){let i={...this.plugin.settings};this.plugin.settings[e]=t,this.plugin.manager.applyChangedSettings(i),bn.has(e)&&this.plugin.manager.refreshNavPanels(),await this.plugin.saveSettings(),En.has(e)&&this.update()}getSettingDefinitions(){let e=this.pageContext();return[{type:"page",name:l("lastPosition.heading"),items:Vt(e)},{type:"page",name:l("navHistory.heading"),items:_t(e)},{type:"page",name:l("recentFiles.name"),items:Bt(e)}]}pageContext(){return{app:this.app,plugin:this.plugin,setValue:async(e,t)=>{await this.setControlValue(e,t),this.update()},refresh:()=>this.update()}}};var H={dbFileName:"",minLinesToRecord:20,excludedFolders:[],frontmatterExcludeProperties:[],linkOpenPosition:"restore",restoreBreadcrumb:!0,flashLandingLine:!0,recordBaseScroll:!1,navHistoryCap:50,navHistoryRecordActivation:!0,navHistoryTeleportMinLines:0,recentFilesExcludeFolders:[],recentFilesExcludeProperties:[],recentFilesExcludeImages:!1,recentFilesOutlineSearch:!0,recentFilesCap:50,recentFilesPathDisplay:"smart",recentFilesRowTime:!0,recentFilesTitleProperty:"",recentFilesPreviewFocus:"head",fileExplorerPreviewFocus:"head"};var C=require("obsidian");var jt=require("obsidian");function ve(r){new jt.Notice(r,0)}var ne=3;function we(r,e){return r?r.from.ch!==0||r.to.ch!==0||r.from.line!==r.to.line?!1:r.from.line===(e??0):!0}function Ut(r,e){let t={},i=r.scroll??0;i>0&&(t.s=i);let n=r.cursor;return n&&(i>0||!we(n,e))&&(t.c=[n.from.line,n.from.ch,n.to.line,n.to.ch]),r.time!==void 0&&(t.t=r.time),t}function Kt(r){if(!r||typeof r!="object"||Array.isArray(r))return{};let e=r,t={};typeof e.s=="number"&&Number.isFinite(e.s)&&e.s>0&&(t.scroll=e.s),typeof e.t=="number"&&Number.isFinite(e.t)&&(t.time=e.t);let i=e.c;if(Array.isArray(i)&&i.length>=4&&i.every(n=>typeof n=="number"&&Number.isFinite(n))){let[n,s,o,a]=i,d={line:n,ch:s},c={line:o,ch:a};we({from:d,to:c},void 0)||(t.cursor={from:d,to:c})}return t}function Sn(r){if(!Array.isArray(r)||r.some(i=>!Number.isFinite(i)))return{};let e=r,t={};if(e[0]>0&&(t.scroll=e[0]),e.length===3){let i={line:e[1],ch:e[2]};t.cursor={from:i,to:i}}else e.length>=5&&(t.cursor={from:{line:e[1],ch:e[2]},to:{line:e[3],ch:e[4]}});return t}function ye(r){let e=JSON.parse(r);if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database content is not a JSON object");let t=e,i=typeof t.schema=="number"?t.schema:1,n;return i>=3?n=xn(t):i>=2?n=Fn(t):n=kn(t),{schema:i,db:n}}function kn(r){let e={};for(let t of Object.keys(r))e[t]=Sn(r[t]);return e}function Fn(r){let e=r.positions;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database has no position map");let t=e,i={};for(let n of Object.keys(t))i[n]=Kt(t[n]);return i}function xn(r){let e=r.lastPositions;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("database has no lastPositions map");let t=e,i={};for(let n of Object.keys(t))i[n]=Kt(t[n]);return i}function $t(r){let e;try{e=ye(r)}catch{return null}for(let t of Object.keys(e.db)){let i=t.toLowerCase();if(!i.endsWith(".md")&&!i.endsWith(".base"))return null}return e.db}var at=750,Pn=Math.floor(at*3/4),Tn=Math.floor(at/4),Gt="position-restore-data.json",Ln="positions.json",be=class{constructor(e,t){this.db={};this.dbDirty=!1;this.rev=0;this.lastDiskMtime=0;this.lastSeenSchema=0;this.legacyStartupNotified=!1;this.legacyOverwriteNotified=!1;this.mergeChain=Promise.resolve();this.preservedCorrupt=null;this.corruptNotified=!1;this.corruptCopySeq=0;this.lastKey=null;this.app=e.app,this.plugin=e,this.manifestDir=e.manifest.dir,this.settings=t}get defaultDbFileName(){return this.manifestDir+"/"+Gt}getDbPath(){return this.settings.dbFileName||this.defaultDbFileName}corruptCopyPath(){let e=this.getDbPath().split("/").pop()??Gt,t=new Date().toISOString().replace(/[:.]/g,"-");return`${this.manifestDir}/${e.replace(/\.json$/i,"")}.corrupt-${t}-${++this.corruptCopySeq}.json`}async ensureDbFolder(){let e=this.getDbPath(),t=e.substring(0,e.lastIndexOf("/"));if(t)try{await this.app.vault.adapter.exists(t)||await this.app.vault.adapter.mkdir(t)}catch(i){console.error("Can't create db folder:",i),this.settings.dbFileName="",this.plugin.saveSettings()}}async switchDbFile(e){let t=e===""?this.defaultDbFileName:e;if(!t.endsWith(".json")||t.startsWith("/")||t.includes("\\")||t.split("/").includes(".."))return new C.Notice(l("dataStorage.dbFileName.messages.invalid")),!1;let i=this.app.vault.adapter,n=this.getDbPath();if(t===n)return!0;let s=async()=>{try{let o=$t(await i.read(t));if(o===null)return null;await i.exists(n)&&await i.remove(n);let a=this.mergeDiskDb(o);return this.markDirty(),a}catch(o){return console.error("Can't adopt existing database file:",o),null}};try{let o=t.lastIndexOf("/"),a=o===-1?"":t.substring(0,o);if(a&&!await i.exists(a)&&await i.mkdir(a),await i.exists(t)){let d=await s();if(d===null)return new C.Notice(l("dataStorage.dbFileName.messages.exists")),!1;new C.Notice(l("dataStorage.dbFileName.messages.merged",String(d)))}else await i.exists(n)&&await i.rename(n,t)}catch(o){return console.error("Can't switch database file:",o),new C.Notice(l("dataStorage.dbFileName.messages.moveFailed",String(o))),!1}return this.lastDiskMtime=0,await this.cacheDiskMtime(),!0}pruneDb(){let e=Object.keys(this.db).length;this.removeExcludedFolders(),this.removeFrontmatterExcluded(),this.trimToLimit();let t=e-Object.keys(this.db).length;return t>0&&this.markDirty(),t}removeExcludedFolders(){let e=this.settings.excludedFolders;if(e.length!==0)for(let t of Object.keys(this.db))e.some(i=>t===i||t.startsWith(i+"/"))&&delete this.db[t]}removeFrontmatterExcluded(){for(let e of Object.keys(this.db)){let t=this.app.vault.getAbstractFileByPath(e);if(!(t instanceof C.TFile))continue;U(this.app,t,this.settings)?.skip&&delete this.db[e]}}markDirty(){this.dbDirty=!0,this.rev++}setState(e,t){let i=t.time===void 0?{...t,time:Date.now()}:t,n=this.db[e]!==void 0;n&&e===this.lastKey?this.db[e]=i:(n&&delete this.db[e],this.db[e]=i,this.lastKey=e),this.markDirty()}trimToLimit(){let e=Object.keys(this.db);if(e.length<=at)return;let t=Math.max(0,e.length-Tn),i=[],n=[];for(let o=0;o!s.has(o)).map(o=>[o,this.db[o]]))}async migrateDefaultDbFileName(){if(this.settings.dbFileName)return;let e=this.app.vault.adapter,t=this.manifestDir+"/"+Ln;try{if(await e.exists(this.defaultDbFileName)||!await e.exists(t))return;await e.rename(t,this.defaultDbFileName)}catch(i){console.error("Can't rename the legacy default database file:",i)}}async readDb(){if(this.lastDiskMtime=0,await this.migrateDefaultDbFileName(),await this.cacheDiskMtime(),this.lastDiskMtime===0)return;let e;try{e=await this.app.vault.adapter.read(this.getDbPath())}catch(t){console.error("Can't read database:",t),this.db={};return}try{let{schema:t,db:i}=ye(e);this.db=i,this.noteSchema(t,!0)}catch(t){console.error("Can't read database:",t),this.db={},await this.preserveUnreadableDb(e,t)}}noteSchema(e,t){let i=this.lastSeenSchema>=ne;if(this.lastSeenSchema=e,!(e>=ne)){if(t){if(this.legacyStartupNotified)return;this.legacyStartupNotified=!0,ve(l("dataStorage.legacyDb.notice"));return}!i||this.legacyOverwriteNotified||(this.legacyOverwriteNotified=!0,ve(l("dataStorage.legacyDb.noticeOverwritten")))}}countDefaultPosition(){let e=0;for(let t of Object.keys(this.db))this.isEmptyRecord(t,this.db[t])&&e++;return e}isEmptyRecord(e,t){return(t.scroll??0)>0?!1:t.cursor?we(t.cursor,this.defaultCursorLine(e)):!0}defaultCursorLine(e){let t=this.app.vault.getAbstractFileByPath(e);if(!(t instanceof C.TFile))return;let i=this.app.metadataCache.getFileCache(t);if(i)return i.frontmatterPosition?i.frontmatterPosition.end.line+1:0}async preserveUnreadableDb(e,t){if(e===this.preservedCorrupt)return;this.preservedCorrupt=e;let i=this.corruptCopyPath(),n=!0;try{await this.app.vault.adapter.write(i,e)}catch(s){n=!1,console.error("Can't keep a copy of the unreadable database:",s)}console.error(n?`Position Restore: unreadable database file, kept a copy at ${i}`:"Position Restore: unreadable database file, and no copy could be written",t),!this.corruptNotified&&(this.corruptNotified=!0,ve(n?l("dataStorage.corruptDb.notice",i):l("dataStorage.corruptDb.noticeNoCopy")))}async cacheDiskMtime(){try{let e=await this.app.vault.adapter.stat(this.getDbPath());this.lastDiskMtime=e?e.mtime:0}catch{this.lastDiskMtime=0}}mergeDiskDb(e){let t=Object.keys(e).length;for(let i of Object.keys(this.db)){let n=(this.db[i].time??0)>=(e[i]?.time??0);(e[i]===void 0||n)&&(e[i]!==void 0&&t--,e[i]=this.db[i])}return this.db=e,this.lastKey=null,t}async mergeExternalChanges(){let e=this.mergeChain.then(()=>this.runMergePass());this.mergeChain=e.catch(()=>{}),await e}async runMergePass(){let e;try{let i=await this.app.vault.adapter.stat(this.getDbPath());if(!i)return;e=i.mtime}catch{return}if(e===this.lastDiskMtime)return;let t;try{t=await this.app.vault.adapter.read(this.getDbPath())}catch(i){console.error("Can't merge external db changes:",i);return}try{let{schema:i,db:n}=ye(t);this.mergeDiskDb(n),this.lastDiskMtime=e,this.noteSchema(i,!1)}catch(i){console.error("Can't merge external db changes:",i),await this.preserveUnreadableDb(t,i)}}async writeDb(){if(!this.dbDirty)return;await this.mergeExternalChanges(),this.trimToLimit();let e=this.rev,t={};for(let s of Object.keys(this.db)){let o=this.db[s],a=(o.scroll??0)>0?void 0:this.defaultCursorLine(s);t[s]=Ut(o,a)}let i=JSON.stringify({schema:ne,lastPositions:t}),n=this.getDbPath();try{await this.app.vault.adapter.write(n,i)}catch{await this.ensureDbFolder();try{await this.app.vault.adapter.write(this.getDbPath(),i)}catch(s){console.error("Can't write database:",s);return}}await this.cacheDiskMtime(),this.lastSeenSchema=ne,this.dbDirty=e!==this.rev}renameFile(e,t){this.db[t]&&(this.db[e]=this.db[t],delete this.db[t],this.markDirty())}deleteFile(e){this.db[e]&&(delete this.db[e],this.markDirty())}};var te=require("obsidian");function lt(r,e){return!!r!=!!e?!1:!r||!e?!0:r.from.ch===e.from.ch&&r.from.line===e.from.line&&r.to.ch===e.to.ch&&r.to.line===e.to.line}function K(r,e){let t=r.cursor,i=e.cursor;return lt(t,i)?r.scroll===e.scroll:!1}var Ee=class r{constructor(e,t){this.lastPersisted="";this.leavesByPath=new Map;this.app=e,this.database=t,this.leafStates=r.loadLeafStates(e),this.reindexLeaves()}static storageKeyFor(e){return`position-restore:tabs:${e.appId??e.vault.getName()}`}static loadLeafStates(e){try{let t=r.storageKeyFor(e),i=window.localStorage.getItem(t);if(!i)return new Map;let n=JSON.parse(i),s=new Map;for(let[o,a]of Object.entries(n))a&&typeof a.filePath=="string"&&a.st&&s.set(o,a);return s}catch(t){return console.error("Position Restore: can not read the position overlay:",t),new Map}}leafRecord(e){return this.leafStates.get(e)}leafEntries(){return this.leafStates.entries()}leafIdsOnPath(e){let t=this.leavesByPath.get(e);return t?[...t]:[]}putLeaf(e,t){this.leafStates.set(e,t),this.reindexLeaves()}dropLeaf(e){this.leafStates.delete(e),this.reindexLeaves()}reindexLeaves(){this.leavesByPath.clear();for(let[e,t]of this.leafStates){let i=this.leavesByPath.get(t.filePath);i?i.add(e):this.leavesByPath.set(t.filePath,new Set([e]))}}dropLeavesWhere(e){let t=!1;for(let[i,n]of this.leafEntries())e(i,n)&&(this.dropLeaf(i),t=!0);return t}read(e,t){let i=this.leafRecord(e);return i&&i.filePath===t?i.st:this.database.db[t]}fileLayerHolds(e,t){let i=this.database.db[e];return i!==void 0&&K(i,t)}write(e,t,i){let n=this.leafRecord(e),s=n!==void 0&&n.filePath===t;s&&K(n.st,i)||(this.putLeaf(e,{filePath:t,st:i}),(s||!this.fileLayerHolds(t,i))&&this.database.setState(t,i))}forgetLeaf(e){this.dropLeaf(e)}dropPath(e){this.database.deleteFile(e);for(let t of this.leafIdsOnPath(e))this.dropLeaf(t)}deleteFile(e){this.dropPath(e)}dropExcluded(e){this.dropPath(e)}renameFile(e,t){this.database.renameFile(e,t);for(let i of this.leafIdsOnPath(t)){let n=this.leafRecord(i);n&&this.putLeaf(i,{...n,filePath:e})}}pruneDeadLeaves(e){return this.dropLeavesWhere(t=>!e.has(t))}pruneDatabase(){let e=new Set(Object.keys(this.database.db)),t=this.database.pruneDb();return t===0?0:(this.dropLeavesWhere((n,s)=>e.has(s.filePath)&&this.database.db[s.filePath]===void 0)&&this.persist(),t)}overlayRecords(){let e={};for(let[t,i]of this.leafEntries())i.filePath&&(this.fileLayerHolds(i.filePath,i.st)||(e[t]=i));return e}persist(){try{let e=JSON.stringify(this.overlayRecords());if(e===this.lastPersisted)return;let t=r.storageKeyFor(this.app);window.localStorage.setItem(t,e),this.lastPersisted=e}catch(e){console.error("Position Restore: can not persist the position overlay:",e)}}};var qt=require("obsidian");function A(r,e){let t=r.workspace.rootSplit,i=e.containerEl;return!!t?.containerEl&&!!i&&t.containerEl.contains(i)}function re(r){let e=r.containerEl;return!!e&&!!e.closest?.(".hover-popover")}function dt(r){let e=r.workspace.getActiveViewOfType(qt.MarkdownView);if(e?.file)return e;let t,i=-1;for(let n of r.workspace.getLeavesOfType("markdown")){if(re(n)||ct(n))continue;let s=n.view;if(!s?.file)continue;let o=n.activeTime??0;o>i&&(i=o,t=s)}return t}function Jt(r){return r.id}function $(r){if(r)try{let e=r.getDisplayText();return typeof e=="string"&&e?e:void 0}catch{return}}function G(r){if(r)try{let e=r.getIcon();return typeof e=="string"&&e?e:void 0}catch{return}}function ct(r){return!!r?.isDeferred}function se(r,e){let t=r.viewRegistry;if(!t?.getViewCreatorByType)return!1;try{return!t.getViewCreatorByType(e)}catch{return!1}}function Xt(r){return r.navigation!==!1}function Yt(r){let e=O(r)?.file;return typeof e=="string"&&e?e:void 0}var Rn=2048;function O(r){if(r)try{let e=r.getState();if(!e||typeof e!="object"||Array.isArray(e))return;let t=JSON.stringify(e);if(!t||t==="{}"||t.length>Rn)return;let i=JSON.parse(t);return i&&typeof i=="object"&&!Array.isArray(i)?i:void 0}catch{return}}var ke=require("obsidian"),zt=2e3;function q(r){return r.containerEl}var Se=class{constructor(){this.covered=new Map}isCovered(e){return this.covered.has(e)}appliedAt(e){return this.covered.get(e)?.appliedAt}contentArrived(e){let t=this.covered.get(e);return t?.ready?t.ready():!0}cover(e,t){let i=this.covered.get(e);i&&window.clearTimeout(i.timer);let n={timer:0,ready:t??i?.ready,appliedAt:i?.appliedAt};this.covered.set(e,n),this.applyCover(e),this.markVisible(e,n),n.timer=window.setTimeout(()=>{this.uncover(e)},zt),i||window.requestAnimationFrame(()=>this.reapplyCover(e))}uncover(e){let t=this.covered.get(e);if(!t)return;window.clearTimeout(t.timer),this.covered.delete(e);let i=q(e).querySelector(".view-content");i instanceof HTMLElement&&i.setCssStyles({opacity:""}),q(e).setCssStyles({opacity:""}),q(e).setCssStyles({backgroundColor:""})}restoreCover(e){e.contentEl.setCssStyles({opacity:"0"})}revealRestoreCover(e){e.contentEl.setCssStyles({opacity:""})}applyCover(e){let t=q(e).querySelector(".view-content");if(!(t instanceof HTMLElement)){q(e).setCssStyles({backgroundColor:"var(--background-primary)"});return}t.setCssStyles({opacity:"0"}),q(e).setCssStyles({backgroundColor:""})}markVisible(e,t){if(t.appliedAt===void 0){if(ke.Platform.isPhone){if(t.ready){if(!t.ready())return}else if(!this.contentShown(e))return}t.appliedAt=Date.now()}}contentShown(e){let t=e.view;return t instanceof ke.MarkdownView&&t.data.length>0}reapplyCover(e){let t=this.covered.get(e);if(!t)return;this.applyCover(e);let i=t.appliedAt;this.markVisible(e,t),i===void 0&&t.appliedAt!==void 0&&(window.clearTimeout(t.timer),t.timer=window.setTimeout(()=>{this.uncover(e)},zt)),window.requestAnimationFrame(()=>this.reapplyCover(e))}};function Fe(r){let e=[],t,i=!1,n=!1,s=r[0]?.trim()==="---";for(let o=0;o0&&a.trim()==="---"&&(s=!1);continue}if(i){a.includes("-->")&&(i=!1);continue}if(n){a.includes("%%")&&(n=!1);continue}let d=a.match(/^ {0,3}(`{3,}|~{3,})/);if(d){t?d[1][0]===t[0]&&d[1].length>=t.length&&(t=void 0):t=d[1];continue}if(t)continue;let c=a.indexOf("",c)===-1){i=!0;continue}let p=a.indexOf("%%");if(p!==-1&&a.indexOf("%%",p+2)===-1){n=!0;continue}let h=a.match(/^ {0,3}(#{1,6})(?:[ \t]|$)(.*)$/);if(!h)continue;let f=h[2].replace(/[ \t]+#+[ \t]*$/,"").replace(//g,"").replace(/%%[\s\S]*?%%/g,"").trim();f&&e.push({heading:f,level:h[1].length,line:o})}return e}function J(r,e){if(!r||!r.length)return[];let t=[];for(let i of r){if(i.line>e)break;for(;t.length&&t[t.length-1].level>=i.level;)t.pop();t.push(i)}return t.map(i=>i.heading)}var oi=require("obsidian");function M(r){let e=Qt(r);if(e===void 0)return;let t={scroll:e},i=Zt(r);return i&&(t.cursor=i),t}function Qt(r){let e=r.currentMode?.getScroll();if(!(e==null||!Number.isFinite(e)))return Math.round(e)}function Zt(r){let e=r.editor;if(!e)return;let t=e.getCursor("anchor"),i=e.getCursor("head");if(!(!t||!i||t.line===0&&t.ch===0&&i.line===0&&i.ch===0))return{from:{ch:t.ch,line:t.line},to:{ch:i.ch,line:i.line}}}var An=/^(?:-{3,}|\*{3,}|_{3,})$/;function ei(r,e){let t={},i=r.editor;if(!i||typeof i.getLine!="function")return t;if(e>=0&&e<=(i.lastLine?.()??-1)){let s=i.getLine(e).trim().slice(0,80);s&&!An.test(s)&&(t.anchor=s)}let n=r.file&&typeof r.file.stat?.mtime=="number"?r.file.stat.mtime:void 0;return n!==void 0&&(t.mtime=n),t}function xe(r,e){return{...r,cursor:{from:{line:e,ch:0},to:{line:e,ch:0}}}}function ti(r){let e=r.scroll;return e!=null&&Number.isFinite(e)?Math.round(e):void 0}function ii(r){let e=ti(r)??Qt(r);if(e===void 0)return;let t={scroll:e},i=Zt(r);return i&&(t.cursor=i),t}function Mn(r,e){let t=r.editor?.cm?.scrollDOM;return!t||t.offsetParent!==null?e:ti(r)??e}function S(r){let e=M(r);if(!e)return;let t=Mn(r,e.scroll);return{...e,scroll:t,...ei(r,t??-1)}}var ni=S;function ri(r,e){return{...e,...ei(r,e.scroll??-1)}}var Nn=30;function F(r){return r.toLowerCase().replace(/[\s\p{P}\p{S}]/gu,"")}function Dn(r,e,t){if(!r||e===void 0||e<0)return;let i=t.lastLine(),n=F(r);for(let s of[o=>o.trim()===r,o=>F(o)===n]){if(e<=i&&s(t.getLine(e)))return e;for(let o=1;o<=Nn;o++)for(let a of[e+o,e-o])if(!(a<0||a>i)&&s(t.getLine(a)))return a}}function si(r,e){let t=e.scroll??e.cursor?.from.line;if(t===void 0||t<0)return e;let i=Dn(e.anchor,t,r);return i===void 0||i===t?e:oe(e,i-t)}function oe(r,e){if(e===0)return r;let t={...r,anchor:void 0};return t.scroll!==void 0&&(t.scroll=Math.max(0,t.scroll+e)),t.cursor&&(t.cursor={from:{...t.cursor.from,line:Math.max(0,t.cursor.from.line+e)},to:{...t.cursor.to,line:Math.max(0,t.cursor.to.line+e)}}),t}function L(r,e){let t={};e.cursor&&(t.cursor=e.cursor),e.scroll&&e.scroll>0&&(t.scroll=e.scroll),Object.keys(t).length>0&&r.setEphemeralState(t)}var ai=100,pt=2e3,ht=600,li=1500;function X(r){return new Promise(e=>window.setTimeout(e,r))}function u(){return new Promise(r=>{let e=!1,t=window.setTimeout(()=>{e||(e=!0,r())},100);window.requestAnimationFrame(()=>{e||(e=!0,window.clearTimeout(t),r())})})}async function ut(r,e,t=pt){let i=Date.now()+t;for(;e()&&Date.now()0&&e.scrollHeight>0&&r.currentMode?.getScroll()!=null}function On(r,e){let t=M(r);if(!t||(e.scroll??0)>0&&(t.scroll!==e.scroll||r.getMode()==="preview"&&!mt(r)))return!1;let i=e.cursor;if(!i)return!0;let n=t.cursor??{from:{line:0,ch:0},to:{line:0,ch:0}};return i.from.line===n.from.line&&i.from.ch===n.from.ch&&i.to.line===n.to.line&&i.to.ch===n.to.ch}async function ft(r,e,t,i=ht){let n=Date.now()+i,s=0;for(;Date.now()=3)return}else s=0,L(r,e)}}function x(r){return r instanceof oi.MarkdownView?r.getMode()==="source"?r.contentEl.querySelector(".cm-scroller"):r.containerEl.querySelector(".markdown-preview-view"):r.containerEl.querySelector(".bases-view")}function mt(r){let e=x(r);return!!e&&e.scrollTop>0}var In=4e3,Hn=2e3,Vn=750;function _n(r,e){if(r.length<=1)return[];let t=r.filter(i=>i.level===1).length===1?r.filter(i=>i.level!==1):r;return J(t,e)}var Pe=class{constructor(e){this.chip=null;this.hideTimer=0;this.shownAt=0;this.settings=e}show(e,t){if(this.clearHideTimer(),!this.settings.restoreBreadcrumb)return;let i=t??Math.round(e.currentMode?.getScroll()??0),n=Fe((e.data??"").split(` +`)),s=_n(n,i);s.length!==0&&(this.hasVisibleHeading(e,n)||(this.removeChip(),this.showChip(e,s),this.shownAt=Date.now(),this.hideTimer=window.setTimeout(()=>this.hide(),In)))}flashLine(e,t){if(!this.settings.flashLandingLine)return;if(e.getMode()==="preview"){let s=this.previewLineElement(e,t);s&&this.flash(s);return}let i=e.editor.cm,n=i?this.sourceLineElement(i,t):null;n&&this.flash(n)}dismissOnMove(){this.chip&&(Date.now()-this.shownAte.remove(),220))}hasVisibleHeading(e,t){if(t.length===0)return!1;if(e.getMode()==="preview"){let c=x(e);if(!c)return!1;let p=c.getBoundingClientRect();for(let h of Array.from(c.querySelectorAll("h1, h2, h3, h4, h5, h6"))){let f=h.getBoundingClientRect();if(f.topp.top)return!0}return!1}let i=e.editor.cm,n=x(e);if(!i||!n)return!1;let s=n.getBoundingClientRect();if(s.height<=0)return!1;let o=i.state.doc,a=o.lineAt(i.viewport.from).number,d=o.lineAt(i.viewport.to).number;for(let c of t){let p=c.line+1;if(pd)continue;let h=this.sourceLineElement(i,c.line);if(!h)continue;let f=h.getBoundingClientRect();if(f.tops.top)return!0}return!1}previewLineElement(e,t){let n=e.previewMode?.renderer?.sections;if(!Array.isArray(n))return null;for(let s of n){let o=s?.start?.line,a=s?.lines;if(!(typeof o!="number"||typeof a!="number")&&t>=o&&t<=o+Math.max(0,a-1))return s.el??null}return null}sourceLineElement(e,t){try{let i=e.state.doc,n=Math.min(Math.max(0,t),i.lines-1)+1,s=e.domAtPos(i.line(n).from);return(s.node.instanceOf(Element)?s.node:s.node.parentElement)?.closest(".cm-line")??null}catch{return null}}flash(e){e.addClass("is-flashing"),window.setTimeout(()=>e.removeClass("is-flashing"),Vn)}showChip(e,t){let i=e.contentEl;getComputedStyle(i).position==="static"&&i.addClass("position-restore-cue-host");let n=i.createDiv({cls:"position-restore-cue"});for(let s=0;s0&&n.createSpan({text:" / ",cls:"position-restore-cue-sep"});let o=s===t.length-1;n.createSpan({text:t[s],cls:o?"position-restore-cue-seg is-deepest":"position-restore-cue-seg"})}n.setAttribute("title",t.join(" / ")),this.chip=n,n.animate([{opacity:0},{opacity:1}],{duration:150,easing:"ease-out"}),n.setCssStyles({opacity:"1"})}removeChip(){this.clearHideTimer(),this.chip&&(this.chip.remove(),this.chip=null)}clearHideTimer(){this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=0)}};var Le=3e3,Te=class{constructor(e){this.injectedOpenLeafIds=new Set;this.lastActiveFilePath=void 0;this.restoreRun=0;this.activeRestores=0;this.inFlightRestoreLeafRuns=new Map;this.noAnchorLeafIds=new Set;this.lastAnchorAt=0;this.lastTouchAt=0;this.lastUserInputAt=0;this.handledLeafIdMap=new Map;this.pendingOpenKind=new Map;this.pendingLinkKindTimeout=0;this.pendingHistoryNav=!1;this.pendingHistoryNavTimeout=0;this.injectedLeafStates=new Map;this.cueSuppressUntil=0;this.searchAnchorUntil=0;this.cover=new Se;this.cue=new Pe(e)}beginLeafRestore(e,t){let i=++this.restoreRun;return this.inFlightRestoreLeafRuns.set(e,{filePath:t,run:i}),i}isCurrentLeafRestore(e,t){let i=this.inFlightRestoreLeafRuns.get(e);return!!i&&i.run===t}isRestoringFile(){return this.activeRestores>0}restoreStarted(){this.activeRestores++}restoreEnded(){this.activeRestores--}isSearchAnchored(){return Date.now()s||!mt(e))return;let h=M(e);if(!h||h.scroll===void 0||h.scroll===n)return;let f=Math.abs(h.scroll-n);if(f>=d){if(++c>=2)return}else c=0,d=f;if(a+=n-h.scroll,a<=0)return;L(e,{...t,scroll:a}),await X(p),p=Math.min(p*1.4,jn)}}cmOf(e){let t=e.editor.cm;return t?.state?.doc&&t.scrollDOM?t:null}docMatchesView(e,t){let i=e.data;if(typeof i!="string"||i.length===0)return!0;let n=t.state.doc;return n.length!==i.length?!1:n.toString()===i}docIdentity(e){return this.cmOf(e)?.state.doc}noteArrived(e,t){if(!(e instanceof di.MarkdownView))return!0;if(e===t.view&&t.doc!==void 0){let i=this.docIdentity(e);if(i!==void 0)return i!==t.doc}return typeof e.data=="string"&&e.data.length>0&&e.data!==t.data}targetTopMeasurer(e,t,i){let n=t.scrollDOM,s=!1;return()=>{if(!s){if(!this.docMatchesView(e,t))return null;s=!0}if(i+1>t.state.doc.lines)return null;let o=t.state.doc.line(i+1).from;if(o=t.viewport.to)return null;let a=t.coordsAtPos(o);return a?a.top-n.getBoundingClientRect().top:null}}bottomVisibleMeasurer(e){let t=e.scrollDOM;return()=>{let i=t.getBoundingClientRect(),n=e.posAtCoords({x:i.left+i.width/2,y:i.bottom-2})??e.state.doc.line(e.state.doc.lines).from,s=e.coordsAtPos(n);return s?s.top-i.top:null}}async landingNotInSight(e,t,i){if(t<=0)return!1;let n=this.cmOf(e);if(!n||t+1>n.state.doc.lines||(n.requestMeasure(),await u(),await u(),!i()))return!1;let s=this.targetTopMeasurer(e,n,t)();return s===null?!0:Math.abs(s)>n.scrollDOM.clientHeight/2}async settleShortCover(e,t,i,n,s){let o=this.cmOf(e);if(!o){let b=Math.min(s,Date.now()+Jn);for(;i()&&Date.now()n)return;let b=a();if(b===null){o.requestMeasure(),h=null,v=-1,await u();continue}let g=Date.now(),P=Math.max(1,g-w);w=g,m<0&&(m=g);let nt=d();if(nt===null){o.requestMeasure(),h=null,v=-1,await u();continue}if(h===null||Math.abs(b-h)>p||Math.abs(nt-f)>p){h=b,f=nt,v=-1,await u();continue}if(v<0&&(v=g,o.requestMeasure()),g-v>=Math.max(qn,P*2)&&g>=m+Gn)return;await u()}}async settleAndHold(e,t,i,n,s){let o=this.cmOf(e);if(!o)return;let a=this.targetTopMeasurer(e,o,t),d=o.scrollDOM,c=o.defaultLineHeight||20,p=c*2,h=null,f=-1,v=0;for(;i()&&Date.now()n)return;let m=a();if(m===null){o.requestMeasure(),h=null,f=-1,await u();continue}h!==null&&Math.abs(m-h)<=c/2?f<0&&(f=Date.now(),o.requestMeasure()):f=-1,h=m;let w=f>=0&&Date.now()-f>=$n,b=Math.abs(m)>p;if(!b&&!w){await u();continue}if(b){if(o.requestMeasure(),await u(),await u(),!i())return;let P=a();if(P===null)return;if(Math.abs(P)>p){if(v>=2)return;d.scrollTop+=P,v++,h=null,f=-1,await u();continue}if(h=P,w)return;await u();continue}let g=a();if(g===null)return;if(Math.abs(g)>p||Math.abs(g-m)>c/2){f=-1,h=g,await u();continue}return}}async settleSourcePixels(e,t,i,n){if(!t||!t.scroll||t.scroll<=0||e.getMode()!=="source")return;let s=this.cmOf(e);if(!s)return;let o=s.scrollDOM,a=t.scroll,d=s.defaultLineHeight||20,c=this.state.lastTouchAt,p=Date.now(),h=p+n,f=this.targetTopMeasurer(e,s,a),v=!1,m=null;for(;i()&&Date.now()c)return;let b=f();if(b===null){m=null,s.requestMeasure(),await u();continue}if(Date.now()-p>=Un&&m!==null&&Math.abs(b-m)<=d/2){v=!0;break}m=b,await u()}if(!v)return;let w=0;for(;w<2&&i();){if(this.state.lastTouchAt>c)return;let b=f();if(b===null||Math.abs(b)<=d*2)return;s.requestMeasure(),await u(),await u();let g=f();if(g===null||Math.abs(g)<=d*2)return;o.scrollTop+=g,w++;let P=Date.now()+Kn;for(;i()&&Date.now()c)return;await u()}}}async relandSourcePixels(e,t,i,n){if(!i()||this.state.lastTouchAt>n)return;let s=this.cmOf(e);if(!s)return;let o=s.scrollDOM;if(!this.docMatchesView(e,s)||t+1>s.state.doc.lines)return;let a=s.state.doc.line(t+1).from;if(a=s.viewport.to)return;s.requestMeasure(),await u(),await u();let d=s.coordsAtPos(a);if(!d)return;let c=d.top-o.getBoundingClientRect().top;Math.abs(c)>o.clientHeight/2&&(o.scrollTop+=c)}};var ui=5e3,fi=8,Xn=3,I=class{constructor(e){this.state=e,this.pixels=new Y(e)}async restoreInjectedSource(e,t,i){let n=this.state.lastTouchAt,s=Date.now()+hi,o=t;try{let a=await this.waitContentArrived(e,i,s),d=t?.scroll??0;a&&i()&&d>0&&t&&await this.pixels.landingNotInSight(e,d,i)&&(L(e,t),await u());let c=a&&i()&&t?.scroll?await this.centerNamedLine(e,i):void 0;c!==void 0&&t&&(o={...t,scroll:c});let p=o?.scroll,h=await this.waitCoverApplied(e,i,s);h!==void 0&&i()&&p&&await this.pixels.settleShortCover(e,p,i,n,h+pi)}finally{i()&&this.state.cover.uncover(e.leaf)}await this.anchorToSettledState(e,o,i)}async waitContentArrived(e,t,i){for(;t()&&Date.now()i()&&Math.max(this.state.lastTouchAt,this.state.lastUserInputAt)<=o;try{if(await ut(e,i,Math.min(pt,s-Date.now())),!i()||e.containerEl.querySelector(".is-flashing")||(await u(),!i()))return;if(n()&&t){let c=s-Date.now();c>0&&await ft(e,t,a,c)}else await u(),await u();if(!i())return;await this.pixels.settleSourcePixels(e,t,i,gt)}finally{i()&&(this.state.cover.uncover(e.leaf),this.state.cover.revealRestoreCover(e))}await this.anchorToSettledState(e,t,i)}async maskedRestoreSt(e,t,i){if((t.scroll??0)<=0){if(L(e,t),await u(),!i()||(await u(),!i()))return;await this.anchorToSettledState(e,t,i);return}await this.maskedRestore(e,t,i,()=>(L(e,t),!0))}async landPreview(e,t,i){try{if(await ut(e,i),!i()||e.containerEl.querySelector(".is-flashing"))return;await ft(e,t,i)}finally{i()&&this.state.cover.uncover(e.leaf)}await this.anchorToSettledState(e,t,i)}async historyJumpApply(e,t,i,n){n!==void 0?t=oe(t,n):t=si(e.editor,t);let s=this.namedLineAsk(e)!==void 0;if(L(e,s?{...t,scroll:0}:t),await u(),!i())return;let o=await this.centerNamedLine(e,i);if(o!==void 0)t={...t,scroll:o};else if(s&&(L(e,t),await u(),!i()))return;e.getMode()==="source"&&(t.scroll??0)>0&&await this.pixels.settleSourcePixels(e,t,i,gt),await this.anchorToSettledState(e,t,i)}namedLineTarget(e){let t=this.state.pendingLineFlash;if(!(!t||e.getMode()!=="source"||e.file?.path!==t.path)&&!(Date.now()-t.at>=ui))return t}namedLineAsk(e){let t=this.namedLineTarget(e);if(t&&t.center!==!1&&typeof e.editor?.scrollIntoView=="function")return t}async centerNamedLine(e,t){let i=this.namedLineTarget(e);if(i&&i.center!==!1&&!this.namedLineAsk(e))for(let o=0;o.01;if(s>=1&&(d||o>=fi-1))return Math.max(1,Math.round(a))}return n===void 0?void 0:Math.max(1,Math.round(n))}readScroll(e){let t=e.currentMode?.getScroll();return typeof t=="number"&&Number.isFinite(t)?t:void 0}async anchorToSettledState(e,t,i){if(!this.state.noAnchorLeafIds.has(this.state.leafId(e.leaf))&&(await X(ai),i()&&(e.getMode()==="source"||mi.Platform.isMobileApp)&&await this.pixels.relandDriftedScroll(e,t,i),i())){this.state.lastEphemeralState=M(e)??t,this.state.lastAnchorAt=Date.now();let n=this.markLandingLine(e);Date.now()>=this.state.cueSuppressUntil&&(this.markRestoredLine(e),this.state.cue.show(e,n))}}markLandingLine(e){let t=this.state.pendingLineFlash;if(t){if(Date.now()-t.at>=ui){this.state.pendingLineFlash=void 0;return}if(e.file?.path===t.path&&(this.state.pendingLineFlash=void 0,!(t.sourceOnly&&e.getMode()!=="source")))return this.state.cue.flashLine(e,t.line),t.line}}markRestoredLine(e){if(e.getMode()==="preview")return;let t=e.editor?.getCursor()?.line;t&&this.state.cue.flashLine(e,t)}};var Re=class{constructor(e,t,i){this.settleInProgress=!1;this.app=e,this.store=t,this.state=i,this.modes=new I(this.state)}start(e){let t=Date.now()+1e4,i=window.setInterval(()=>{this.settleInProgress||this.completeBackgroundRestores().then(n=>{(n||Date.now()>t)&&window.clearInterval(i)})},200);e(()=>window.clearInterval(i))}async completeBackgroundRestores(){if(this.settleInProgress)return!1;this.settleInProgress=!0;try{return await this.completeBackgroundRestoresInner()}finally{this.settleInProgress=!1}}async completeBackgroundRestoresInner(){if(!this.app.workspace.layoutReady)return!1;await u();let e=[];this.app.workspace.iterateAllLeaves(s=>{e.push(s)});let t=this.app.workspace.getActiveViewOfType(vt.MarkdownView),i=t?.leaf?this.state.leafId(t.leaf):void 0,n=!1;for(let s of e){let o=s.view;if(!(o instanceof vt.MarkdownView)||!o.file)continue;let a=this.state.leafId(s),d=o.file.path;if(a===i||this.state.inFlightRestoreLeafRuns.get(a)?.filePath===d)continue;let c=this.state.injectedOpenLeafIds.has(a);if(c&&this.state.handledLeafIdMap.get(a)!==d){this.state.injectedOpenLeafIds.delete(a);continue}if(!o.editor){n=!0;continue}if(c)await this.settleBackground(o,a,d);else if(this.state.handledLeafIdMap.get(a)!==d){let p=this.store.read(a,d);if(!p)continue;await this.restoreBackground(o,a,d,p)}}return!n}async settleBackground(e,t,i){let n=this.store.read(t,i),s=()=>e.file?.path===i;if(!!n&&(n.scroll??0)>0){this.state.cover.isCovered(e.leaf)||this.state.cover.cover(e.leaf),this.state.restoreStarted();try{await this.modes.settleInjectedReveal(e,n,s)}finally{this.state.restoreEnded()}}else s()&&this.state.cover.uncover(e.leaf);s()&&this.state.injectedOpenLeafIds.delete(t)}async restoreBackground(e,t,i,n){let s=()=>e.file?.path===i;this.state.noAnchorLeafIds.add(t),this.state.restoreStarted();try{await this.modes.maskedRestoreSt(e,n,s)}finally{this.state.noAnchorLeafIds.delete(t),this.state.restoreEnded()}s()&&this.state.handledLeafIdMap.set(t,i)}};var z=require("obsidian");var Ae=class{constructor(e,t,i,n){this.app=e,this.settings=t,this.store=i,this.state=n,this.modes=new I(this.state)}async restoreEphemeralState(){let e=this.app.workspace.getActiveViewOfType(z.FileView);if(e?.file&&!re(e.leaf)){if(e instanceof z.MarkdownView){await this.restoreMarkdown(e);return}e.getViewType()==="bases"&&this.settings.recordBaseScroll?await this.restoreFileViewScroll(e):this.state.cue.hide()}}async completeInjectedRestore(e){if(!this.app.workspace.layoutReady)return;let t=this.state.lastActiveFilePath,i=e?.view?.file?.path;this.state.lastActiveFilePath=i,await u();let n=this.app.workspace.getActiveViewOfType(z.MarkdownView);if(!n?.file)return;let s=this.state.leafId(n.leaf),o=n.file.path;if(this.state.injectedOpenLeafIds.has(s)){await this.restoreEphemeralState();return}t===o&&this.state.handledLeafIdMap.get(s)!==o&&await this.restoreEphemeralState()}async restoreMarkdown(e){let t=e.file?.path;t&&await this.restoreOpen(e,t,async(i,n,s)=>{let o=s??this.store.read(this.state.leafId(e.leaf),t),a=e.getMode();if(a==="source"){if(!o)return;n?await this.modes.restoreInjectedSource(e,o,i):await this.modes.maskedRestoreSt(e,o,i);return}if(a==="preview")if(o)n?await this.modes.landPreview(e,o,i):await this.modes.maskedRestoreSt(e,o,i);else return})}async restoreFileViewScroll(e){let t=e.file?.path;t&&await this.restoreOpen(e,t,async i=>{await this.landBaseScroll(e,t,i)})}async restoreOpen(e,t,i){let n=e instanceof z.MarkdownView,s=this.state.leafId(e.leaf),o=this.state.inFlightRestoreLeafRuns.get(s);if(o&&o.filePath===t)return;let a=n&&this.state.injectedOpenLeafIds.delete(s),d=a?this.state.injectedLeafStates.get(s):void 0;if(a&&this.state.injectedLeafStates.delete(s),n&&!(a&&this.state.cover.isCovered(e.leaf))&&this.state.cover.revealRestoreCover(e),this.state.pendingOpenKind.get(e.leaf)){this.state.pendingOpenKind.delete(e.leaf),this.state.cue.hide(),this.skipRestoreAndAnchor(e,t);return}if(!a&&this.hasOpenedLeafPath(e.leaf,t)){this.skipRestoreAndAnchor(e,t);return}this.state.cue.hide();let p=this.state.beginLeafRestore(s,t),h=()=>this.state.isCurrentLeafRestore(s,p)&&e.file?.path===t;this.state.restoreStarted();try{this.state.lastEphemeralState=void 0,this.state.lastLoadedFilePath=t,await i(h,a,d)}finally{let f=this.state.inFlightRestoreLeafRuns.get(s);f&&f.run===p&&this.state.inFlightRestoreLeafRuns.delete(s),this.state.restoreEnded()}}async landBaseScroll(e,t,i){let s=this.store.read(this.state.leafId(e.leaf),t)?.scroll??0;if(s<=0)return;let o=Date.now()+500,a=null;for(;i()&&!a&&Date.now()=3)break}else p=0,Date.now()-c>=100&&(a.scrollTop=s,c=Date.now());await u()}}skipRestoreAndAnchor(e,t){this.state.lastEphemeralState=void 0,this.state.lastLoadedFilePath=t,this.state.lastAnchorAt=Date.now(),this.state.cover.uncover(e.leaf)}hasOpenedLeafPath(e,t){let i=this.state.leafId(e),n=this.state.handledLeafIdMap.get(i);return n?n===t?!0:(this.state.handledLeafIdMap.set(i,t),!1):(this.pruneStaleLeafIds(),this.state.handledLeafIdMap.set(i,t),!1)}pruneStaleLeafIds(){let e=new Set;this.app.workspace.iterateAllLeaves(t=>{e.add(this.state.leafId(t))});for(let t of this.state.handledLeafIdMap.keys())e.has(t)||this.state.handledLeafIdMap.delete(t);for(let t of this.state.injectedOpenLeafIds)e.has(t)||this.state.injectedOpenLeafIds.delete(t);for(let t of this.state.injectedLeafStates.keys())e.has(t)||this.state.injectedLeafStates.delete(t);for(let t of this.state.pendingOpenKind.keys())e.has(this.state.leafId(t))||this.state.pendingOpenKind.delete(t);this.store.pruneDeadLeaves(e)}};var N=require("obsidian");var Yn=new Set(["empty"]);function Me(r){return!!r&&!Yn.has(r)}function y(r){return r.kind==="view"?`view:${r.viewType}`:r.path}function Ne(r){if(r.kind!=="view")return;let e=r;e.state!==void 0&&(!e.state||typeof e.state!="object"||Array.isArray(e.state))&&delete e.state,e.icon!==void 0&&!(typeof e.icon=="string"&&e.icon)&&delete e.icon,e.label!==void 0&&!(typeof e.label=="string"&&e.label)&&delete e.label}function gi(r){let e=r.indexOf("|");return e<0?r:r.slice(0,e)}function De(r){let e=r.indexOf("#"),t=r.indexOf("^"),i=t<0?e:e<0?t:Math.min(e,t);if(i<0)return;let n=r.slice(i+1);return r[i]!=="^"&&!n.startsWith("^")?void 0:(n.startsWith("^")?n.slice(1):n).toLowerCase()}function wt(r){if(r.kind==="view")return;if(r.kind==="jump"&&typeof r.keyLine=="number")return r.keyLine;let e=r.st;if(e)return e.scroll??e.cursor?.from.line}var Ce=class{constructor(e,t,i,n,s,o){this.app=e,this.settings=t,this.store=i,this.funnel=s,this.sampler=o,this.state=n,this.pixels=new Y(n)}installPatches(e){this.patchSetViewState(e),this.patchOpenLinkText(e)}patchSetViewState(e){let t=N.WorkspaceLeaf.prototype,i=t.setViewState;if(!i)return;let n=(s,o,a)=>this.injectEphemeralStateOnOpen(s,o,a);t.setViewState=function(s,o){return o=n(this,s,o),i.call(this,s,o)},e(()=>{t.setViewState=i})}patchOpenLinkText(e){let t=this.app.workspace,i=t.openLinkText;if(typeof i!="function")return;let n=this.state,s=this.settings;t.openLinkText=async function(...o){n.pendingLinkKind=void 0,n.pendingLinkText=void 0;let a=o[0];typeof a=="string"&&(a.includes("#")||a.includes("^"))?(n.pendingLinkKind="anchorLink",n.pendingLinkText=gi(a)):s.linkOpenPosition==="start"&&(n.pendingLinkKind="startPlainLink");try{return await i.apply(this,o)}finally{window.clearTimeout(n.pendingLinkKindTimeout),n.pendingLinkKindTimeout=window.setTimeout(()=>{n.pendingLinkKind=void 0,n.pendingLinkText=void 0},500)}},e(()=>{t.openLinkText=i})}injectEphemeralStateOnOpen(e,t,i){if(!t||typeof t.type!="string")return i;let n=t.state?.file;if(typeof n!="string"||!n||re(e))return i;let s=this.state.leafId(e),o=this.state.handledLeafIdMap.get(s)===n;o?this.state.pendingOpenKind.delete(e):this.resetLeafOpenState(e);let a=e.view;if(a instanceof N.MarkdownView&&a.file){let v=S(a);v&&(this.funnel.leave(a.file.path,s,v),this.sampler.flushOnLeave(a,a.file.path,v))}let d=!!i?.match||!!i?.["is-flashing"];if(A(this.app,e)&&this.funnel.recordOpen(n,s,{key:this.state.pendingLinkText??(d?`caller:${Date.now()}`:void 0),force:d}),this.state.pendingHistoryNav){let v=this.state.pendingHistoryNavPath===n?this.state.pendingHistoryNavState:void 0;if(this.state.pendingHistoryNav=!1,this.state.pendingHistoryNavState=void 0,this.state.pendingHistoryNavPath=void 0,window.clearTimeout(this.state.pendingHistoryNavTimeout),!o&&t.type==="markdown"){let m=v??this.store.read(s,n);if(m&&((m.scroll??0)>0||m.cursor)){let w=this.isSourceModeOpen(e,t),b=this.buildMergedState(m);return this.maybeCoverOpen(e,n,w&&(b.scroll??0)>0),this.state.injectedOpenLeafIds.add(s),this.state.injectedLeafStates.set(s,m),this.state.handledLeafIdMap.set(s,n),{...i,...b}}}return this.state.handledLeafIdMap.set(s,n),i}if(this.takeOverridingOpenKind(e,i,o))return this.state.handledLeafIdMap.set(s,n),this.state.searchAnchorUntil=Date.now()+Le,i;if(t.type!=="markdown"||!this.isSourceModeOpen(e,t))return i;let p=this.store.read(s,n),h=this.buildMergedState(p);if(h.scroll===void 0&&h.cursor===void 0)return i;let f=!this.app.workspace.layoutReady&&!i?.scroll&&!i?.cursor;return o&&!(i&&(i.scroll??0)===(h.scroll??0)&&(i.cursor?.from.line??-1)===(h.cursor?.from.line??-1))&&!f?i:(this.maybeCoverOpen(e,n,(h.scroll??0)>0),this.state.injectedOpenLeafIds.add(s),this.state.handledLeafIdMap.set(s,n),{...h,...i})}resetLeafOpenState(e){this.state.handledLeafIdMap.delete(this.state.leafId(e)),this.state.pendingOpenKind.delete(e)}takeOverridingOpenKind(e,t,i){let n=this.state.pendingLinkKind;if(n)return this.state.pendingOpenKind.set(e,n),this.state.pendingLinkKind=void 0,this.state.pendingLinkText=void 0,window.clearTimeout(this.state.pendingLinkKindTimeout),n;if(this.hasCallerTarget(t,i))return this.state.pendingOpenKind.set(e,"callerTarget"),"callerTarget"}hasCallerTarget(e,t=!1){return e?e.match||e["is-flashing"]?!0:t?!1:!!(e.cursor||e.scroll!=null):!1}buildMergedState(e){let t={};return e&&((e.scroll??0)>0&&(t.scroll=e.scroll),e.cursor&&(t.cursor=e.cursor)),t}maybeCoverOpen(e,t,i){i&&this.state.cover.cover(e,this.contentSwapGate(e,t))}contentSwapGate(e,t){let i=this.screenNote(e,t);if(i===void 0)return;let n=this.expectedContent(e,t);return()=>this.pixels.noteArrived(e.view,i)&&(n===void 0||n())}expectedContent(e,t){let i=this.app.vault,n=i?.getAbstractFileByPath?.(t);if(!(n instanceof N.TFile)||typeof i?.cachedRead!="function")return;let s;i.cachedRead(n).then(d=>{s=d},()=>{});let o,a=!1;return()=>{let d=s;if(d===void 0)return!1;let c=e.view;if(!(c instanceof N.MarkdownView))return!1;let p=this.pixels.docIdentity(c);return p!==void 0&&p===o||(o=p,a=typeof c.data=="string"&&c.data===d),a}}screenNote(e,t){let i=e.view;if(!(!(i instanceof N.MarkdownView)||i.file?.path===t))return{view:i,doc:this.pixels.docIdentity(i),data:i.data}}isSourceModeOpen(e,t){let i=t.state?.mode;if(i==="source"||i==="preview")return i==="source";let n=e.view;return n instanceof N.MarkdownView?n.getMode()==="source":this.app.vault.getConfig("defaultViewMode")!=="preview"}};var vi=require("obsidian"),zn="file-explorer",Oe=class{constructor(e,t,i){this.app=e;this.database=t;this.settings=i}install(e){let t=this.app.workspace,i=t.trigger;typeof i=="function"&&(t.trigger=(n,...s)=>(n==="hover-link"&&this.aim(s[0]),i.call(t,n,...s)),e(()=>{t.trigger=i}),this.patchScrollFlash(e))}patchScrollFlash(e){let t=vi.MarkdownPreviewRenderer.prototype,i=t.applyScrollDelayed;if(typeof i!="function")return;let n=(s,o)=>this.withoutOwnFlash(s,o);t.applyScrollDelayed=function(s,o){return i.call(this,s,n(s,o))},e(()=>{t.applyScrollDelayed=i})}withoutOwnFlash(e,t){return!t?.highlight||e!==this.aimedLine?t:(this.aimedLine=void 0,{...t,highlight:!1})}aim(e){if(this.aimedLine=void 0,this.settings.fileExplorerPreviewFocus!=="line"||!e||typeof e!="object")return;let t=e;if(t.source!==zn||!t.linktext||t.state)return;let i=this.app.vault.getFileByPath(t.linktext);if(!i||i.extension!=="md")return;let n=this.database.db[i.path];(n?.scroll??0)>0&&(t.state={scroll:n.scroll},this.aimedLine=n.scroll)}};var k=require("obsidian");var wi=require("obsidian");var Ie=class{constructor(e,t){this.app=e,this.settings=t}shouldSkipRecording(e){if(e.file){let n=U(this.app,e.file,this.settings);if(n?.forceRecord)return!1;if(n?.skip||this.isExcludedPath(e.file.path))return!0}let t=e instanceof wi.MarkdownView?e.editor:void 0,i=this.settings.minLinesToRecord;return!!(i>0&&t&&t.lineCount(){let t=e.target;if(!t||this.state.isRestoringFile()||this.state.isSearchAnchored()||!this.hasUserIntent())return;let i=this.findOwnerLeaf(t),n=i?.view;if(!i||!(n instanceof k.FileView)||!n.file)return;let s=t.closest(this.EMBED_BOUNDARY_SELECTOR);if(s&&n.containerEl.contains(s))return;let o=n.file.path,a=this.state.leafId(i);if(this.exclusions.shouldSkipRecording(n)){this.store.dropExcluded(o);return}if(n instanceof k.MarkdownView){let d=ii(n);if(!d)return;this.store.write(a,o,d);return}if(n.getViewType()!=="bases"||!this.settings.recordBaseScroll){this.store.forgetLeaf(a);return}this.store.write(a,o,{scroll:Math.round(t.scrollTop)})};this.onEditorSelection=e=>{let t=this.teleportMinLines;if(t<=0){this.teleportFrom=void 0;return}let i=this.app.workspace.getActiveViewOfType(k.MarkdownView);if(!i||i.editor!==e)return;let n=i.file?.path;if(!n||n!==this.state.lastLoadedFilePath)return;let s=e.getCursor("anchor"),o=this.teleportAnchorAt!==this.state.lastAnchorAt;this.teleportAnchorAt=this.state.lastAnchorAt;let a=o?void 0:this.teleportFrom,d=o?void 0:this.teleportFromPath;if(this.teleportFrom=s,this.teleportFromPath=n,e.somethingSelected()){this.teleportFrom=void 0;return}if(!a||d!==n||Math.abs(s.line-a.line){if(this.app.workspace.getActiveViewOfType(k.MarkdownView)!==i||i.file?.path!==n||e.getCursor("anchor").line!==s.line)return;let p=S(i);p&&this.funnel.landing({kind:"teleport",path:n,leafId:c,line:s.line,st:p})})};this.app=e,this.store=t,this.settings=i,this.exclusions=new Ie(e,i),this.state=n,this.funnel=s}get teleportMinLines(){let e=Math.floor(this.settings.navHistoryTeleportMinLines);return Number.isFinite(e)&&e>0?e:0}sampleActiveView(){if(this.state.searchAnchorUntil===Number.POSITIVE_INFINITY&&!this.searchGraceTimer){let a=document.activeElement;(!a||!a.closest(this.SEARCH_INPUT_SELECTOR))&&(this.state.searchAnchorUntil=0)}let e=this.app.workspace.getActiveViewOfType(k.MarkdownView);if(!e||!e.file)return;let t=e.file.path;if(this.state.isRestoringFile()||t!==this.state.lastLoadedFilePath)return;let i=this.exclusions.shouldSkipRecording(e);i&&this.store.dropExcluded(t);let n=M(e);if(!n)return;let s=this.state.lastEphemeralState;this.state.searchAnchorUntil!==this.lastAnchorDeadline&&(this.lastAnchorDeadline=this.state.searchAnchorUntil,this.searchSettledTicks=0),Number.isFinite(this.state.searchAnchorUntil)&&this.state.isSearchAnchored()&&(s&&K(n,s)?++this.searchSettledTicks>=2&&(this.state.searchAnchorUntil=Date.now(),this.searchSettledTicks=0,this.funnel.settled(t,this.state.leafId(e.leaf),ni(e)??n)):this.searchSettledTicks=0);let o;s&&(this.state.isSearchAnchored()||(k.Platform.isMobileApp?!K(n,s)&&this.hasUserIntent()&&(o=n):!lt(n.cursor,s.cursor)&&this.hasUserIntent()&&(o=n)),o&&(i||(this.store.write(this.state.leafId(e.leaf),t,o),this.state.cue.dismissOnMove()))),this.state.lastEphemeralState=n}findOwnerLeaf(e){let t=this.app.workspace.getActiveViewOfType(k.FileView);if(t?.file&&t.containerEl.contains(e))return t.leaf;let i;return this.app.workspace.iterateAllLeaves(n=>{if(i)return;let s=n.view;s instanceof k.FileView&&s.file&&s.containerEl.contains(e)&&(i=n)}),i}flushOnLeave(e,t,i){this.state.isRestoringFile()||this.exclusions.shouldSkipRecording(e)||this.store.write(this.state.leafId(e.leaf),t,i)}installScrollCapture(e){let t=this.app.workspace.containerEl,i=(0,k.debounce)(this.onScrollCapture,this.STORE_INTERVAL,!0);t.addEventListener("scroll",i,{capture:!0,passive:!0}),e(()=>t.removeEventListener("scroll",i,{capture:!0}))}installUserIntentTracker(e){let t=this.app.workspace.containerEl,i=()=>{this.state.lastUserInputAt=Date.now()};t.addEventListener("wheel",i,{capture:!0,passive:!0}),t.addEventListener("pointerdown",i,{capture:!0,passive:!0}),document.addEventListener("keydown",i,{capture:!0}),e(()=>{t.removeEventListener("wheel",i,{capture:!0}),t.removeEventListener("pointerdown",i,{capture:!0}),document.removeEventListener("keydown",i,{capture:!0})})}installTeleportWatcher(e){let t=this.app.workspace.on("editor-selection-change",this.onEditorSelection);e(()=>this.app.workspace.offref(t))}hasUserIntent(){let e=Math.max(this.state.lastTouchAt,this.state.lastUserInputAt);return Date.now()-e{this.state.lastTouchAt=Date.now()},n=()=>{this.state.lastUserInputAt=Date.now()};t.addEventListener("touchstart",i,{capture:!0,passive:!0}),document.addEventListener("keydown",n,{capture:!0}),e(()=>{t.removeEventListener("touchstart",i,{capture:!0}),document.removeEventListener("keydown",n,{capture:!0})})}installSearchAnchor(e){let t=s=>{let o=s.target;return!!o&&typeof o.closest=="function"&&!!o.closest(this.SEARCH_INPUT_SELECTOR)},i=s=>{t(s)&&(this.searchGraceTimer&&(window.clearTimeout(this.searchGraceTimer),this.searchGraceTimer=0),this.state.searchAnchorUntil=Number.POSITIVE_INFINITY)},n=s=>{t(s)&&(this.searchGraceTimer&&window.clearTimeout(this.searchGraceTimer),this.searchGraceTimer=window.setTimeout(()=>{this.searchGraceTimer=0,!Number.isFinite(this.state.searchAnchorUntil)&&(this.state.searchAnchorUntil=Date.now())},this.SEARCH_ANCHOR_GRACE_MS))};document.addEventListener("focusin",i,!0),document.addEventListener("focusout",n,!0),e(()=>{document.removeEventListener("focusin",i,!0),document.removeEventListener("focusout",n,!0),this.searchGraceTimer&&window.clearTimeout(this.searchGraceTimer)})}installFrontmatterWatch(e){let t=n=>{U(this.app,n,this.settings)?.skip&&this.store.dropExcluded(n.path)},i=this.app.metadataCache.on("changed",t);e(()=>{this.app.metadataCache.offref(i)})}};var bi=require("obsidian");var ae=require("obsidian");function yi(r,e,t){let i=n=>{if(!(n.target instanceof HTMLElement)||n.target.closest(".collapse-icon"))return;let s=n.target.closest(".tree-item-self.is-clickable"),o=s?.closest('.workspace-leaf-content[data-type="outline"]');if(!s||!o)return;let a;r.workspace.iterateAllLeaves(m=>{!a&&m.view.getViewType()==="outline"&&m.view.containerEl===o&&(a=m)});let d=a?.view?.file;if(!(d instanceof ae.TFile))return;let c=a?.group,p;if(c)for(let m of r.workspace.getGroupLeaves(c)){let w=m.view;if(w instanceof ae.MarkdownView&&w.file===d){p=w;break}}else{let m=r.workspace.getActiveFileView?.();m instanceof ae.MarkdownView&&m.file===d&&(p=m)}if(!p||!p.file)return;let h=e.state.leafId(p.leaf),f=S(p);f&&e.leave(p.file.path,h,f);let v=s.querySelector(".tree-item-inner")?.textContent?.trim();v&&(e.recordOpen(p.file.path,h,{key:`outline:${v}`}),e.state.searchAnchorUntil=Date.now()+Le)};r.workspace.containerEl.addEventListener("click",i,{capture:!0}),t(()=>r.workspace.containerEl.removeEventListener("click",i,{capture:!0}))}var Qn=5e3,Ve=class{constructor(e,t){this.sinks=new Set;this.moving=!1;this.app=e,this.state=t}subscribe(e){return this.sinks.add(e),()=>{this.sinks.delete(e)}}isRecording(){return!this.moving&&this.app.workspace.layoutReady}isMoving(){return this.moving}recordOpen(e,t,i={}){if(this.isRecording()){if(i.viewType){let n={kind:"view",leafId:t,viewType:i.viewType};i.viewLabel&&(n.label=i.viewLabel),i.viewIcon&&(n.icon=i.viewIcon),i.viewState&&(n.state=i.viewState),this.publish({record:n,cause:"open"});return}e&&this.publish({record:i.key?{kind:"jump",path:e,leafId:t,key:i.key}:{kind:"visit",path:e,leafId:t},cause:i.key?"jump":"open",forced:i.force})}}recordTeleport(e,t,i,n){if(!this.isRecording())return;let s={kind:"teleport",path:e,leafId:t,line:i};n&&(s.st=n),this.publish({record:s,cause:"teleport"})}recordActivation(e){if(!e||!A(this.app,e)||!this.isRecording())return;this.publishLeave({cause:"tab",leaf:e});let t=e.view,i=this.state.leafId(e);if(t instanceof bi.FileView&&Xt(t)){t.file&&this.publish({record:{kind:"visit",path:t.file.path,leafId:i},cause:"tab"});return}if(ct(e)){let c=Yt(t);if(c){this.publish({record:{kind:"visit",path:c,leafId:i},cause:"tab"});return}}let n=t?.getViewType();if(!n||!Me(n)||se(this.app,n)||n==="markdown")return;let s={kind:"view",leafId:i,viewType:n},o=$(t);o&&(s.label=o);let a=G(t);a&&(s.icon=a);let d=O(t);d&&(s.state=d),this.publish({record:s,cause:"tab"})}leave(e,t,i){this.publishLeave({cause:"read",path:e,leafId:t,st:i})}settled(e,t,i){this.publishLeave({cause:"settled",path:e,leafId:t,st:i})}installOutlineCapture(e){yi(this.app,{state:this.state,leave:(t,i,n)=>this.leave(t,i,n),recordOpen:(t,i,n)=>this.recordOpen(t,i,n)},e)}async runBracketed(e){if(this.moving)return;this.moving=!0,this.state.restoreStarted();let t=!1,i=()=>{t||(t=!0,window.clearTimeout(n),this.state.restoreEnded(),this.moving=!1)},n=window.setTimeout(i,Qn);try{await e()}finally{i()}}visit(e){this.publish(e)}landing(e){for(let t of this.sinks)t.onLanded?.(e)}here(e){for(let t of this.sinks)t.onHere?.(e)}publish(e){for(let t of this.sinks)t.onVisit?.(e)}publishLeave(e){for(let t of this.sinks)t.onLeave?.(e)}};var E=require("obsidian");function Ei(r,e,t){let i=Zn(r,e,t);return i===void 0?void 0:i-t}function Zn(r,e,t){if(!r||!e)return;if(e.startsWith("outline:")){let a=e.slice(8).trim(),d=/^(#{1,6})\s+(.+)$/.exec(a),c=d?.[1].length,p=(d?d[2]:a).trim(),h=F(p);return h?er(r,p,h,t,c):void 0}let i=De(e);if(i!==void 0)return r.blocks?.[i]?.position.start.line;let n=e.indexOf("#");if(n===-1)return;let s=e.slice(n+1);if(!s)return;let o=F(bt(s));return o?yt(r.headings??[],a=>F(a.heading)===o,t):void 0}function er(r,e,t,i,n){let s=r.headings??[],o=d=>n===void 0||d.level===n,a=yt(s,d=>o(d)&&d.heading.trim()===e,i);return a!==void 0?a:yt(s,d=>o(d)&&F(d.heading)===t,i)}function bt(r){try{return decodeURIComponent(r)}catch{return r}}function Et(r,e,t){let i=F(e);if(!r||!i)return;let n,s=1/0;for(let o of r.headings??[]){if(F(o.heading)!==i)continue;if(t===void 0)return{line:o.position.start.line,level:o.level,heading:o.heading};let a=Math.abs(o.position.start.line-t);atr(s)):[];for(let s of i)Ne(s);let n=typeof t.index=="number"&&Number.isInteger(t.index)&&t.index>=-1&&t.indextypeof i=="string"&&!!i;if(!t(e.leafId)||typeof e.t!="number")return!1;switch(e.kind){case"view":return t(e.viewType);case"jump":return t(e.path)&&t(e.key);case"teleport":return t(e.path)&&typeof e.line=="number";case"visit":return t(e.path);default:return!1}}function ir(r,e){return JSON.stringify({v:Si,entries:r,index:e})}function xi(r,e,t,i){let n=ir(e,t);if(n===i)return i;try{return window.localStorage.setItem(ki(r),n),n}catch(s){return console.error("Position Restore: can not persist navigation history:",s),i}}var nr=80,rr=1e3,Pi=3e3,Ti=10,_e=class{constructor(e,t,i,n,s){this.savedPosition=s;this.entries=[];this.index=-1;this.lastPersisted="";this.app=e,this.state=i,this.settings=t,this.funnel=n;let o=Fi(e);this.entries=o.entries,this.index=o.index,this.applyStackCap(),this.modes=new I(i)}onVisit(e){e.cause==="tab"&&e.record.kind!=="view"&&!this.settings.navHistoryRecordActivation||e.cause==="teleport"&&this.settings.navHistoryTeleportMinLines<=0||this.pushIfNew(e.record,e.forced)}onLeave(e){if(e.cause==="tab"){this.refreshTopLeafOnActivation(e.leaf);return}this.refreshTop(e.path,e.leafId,e.st,{landing:e.cause==="settled"})}onLanded(e){if(e.kind==="view"){if(!e.state)return;let i=this.entries[this.index];if(!i||i.kind!=="view"||i.viewType!==e.viewType||i.leafId!==e.leafId)return;i.state=e.state,e.label!==void 0&&(i.label=e.label),e.icon!==void 0&&(i.icon=e.icon);return}if(e.kind!=="teleport"||!e.st)return;let t=this.entries[this.index];!t||t.kind!=="teleport"||t.path!==e.path||t.leafId!==e.leafId||t.line!==e.line||(t.st=e.st,this.reviewDeparture(t))}stackCap(){let e=Math.floor(this.settings.navHistoryCap);return Number.isFinite(e)?Math.max(1,e):H.navHistoryCap}applyStackCap(){let e=this.stackCap();if(this.entries.length<=e)return 0;let t=this.entries.length-e;return this.entries.splice(0,t),this.index=this.entries.length===0?-1:Math.max(0,this.index-t),t}knownPaths(){let e=new Set;for(let t of this.entries)t.kind!=="view"&&e.add(t.path);return Array.from(e)}pushIfNew(e,t){let i=this.flushDeparture(),n=this.entries[this.index];if(!t&&n&&this.sameLocation(n,e)){i&&(this.pendingDepartureCheck=void 0);return}this.push(e);let s=this.entries[this.index];this.pendingDepartureCheck=i&&(s.kind==="jump"||s.kind==="teleport")&&s.path===i.visit.path&&s.leafId===i.visit.leafId?{visit:i.visit,owner:i.owner,nav:s}:void 0}sameLocation(e,t){if(e.leafId!==t.leafId)return!1;switch(t.kind){case"view":return e.kind==="view"&&e.viewType===t.viewType;case"jump":return e.kind==="jump"&&e.path===t.path&&(e.key===t.key||e.key.startsWith("outline:")&&t.key.startsWith("outline:")&&F(e.key.slice(8))===F(t.key.slice(8)));case"teleport":return e.kind==="teleport"&&e.path===t.path&&e.line===t.line;case"visit":return e.kind!=="view"&&e.path===t.path}}push(e){this.entries.length=this.index+1,this.entries.push({...e,t:Date.now()}),this.index=this.entries.length-1,this.applyStackCap()}refreshTop(e,t,i,n={}){let s=this.entries[this.index];if(!(!s||s.kind==="view"||s.path!==e||s.leafId!==t)){if(s.kind==="jump"||s.kind==="teleport"){if(n.landing){s.st=i,s.kind==="jump"&&(this.upgradeKeyLine(s,i),this.funnel.landing(s)),this.reviewDeparture(s);return}if(!s.st){s.st=i,s.kind==="jump"&&this.upgradeKeyLine(s,i);return}if(n.traversal){delete s.leftAt;return}s.leftAt=i;return}s.st=i}}leftBehind(e,t){let i=t.scroll,n=e.st?.scroll;return i!==void 0&&n!==void 0&&Math.abs(i-n)>Ti}flushDeparture(){let e=this.entries[this.index];if(!e||e.kind!=="jump"&&e.kind!=="teleport"||!e.leftAt)return;let t=e.leftAt;if(!this.leftBehind(e,t))return;delete e.leftAt;let i=e;return this.push({kind:"visit",path:e.path,leafId:e.leafId,st:t}),{visit:this.entries[this.index],owner:i}}reviewDeparture(e){let t=this.pendingDepartureCheck;if(this.pendingDepartureCheck=void 0,!t||t.nav!==e)return;let i=this.index-1;if(this.entries[this.index]!==t.nav||this.entries[i]!==t.visit||this.entries.indexOf(t.owner)===-1)return;let n=e.st?.scroll,s=t.visit.st?.scroll;n===void 0||s===void 0||Math.abs(n-s)>Ti||(this.entries.splice(i,1),this.index--)}refreshTopLeafOnActivation(e){if(!e||!this.funnel.isRecording()||!A(this.app,e))return;let t=this.entries[this.index];if(!t)return;let i=this.findLeafById(t.leafId)??(t.kind==="view"?this.findLeafShowing(t.viewType):void 0);if(!i||i===e)return;if(t.kind==="view"){if(i.isDeferred||i.view.getViewType()!==t.viewType)return;let s=O(i.view);s&&this.funnel.landing({kind:"view",leafId:t.leafId,viewType:t.viewType,state:s,label:$(i.view),icon:G(i.view)});return}let n=i.view;if(n instanceof E.MarkdownView&&n.file&&n.file.path===t.path){let s=S(n);s&&this.refreshTop(t.path,t.leafId,s)}}upgradeKeyLine(e,t){let i=this.app.vault.getAbstractFileByPath(e.path),n=i instanceof E.TFile?this.app.metadataCache.getFileCache(i):null,s=t.scroll??t.cursor?.from.line;if(e.key.startsWith("outline:")){let c=Et(n,e.key.slice(8),s);if(!c)return;e.key=`outline:${"#".repeat(c.level)} ${c.heading}`,e.keyLine=c.line;return}let o=De(e.key);if(o!==void 0){let c=n?.blocks?.[o]?.position.start.line;c!==void 0&&(e.keyLine=c);return}let a=e.key.indexOf("#");if(a===-1)return;let d=Et(n,bt(e.key.slice(a+1)),s);d&&(e.keyLine=d.line)}canStep(e){return e<0?this.index>0:this.index>=0&&this.indexthis.traverse(e)),this.funnel.here(this.entries[this.index]))}async travelTo(e,t){e.kind!=="teleport"&&(await this.funnel.runBracketed(async()=>{this.refreshTopFromActiveView(),this.funnel.visit({record:{...e},cause:e.kind==="jump"?"jump":"open"}),await this.execute(this.entries[this.index],-1,!0,t)}),this.funnel.here(this.entries[this.index]))}async openFilePlain(e,t,i){if(i){let a=this.app.vault.getAbstractFileByPath(e);if(!(a instanceof E.TFile))return;let d=this.app.workspace.getLeaf(i);await d.openFile(a),this.app.workspace.setActiveLeaf(d,{focus:!0});return}let n=this.findLeafById(t)??this.app.workspace.getMostRecentLeaf()??void 0;if(!n||(this.app.workspace.getActiveViewOfType(E.FileView)?.leaf!==n&&this.app.workspace.setActiveLeaf(n,{focus:!0}),n.isDeferred&&await n.loadIfDeferred(),n.view?.file?.path===e))return;let o=this.app.vault.getAbstractFileByPath(e);o instanceof E.TFile&&await n.openFile(o)}async openViewPlace(e,t){e.kind==="view"&&await this.execute(e,1,!1,t)}async traverse(e){let t=this.app.workspace.getActiveViewOfType(E.FileView);if(!t?.file){let i=this.entries[this.index];if(!i||i.kind==="view"){this.index+=e,await this.execute(this.entries[this.index],e);return}let n=this.startLeaf();if(!n)return;if(this.app.workspace.setActiveLeaf(n,{focus:!0}),t=this.app.workspace.getActiveViewOfType(E.FileView),!t?.file){await this.execute(this.entries[this.index],e);return}}this.refreshTopFromActiveView({traversal:!0}),this.index+=e,await this.execute(this.entries[this.index],e)}refreshTopFromActiveView(e={}){let t=this.entries[this.index];if(!t||t.kind==="view")return;let i=this.app.workspace.getActiveViewOfType(E.FileView),n=i?.file&&t.leafId===this.state.leafId(i.leaf)?i:this.findLeafById(t.leafId)?.view;if(n instanceof E.MarkdownView&&n.file?.path===t.path){let s=S(n);s&&this.refreshTop(t.path,t.leafId,s,e)}}async execute(e,t,i=!1,n){if(this.armLandingMark(e),n){let h=this.app.workspace.getLeaf(n);if(e.kind==="view"){await h.setViewState({type:e.viewType,state:e.state??{},active:!0});return}await this.openInLeaf(h,e);return}let o=this.app.workspace.getActiveViewOfType(E.FileView)?.leaf??this.app.workspace.getMostRecentLeaf()??void 0,a=this.findLeafById(e.leafId);if(e.kind==="view"){let h=a??this.findLeafShowing(e.viewType);if(!h){await this.showViewInNewTab(e.viewType,e.state);return}if(h!==o&&this.app.workspace.setActiveLeaf(h,{focus:!0}),h.isDeferred&&await h.loadIfDeferred(),h.view?.getViewType?.()===e.viewType){await this.relandViewState(h,e);return}if(h===o&&await this.delegateNative(t,h,void 0,e.viewType))return;await h.setViewState({type:e.viewType,state:e.state??{},active:!0});return}if(a&&a!==o){await this.openInLeaf(a,e);return}let d=a??o;if(!d)return;if(a||(e.leafId=this.state.leafId(d)),d.isDeferred&&await d.loadIfDeferred(),d.view?.file?.path===e.path){let h=d.view;h instanceof E.MarkdownView&&await this.applyLanding(h,e);return}let p=this.landingFor(e);await this.delegateNative(t,d,e.path,void 0,p)||i&&await this.delegateNative(t===1?-1:1,d,e.path,void 0,p)||await this.openInLeaf(d,e)}async relandViewState(e,t){if(!t.state)return;let i=O(e.view);i&&JSON.stringify(i)===JSON.stringify(t.state)||await e.setViewState({type:t.viewType,state:t.state,active:!0})}async applyLanding(e,t){let i=this.appliedLanding(t);if(!i)return;let n=()=>e.file?.path===t.path;this.state.cueSuppressUntil=Date.now()+Pi,await this.modes.historyJumpApply(e,i,n,this.resolveAnchorShift(t))}armLandingMark(e){if(e.kind==="view")return;let t=e.kind==="jump"?{line:wt(e),center:!0}:e.kind==="teleport"?{line:e.line,center:!0}:{line:e.st?.scroll??e.st?.cursor?.from.line,center:!1},i=t.line;if(i===void 0)return;let n=this.resolveAnchorShift(e);this.state.pendingLineFlash={path:e.path,line:Math.max(0,i+(n??0)),at:Date.now(),sourceOnly:e.kind!=="jump"||void 0,center:t.center}}appliedLanding(e){return this.landingOf(e)??this.savedPosition?.(e.path)}landingOf(e){if(e.st){let t=e.kind==="jump"?wt(e):void 0;return t===void 0?e.st:xe(e.st,t)}if(e.kind==="teleport"&&Number.isFinite(e.line))return{scroll:Math.max(0,e.line)}}landingFor(e){let t=this.landingOf(e);if(!t)return;let i=this.resolveAnchorShift(e);return i?oe(t,i):t}armHistoryNav(e,t){this.state.pendingHistoryNav=!0,this.state.pendingHistoryNavState=e,this.state.pendingHistoryNavPath=t,this.state.cueSuppressUntil=Date.now()+Pi,window.clearTimeout(this.state.pendingHistoryNavTimeout),this.state.pendingHistoryNavTimeout=window.setTimeout(()=>{this.state.pendingHistoryNav=!1,this.state.pendingHistoryNavState=void 0,this.state.pendingHistoryNavPath=void 0},rr)}async openInLeaf(e,t){this.app.workspace.getActiveViewOfType(E.FileView)?.leaf!==e&&this.app.workspace.setActiveLeaf(e,{focus:!0}),e.isDeferred&&await e.loadIfDeferred();let i=e.view;if(i?.file?.path===t.path){i instanceof E.MarkdownView&&await this.applyLanding(i,t);return}let s=this.app.vault.getAbstractFileByPath(t.path);s instanceof E.TFile&&(this.armHistoryNav(this.landingFor(t),t.path),await e.openFile(s))}async delegateNative(e,t,i,n,s){let o=t.history,a=e<0?o?.backHistory:o?.forwardHistory,d=a?.[a.length-1];return(i!==void 0?d?.state?.state?.file===i:d?.state?.type===n)?(i!==void 0&&this.armHistoryNav(s,i),this.app.commands.executeCommandById(e<0?"app:go-back":"app:go-forward"),await X(nr),i!==void 0?t.view?.file?.path===i:t.view?.getViewType?.()===n):!1}findLeafById(e){if(!e)return;let t;return this.app.workspace.iterateAllLeaves(i=>{!t&&this.state.leafId(i)===e&&(t=i)}),t}findLeafShowing(e){if(!se(this.app,e))return this.app.workspace.getLeavesOfType(e).find(t=>A(this.app,t))}async showViewInNewTab(e,t){let i=this.app.workspace.getLeaf("tab"),n=i;try{await n.setViewState({type:e,state:t??{},active:!0})}catch{n.detach();return}let s=i.view?.getViewType?.();(se(this.app,e)||s!==e)&&n.detach()}resolveAnchorShift(e){if(e.kind!=="jump"||!e.key||typeof e.keyLine!="number")return;let t=this.app.vault.getAbstractFileByPath(e.path);if(t instanceof E.TFile)return Ei(this.app.metadataCache.getFileCache(t),e.key,e.keyLine)}renameFile(e,t){for(let i of this.entries)i.kind!=="view"&&i.path===e&&(i.path=t)}deleteFile(e){let t=[],i=0;for(let n=0;n0?Math.ceil(i/n):0}return Math.max(0,Math.floor(lr(r,t)/2)-1)}var sr=12;function or(r,e){let t=r.querySelector(".view-header");if(!t)return 0;let i=t.getBoundingClientRect();if(i.height<=0)return 0;let n=i.bottom-e.getBoundingClientRect().top;return n<=0?0:Math.round(n)+sr}function Li(r){let e=parseFloat(r);return Number.isFinite(e)?e:0}function ar(r){let e=getComputedStyle(r),t=Li(e.lineHeight);if(t>0)return t;let i=Li(e.fontSize);return i>0?i*1.6:0}function lr(r,e){let t=e.getBoundingClientRect();if(t.height<=0)return 0;let i=r.editor.cm;if(!i?.state?.doc)return 0;let n=t.left+t.width/2,s=Ri(i,n,t.top+2),o=Ri(i,n,t.bottom-2);return s!==null&&o!==null&&o>=s?o-s+1:i.defaultLineHeight>0?Math.round(t.height/i.defaultLineHeight):0}function Ri(r,e,t){try{let i=r.posAtCoords({x:e,y:t});return i===null?null:r.state.doc.lineAt(i).number-1}catch{return null}}var Mi=3;function Ni(r){return`position-restore:nav-recent:${r.appId??r.vault.getName()}`}function Di(r){try{let e=window.localStorage.getItem(Ni(r));if(!e)return{entries:[],pinned:[]};let t=JSON.parse(e);if(t.v!==Mi)return{entries:[],pinned:[]};let i=Array.isArray(t.places)?t.places.filter(n=>cr(n)):[];for(let n of i)Ne(n);return{entries:i,pinned:dr(t.pinned)}}catch(e){return console.error("Position Restore: can not read the recent files list:",e),{entries:[],pinned:[]}}}function dr(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"&&!!e):[]}function cr(r){if(!r||typeof r!="object")return!1;let e=r.kind;return e!=="visit"&&e!=="view"?!1:pr(r)}function pr(r){let e=r,t=i=>typeof i=="string"&&!!i;return!t(e.leafId)||typeof e.t!="number"?!1:e.kind==="view"?t(e.viewType):t(e.path)}function hr(r,e){return JSON.stringify({v:Mi,places:r,pinned:e})}function Ci(r,e,t,i){let n=hr(e,t);if(n===i)return i;try{return window.localStorage.setItem(Ni(r),n),n}catch(s){return console.error("Position Restore: can not persist the recent files list:",s),i}}var ur={openFile:async()=>{},openJump:async()=>{},openView:async()=>{}};function Oi(r){let e=r.containerEl.getBoundingClientRect();return e.width>0&&e.height>0}var fr=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","avif","jfif","ico","tif","tiff","heic","heif"]);function mr(r,e){let t=e.lastIndexOf(".");if(t<0||t{let s=n.replace(/\/+$/,"");return!!s&&(e===s||e.startsWith(`${s}/`))})?"folder":this.settings.recentFilesExcludeImages&&mr(this.app,e)?"image":this.excludedByFrontmatter(e)?"property":void 0}excludedByFrontmatter(e){let t=this.settings.recentFilesExcludeProperties??[];return t.length===0?!1:ue(It(this.app,e),t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}changed(){for(let e of this.listeners)e()}remember(e){if(e.kind==="teleport")return;let t=e.kind==="jump"?{kind:"visit",path:e.path,leafId:e.leafId}:e;if(t.kind!=="view"&&!this.recordable(t.path))return;let i=this.indexOf(y(t)),n=i>=0?this.entries[i]:void 0;i>=0&&this.entries.splice(i,1),this.entries.push(gr(t,n)),this.index=this.entries.length-1,this.trim(),this.changed()}settle(e){if(e.kind!=="view"||!e.state)return;let t=this.indexOf(y(e));if(t<0)return;let i=this.entries[t];i.kind==="view"&&(i.state=e.state,e.label!==void 0&&(i.label=e.label),e.icon!==void 0&&(i.icon=e.icon),i.t=Date.now(),this.changed())}markCurrent(e){let t=this.indexFor(e);t!==this.index&&(this.index=t,this.changed())}pin(e){!e||this.pinned.includes(e)||(this.pinned.push(e),this.afterPinChange())}unpin(e){let t=this.pinned.indexOf(e);if(t<0)return{dropped:!1};this.pinned.splice(t,1);let i=this.entries.find(s=>y(s)===e),n=i&&i.kind!=="view"?this.exclusionReason(i.path):void 0;if(n){let s=i;return this.dropRow(e),this.afterPinChange(),{dropped:!0,reason:n,place:s}}return this.afterPinChange(),{dropped:!1}}wouldUnpinDrop(e){let t=this.entries.find(i=>y(i)===e);if(!(!t||t.kind==="view"))return this.exclusionReason(t.path)}restorePinned(e){let t=y(e);this.entries.some(i=>y(i)===t)||this.entries.push(e),this.pinned.includes(t)||this.pinned.push(t),this.afterPinChange()}movePinned(e,t){let i=this.pinned.indexOf(e);if(i<0)return;let n=Math.min(Math.max(i+t,0),this.pinned.length-1);n!==i&&(this.pinned.splice(i,1),this.pinned.splice(n,0,e),this.afterPinChange())}isPinned(e){return this.pinned.includes(e)}afterPinChange(){this.persist(),this.changed()}renameFile(e,t){let i=!1;for(let s of this.entries)s.kind==="view"||s.path!==e||(s.path=t,i=!0);let n=this.pinned.indexOf(e);n>=0&&(this.pinned[n]=t,i=!0),i&&this.changed()}deleteFile(e){this.dropRow(e)}forget(e){this.dropRow(e)}clear(){let e=new Set(this.pinned),t=this.entries.filter(i=>e.has(y(i)));t.length!==this.entries.length&&(this.keep(t),this.persist(),this.changed())}dropRow(e){let t=this.entries[this.index],i=this.entries.filter(o=>y(o)!==e),n=this.pinned.indexOf(e),s=n>=0;s&&this.pinned.splice(n,1),!(i.length===this.entries.length&&!s)&&(this.entries=i,this.index=t&&i.includes(t)?i.indexOf(t):-1,this.changed())}pruneExcluded(){let e=this.entries[this.index],t=new Set(this.pinned),i=this.entries.filter(s=>t.has(y(s))||s.kind==="view"||this.recordable(s.path)),n=this.entries.length-i.length;return n===0?0:(this.entries=i,this.index=e&&i.includes(e)?i.indexOf(e):-1,this.changed(),n)}knownPaths(){let e=new Set;for(let t of this.entries)t.kind!=="view"&&e.add(t.path);return Array.from(e)}async travel(e,t){let i=this.entries[e];if(i){if(i.kind==="view"){await this.open.openView(i,t);return}await this.open.openFile(i.path,i.leafId,t)}}async travelToHeading(e,t,i,n,s){let o=Math.max(0,i),a=o>0?Math.max(1,o-Ai(this.alignView(e))):0,d={kind:"jump",path:e,key:`outline:${t}`,keyLine:o,st:xe({scroll:a},o),leafId:n,t:Date.now()};await this.open.openJump(d,s)}alignView(e){let t=this.app.workspace;if(!t||typeof t.iterateAllLeaves!="function")return null;let i=null,n=null,s=null,o=null;t.iterateAllLeaves(d=>{let c=d.view;if(!(c instanceof St.MarkdownView)||!c.file)return;let p=Oi(c);c.file.path===e&&(p?i??=c:n??=c),p&&(s??=c),o??=c});let a=typeof t.getActiveViewOfType=="function"?t.getActiveViewOfType(St.MarkdownView):null;return i??(a&&Oi(a)?a:null)??s??n??a??o}applyCap(){let e=this.trim();return e>0&&this.changed(),e}persist(){this.lastPersisted=Ci(this.app,this.entries,this.pinned,this.lastPersisted)}indexOf(e){for(let t=0;t=0)return t}return e.kind==="view"?-1:this.indexOf(e.path)}trim(){let e=this.entries.length,t=new Set(this.pinned),i=0;for(let a of this.entries)t.has(y(a))||i++;let n=i-this.cap();if(n<=0)return 0;let s=[],o=0;for(let a=0;a0?e.slice(0,t):e}function Hi(r){if(!r)return;let e=r.lastIndexOf(".");if(e<=r.lastIndexOf("/")+1)return"FILE";let t=r.slice(e+1).toLowerCase();return t==="md"?void 0:t.toUpperCase()}function Tt(r){if(r==="")return;let e=r.lastIndexOf("/");return e===-1?"":r.slice(0,e)}function Vi(r,e){let t=Tt(r);return t===void 0?"":e!==We(r)?r:t===""?"/":`${t}/`}function _i(r){let e=new Set,t=new Set;for(let i of r)e.has(i)&&t.add(i),e.add(i);return t}function Lt(r){return r.label?r.label:r.viewType==="graph"?l("recentFiles.graphView"):r.viewType}function Bi(r,e,t){if(r.kind==="view")return{name:Lt(r)};let i=e?.(r.path);return{name:t?.(r.path)??We(r.path),lineIndex:i?.cursor?.from.line??i?.scroll}}var Ft=6e4,xt=60*Ft,le=24*xt,kt=7*le,vr=30*le,Ii=365*le;function wr(r,e){let t=Math.max(0,e-r);return tthis.app.vault.getAbstractFileByPath(e)instanceof je.TFile;this.titleOf=e=>{if(!(!e||!this.opts.titleProperty?.()))return this.metaFor(e).title};this.metaRef=e.metadataCache?.on?.("changed",i=>{let n=this.meta.get(i.path)?.title;this.meta.delete(i.path),this.opts.titleProperty?.()&&this.titleOf(i.path)!==n&&this.opts.onTitleChange?.()})}dispose(){this.metaRef&&this.app.metadataCache?.offref?.(this.metaRef),this.metaRef=void 0}describe(e){let t=this.descCache.get(e);return t||(t=Bi(this.opts.entries()[e],this.opts.savedPosition,this.titleOf),this.descCache.set(e,t)),t}clearDescribeCache(){this.descCache.clear()}metaFor(e){let t=this.opts.titleProperty?.()??"";t!==this.titledFor&&(this.titledFor=t,this.meta.clear());let i=this.meta.get(e);if(i)return i;let n=yr(this.app,e,t);return n?(this.meta.set(e,n),n):br()}headingsFor(e){let t=this.metaFor(e).headings;return t&&t.length?t:this.textHeadings(e)}textHeadings(e){return this.ensureText(e,!0),this.heads.get(e)?.headings}ensureText(e,t){let i=e?this.app.vault.getAbstractFileByPath(e):null;if(!(i instanceof je.TFile))return;let n=i.stat.mtime;return this.heads.get(e)?.mtime!==n&&t&&!this.reading.has(e)&&(this.reading.add(e),this.readText(e,i,n)),n}async readText(e,t,i){let n=[];try{n=Fe((await this.app.vault.cachedRead(t)).split(` +`))}catch{}this.reading.delete(e),this.heads.set(e,{mtime:i,headings:n}),this.opts.onLateRead?.()}otherNamesFor(e,t){if(!e)return{aliases:[]};let i=this.metaFor(e),n=t?i.aliases.filter(s=>s!==t):i.aliases;return{frontTitle:i.frontTitle===t?void 0:i.frontTitle,aliases:n}}};function ji(r,e){if(!e||!r)return;let t=s=>{let o=Array.isArray(s)?s[0]:s;return typeof o!="string"?void 0:o.trim()||void 0},i=t(r[e]);if(i)return i;let n=e.toLowerCase();for(let s of Object.keys(r))if(s.toLowerCase()===n)return t(r[s])}function yr(r,e,t){let i=e?r.vault.getAbstractFileByPath(e):null,n=i instanceof je.TFile?r.metadataCache?.getFileCache?.(i):null;if(!n)return null;let s=n.headings?.map(p=>({heading:p.heading,level:p.level,line:p.position.start.line})),o=n.frontmatter,a=[],d=new Set,c=p=>{if(typeof p=="string"){let h=p.trim();h&&!d.has(h)&&(d.add(h),a.push(h))}else if(Array.isArray(p))for(let h of p)c(h)};return c(o?.aliases),{headings:s,aliases:a,frontTitle:ji(o,"title"),title:ji(o,t)}}function br(){return{headings:void 0,aliases:[]}}var V=require("obsidian");var Er="";function Ui(r,e,t=()=>!0,i){let n=new Map,s=(a,d)=>{let c=y(a),p={path:a.kind==="view"?Er:a.path,key:c,rep:d,current:d===e};return n.set(c,p),p};for(let a=r.length-1;a>=0;a--){if(!t(a))continue;let d=r[a];n.has(y(d))||s(d,a)}let o=Array.from(n.values());if(i){let a=new Map(i.map((d,c)=>[d,c]));o.sort((d,c)=>(a.get(d.key)??-1)-(a.get(c.key)??-1))}return o}function Ki(r){return r.toLowerCase().split(/\s+/).filter(Boolean)}function Sr(r,e,t,i){let n=Ki(e);if(n.length===0)return!0;let s=`${Pr(r)} ${t??""} ${i??""}`.toLowerCase();return n.every(o=>s.includes(o))}function kr(r,e){let t=r.entries[e];return t.kind==="view"||r.noteExists(t.path)}function Fr(r,e){let t=r.entries[e],i=r.describe(e),n=t.kind==="view"?void 0:r.otherNames(t.path,i.name),s=n?[n.frontTitle??"",...n.aliases]:[];return`${i.name??""} ${s.join(" ")}`}function xr(r,e){if(!r.outlineSearch())return;let t=r.entries[e];if(t.kind==="view")return;let i=r.headingsFor(t.path);return i?.length?i.map(n=>n.heading).join(` +`):void 0}function $i(r,e,t){return kr(r,e)?t?Sr(r.entries[e],t,Fr(r,e),xr(r,e)):!0:!1}function Gi(r,e,t){let i=Ki(e);if(!r?.length||!i.length||t!==void 0&&t<=0)return[];let n=[],s=[];for(let a of r){let d=a.heading.toLowerCase();d&&(i.every(c=>d.includes(c))?s.push(a):d.includes(i[0])&&n.push(a))}let o=s.length?s:n;return t===void 0?o:o.slice(0,t)}function Pr(r){return r.kind==="view"?`${r.viewType} ${Lt(r)}`:[Pt(r.path),r.path].filter(Boolean).join(" ")}var Ke=class{constructor(e,t){this.list=e;this.quiet=t;this.tips=new WeakMap;this.held=!1;this.onOver=e=>{if(e.pointerType==="touch"){this.forget();return}if(this.quiet?.()){this.forget();return}let t=this.subject(e.target);if(t===this.anchor||(this.forget(),!t))return;let i=this.tips.get(t);i&&(this.anchor=t,this.timer=this.win.setTimeout(()=>{this.timer=void 0,this.anchor===t&&!this.quiet?.()&&this.show(t,i)},1e3))};this.onOut=e=>{if(this.held)return;let t=e.relatedTarget;this.anchor&&t&&this.anchor.contains(t)||this.forget()};this.onLeave=()=>{this.forget()};this.doc=e.ownerDocument,this.win=this.doc.defaultView??window,this.list.addEventListener("pointerover",this.onOver),this.list.addEventListener("pointerout",this.onOut),this.list.addEventListener("pointerdown",this.onLeave),this.list.addEventListener("scroll",this.onLeave,{passive:!0})}attach(e,t){this.tips.set(e,t)}retract(){this.forget()}speak(e){if(this.quiet?.())return;let t=this.subject(e);if(!t)return;let i=this.tips.get(t);i&&(this.forget(),this.anchor=t,this.held=!0,this.show(t,i))}reset(){this.forget()}destroy(){this.forget(),this.list.removeEventListener("pointerover",this.onOver),this.list.removeEventListener("pointerout",this.onOut),this.list.removeEventListener("pointerdown",this.onLeave),this.list.removeEventListener("scroll",this.onLeave)}subject(e){let t=e&&e.nodeType===1?e:e?.parentElement??null;for(;t&&t!==this.list;){if(this.tips.has(t))return t;t=t.parentElement}}forget(){this.clearTimer(),this.hide(),this.anchor=void 0,this.held=!1}clearTimer(){this.timer!==void 0&&(this.win.clearTimeout(this.timer),this.timer=void 0)}hide(){this.el?.remove(),this.el=void 0}show(e,t){let i=this.doc.body.createDiv({cls:"position-restore-nav-tip",attr:{"aria-hidden":"true"}});t.path&&this.pathLine(i,t.path),t.frontTitle&&i.createDiv({cls:"nav-tip-text",text:t.frontTitle}),t.text&&i.createDiv({cls:"nav-tip-text",text:t.text}),t.trail&&i.createDiv({cls:"nav-tip-trail",text:t.trail}),this.el=i,this.place(i,e)}pathLine(e,t){let i=e.createDiv({cls:"nav-tip-path"}),n=t.split("/");n.forEach((s,o)=>{o>0&&i.createSpan({cls:"nav-tip-sep",text:"/"}),s&&i.createSpan({cls:o===n.length-1?"nav-tip-name":"nav-tip-seg",text:s})})}place(e,t){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s={w:this.win.innerWidth,h:this.win.innerHeight},o=i.bottom+6;o+n.height>s.h&&(o=Math.max(6,i.top-6-n.height));let a=i.left;a+n.width>s.w&&(a=s.w-n.width-6),e.setCssStyles({top:`${Math.round(o)}px`,left:`${Math.round(Math.max(6,a))}px`})}};var $e=class{constructor(e,t){this.el=e;this.opts=t;this.claimed=!1;this.onDown=e=>{if(this.cancel(),this.claimed=!1,e.button!==0)return;this.at={x:e.clientX,y:e.clientY};let t=e.target instanceof Node?e.target:this.el;this.timer=this.win.setTimeout(()=>{this.timer=void 0,this.at=void 0,this.opts.onArm(t)},this.opts.ms)};this.onMove=e=>{this.at&&(Math.abs(e.clientX-this.at.x)>this.opts.slop||Math.abs(e.clientY-this.at.y)>this.opts.slop)&&this.cancel()};this.onEnd=()=>{this.cancel()};this.win=e.ownerDocument.defaultView??window,this.el.addEventListener("pointerdown",this.onDown),this.el.addEventListener("pointermove",this.onMove),this.el.addEventListener("pointerup",this.onEnd),this.el.addEventListener("pointercancel",this.onEnd)}destroy(){this.cancel(),this.el.removeEventListener("pointerdown",this.onDown),this.el.removeEventListener("pointermove",this.onMove),this.el.removeEventListener("pointerup",this.onEnd),this.el.removeEventListener("pointercancel",this.onEnd)}markArmed(){this.claimed=!0}consumeClick(){let e=this.claimed;return this.claimed=!1,e}release(){this.cancel(),this.claimed=!1}cancel(){this.timer!==void 0&&this.win.clearTimeout(this.timer),this.timer=void 0,this.at=void 0}};var Rt="position-restore-nav-row";function Dr(r,e,t,i){if(!(r>=t&&r+e<=t+i))return Math.round(r-(t+(i-e)/2))}function Cr(r){return r.join(" \u203A ")}var Ge=class{constructor(e){this.opts=e;this.refs=[];this.groups=[];this.pinnedCount=0;this.menuTapCloses=!1;this.onLift=e=>{if(e.type==="pointercancel"){this.disarm(),this.unmark();return}this.armed&&!(e.target instanceof Node&&this.armed.el.contains(e.target))&&this.disarm(),this.releaseMark()};this.tip=new Ke(e.list,e.tipsQuiet),e.touch&&(this.press=new $e(e.list,{ms:500,slop:10,onArm:t=>this.armAt(t)}),this.opts.list.addEventListener("click",()=>this.disarm()),this.opts.list.addEventListener("scroll",()=>{this.disarm(),this.unmark()},{passive:!0})),this.opts.list.addEventListener("pointermove",t=>this.hoverAt(t)),this.opts.list.addEventListener("pointerover",t=>this.hoverAt(t)),this.opts.list.addEventListener("pointerleave",t=>{this.hovered=void 0,this.pointerAt={x:t.clientX,y:t.clientY},this.opts.onHoverEnd?.()}),this.doc=this.opts.list.ownerDocument,this.doc.addEventListener("pointerup",this.onLift),this.doc.addEventListener("pointercancel",this.onLift)}activeRep(e){return e.hit?-1:this.groups[e.group]?.rep??-1}rowRep(e){return this.groups[e.group]?.rep??-1}pullPinnedToTop(){let e=new Map(this.groups.map(s=>[s.key,s])),t=this.opts.pinned(),i=[];for(let s of t){let o=e.get(s);o&&i.push(o)}if(this.pinnedCount=i.length,i.length===0)return;let n=new Set(i);this.groups=[...i,...this.groups.filter(s=>!n.has(s))]}endsPinnedBlock(e){return this.pinnedCount>0&&e===this.pinnedCount-1&&this.groups.length>this.pinnedCount}render(){this.disarm(),this.unmark(),this.tip.reset();let e=this.selected,t=e?.group,i=e?.hit?.heading;this.opts.list.empty(),this.opts.clearDescribeCache(),this.refs=[],this.groups=[],this.selected=void 0,this.hovered=void 0;let n=this.opts.filter().trim(),s=this.facts();this.groups=Ui(this.opts.entries,this.opts.currentIndex,a=>$i(s,a,n),this.opts.order()),this.pullPinnedToTop();let o=_i(this.groups.map(a=>this.printedName(a)));if(this.groups.forEach((a,d)=>{this.fileRow(a,d,o);let{hits:c,hidden:p}=this.hitsFor(a,n);for(let h of c)this.headingRow(h,d);p>0&&this.hiddenHits(p),this.endsPinnedBlock(d)&&this.opts.list.createDiv({cls:"position-restore-nav-pinned-sep"})}),this.refs.length||this.opts.list.createDiv({cls:"position-restore-nav-empty",text:this.emptyText(n)}),t!==void 0){let a=this.refs.find(c=>c.group===t&&(i===void 0?!c.hit:c.hit?.heading===i)),d=this.refs.find(c=>c.group===t&&!c.hit);a?this.choose(a):d?this.choose(d):this.clearSelection()}}emptyText(e){return e?l("recentFiles.noMatch"):l("recentFiles.empty")}orderedKeys(){return this.groups.map(e=>e.key)}printedName(e){return this.opts.describe(e.rep)?.name??We(e.path)}facts(){return{entries:this.opts.entries,describe:e=>this.opts.describe(e),otherNames:(e,t)=>this.opts.otherNames(e,t),headingsFor:e=>this.opts.headingsFor(e),noteExists:e=>this.opts.noteExists(e),outlineSearch:()=>this.opts.outlineSearch()}}hitsFor(e,t){if(!t||!e.path||!this.opts.outlineSearch())return{hits:[],hidden:0};let i=Gi(this.opts.headingsFor(e.path),t),n=i.slice(0,5),s=this.opts.entries[e.rep]?.leafId??"";return{hits:n.map(o=>({path:e.path,heading:o.heading,line:o.line,leafId:s})),hidden:i.length-n.length}}fileRow(e,t,i){let n=this.opts.entries[e.rep],s=this.printedName(e),o=this.opts.list.createDiv({cls:`${Rt} is-file`});e.current&&o.addClass("is-current"),tthis.onClick(d,g)),o.addEventListener("pointerdown",g=>this.onPress(d,g)),o.addEventListener("contextmenu",g=>this.onContextMenu(g,d)),this.refs.push(d);let c=o.createDiv({cls:"nav-row-file"}),p=c.createDiv({cls:"nav-row-head"});p.createSpan({text:s,cls:"nav-row-name"});let h=Hi(e.path);if(h)p.createSpan({text:h,cls:"nav-file-tag"});else if(n?.kind==="view"){let g=l("recentFiles.viewBadge");if(n.icon){let P=p.createSpan({cls:"nav-row-view-icon"});(0,V.setIcon)(P,n.icon),P.setAttr("aria-label",g)}else p.createSpan({text:g,cls:"nav-file-tag"})}let v=(e.path?Tt(e.path):void 0)!==void 0&&(a!=="smart"||i.has(s));if(v&&c.createSpan({text:Vi(e.path,s),cls:"nav-row-path"}),this.opts.rowTime()&&n){let g=o.createSpan({text:Wi(n.t,Date.now()),cls:"nav-row-time"});o.addClass("is-timed"),this.tip.attach(g,{text:new Date(n.t).toLocaleString()})}let m=e.path?this.opts.otherNames(e.path,s):void 0,w={};e.path&&!v&&(w.path=e.path),m?.frontTitle&&(w.frontTitle=`${l("recentFiles.title")} ${m.frontTitle}`),m?.aliases.length&&(w.text=`${l("recentFiles.aliases")} ${m.aliases.join(" \xB7 ")}`),(w.path||w.text||w.frontTitle)&&this.tip.attach(o,w);let b=this.actionStrip(o);this.opts.touch&&this.menuControl(b,d),this.forgetControl(b,l("recentFiles.forget"),()=>this.opts.onForget(e.key))}headingRow(e,t){let i=this.opts.list.createDiv({cls:`${Rt} is-heading`});i.setAttr("role","option"),i.setAttr("aria-selected","false");let n={el:i,group:t,hit:e};i.setAttr("id",`${this.opts.listId}-row-g${t}-h${this.refs.length}`),i.addEventListener("click",a=>this.onClick(n,a)),i.addEventListener("pointerdown",a=>this.onPress(n,a)),i.addEventListener("contextmenu",a=>this.onContextMenu(a,n)),this.refs.push(n),i.createDiv({cls:"nav-row-file"}).createSpan({text:e.heading,cls:"nav-row-heading"});let o=J(this.opts.headingsFor(e.path),e.line);o.length>1&&this.tip.attach(i,{trail:Cr(o)}),this.opts.touch&&this.menuControl(this.actionStrip(i),n)}hiddenHits(e){this.opts.list.createDiv({cls:"position-restore-nav-more",text:l("recentFiles.moreHits",e)})}forgetControl(e,t,i){let n=e.createDiv({cls:"nav-row-forget clickable-icon"});n.setAttr("role","button"),n.setAttr("tabindex","-1"),n.setAttr("aria-label",t),(0,V.setIcon)(n,"x"),n.addEventListener("pointerdown",s=>{s.stopPropagation(),this.press?.release()}),n.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),!this.press?.consumeClick()&&i()})}onContextMenu(e,t){if(e.preventDefault(),this.opts.touch){this.arm(t,e.target instanceof Node?e.target:t.el);return}let i=this.rowRep(t);i>=0&&this.opts.onContextRow(i,{x:e.clientX,y:e.clientY},!t.hit,t.hit)}armAt(e){let t=this.rowAt(e);t&&this.arm(t,e)}arm(e,t){this.armed&&this.armed!==e&&this.disarm(),this.armed=e,e.el.addClass("is-armed"),this.markPressed(e.el),this.holdMark(),this.press?.markArmed(),this.tip.speak(t)}disarm(){this.armed&&(this.armed.el.removeClass("is-armed"),this.armed=void 0,this.tip.retract(),this.unmark())}markPressed(e){this.marked&&this.marked!==e&&this.marked.removeClass("is-pressed"),this.marked=e,e.addClass("is-pressed"),this.markFade!==void 0&&window.clearTimeout(this.markFade),this.markFade=window.setTimeout(()=>this.unmark(),820)}holdMark(){this.markFade!==void 0&&(window.clearTimeout(this.markFade),this.markFade=void 0)}unmark(){this.holdMark(),this.marked?.removeClass("is-pressed"),this.marked=void 0}releaseMark(){if(this.markFade!==void 0&&window.clearTimeout(this.markFade),this.armed){this.markFade=void 0;return}this.markFade=window.setTimeout(()=>this.unmark(),320)}actionStrip(e){let t=e.createDiv({cls:"nav-row-actions"});return t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),this.press?.consumeClick()}),t}menuControl(e,t){let i=e.createDiv({cls:"nav-row-menu clickable-icon"});i.setAttr("role","button"),i.setAttr("tabindex","-1"),i.setAttr("aria-label",l("recentFiles.rowMenu")),(0,V.setIcon)(i,"more-vertical"),i.addEventListener("pointerdown",n=>{n.stopPropagation(),this.press?.release(),this.menuTapCloses=this.opts.takeMenuBack()}),i.addEventListener("click",n=>{if(n.preventDefault(),n.stopPropagation(),this.press?.consumeClick())return;if(this.menuTapCloses){this.menuTapCloses=!1;return}let s=this.rowRep(t);if(s<0)return;let o=i.getBoundingClientRect();this.opts.onContextRow(s,{x:o.left+o.width/2,y:o.bottom},!t.hit,t.hit)})}hoverAt(e){if(e.pointerType==="touch")return;let t={x:e.clientX,y:e.clientY},i=this.pointerAt!==void 0&&(this.pointerAt.x!==t.x||this.pointerAt.y!==t.y);if(this.pointerAt=t,!i)return;let n=this.rowAt(e.target);if(!n||n===this.hovered)return;this.hovered=n;let s=this.rowRep(n);s>=0&&this.opts.onHoverRow(s,e,n.el,!n.hit,n.hit)}rowAt(e){let t=e instanceof HTMLElement?e.closest(`.${Rt}`):null;return t?this.refs.find(i=>i.el===t):void 0}collapse(){this.clearSelection()}onClick(e,t){if(t.preventDefault(),this.press?.consumeClick()){this.pressed=void 0,this.pressedAt=void 0,t.stopPropagation();return}let i=V.Keymap.isModEvent(t)||void 0,n=this.pressed;this.pressed=void 0,this.pressedAt=void 0;let s=this.refs.includes(e)?e:n===void 0?void 0:this.findRowByKey(n);s&&this.goTo(s,i)}onUnansweredClick(e){if(e.defaultPrevented)return;let t=this.stillAtPress(e),i=this.pressed;if(this.pressed=void 0,this.pressedAt=void 0,i===void 0||!t)return;let n=this.findRowByKey(i);n&&this.goTo(n,void 0)}stillAtPress(e){return!this.pressedAt||!(e instanceof MouseEvent)?!1:Math.abs(e.clientX-this.pressedAt.x)<=10&&Math.abs(e.clientY-this.pressedAt.y)<=10}onPress(e,t){if(t.button===1){t.preventDefault(),this.goTo(e,V.Keymap.isModEvent(t)||void 0);return}if(t.button!==0)return;let i=this.activeRep(e);this.pressed=i<0?void 0:this.opts.keyOf(i),this.pressedAt={x:t.clientX,y:t.clientY},this.markPressed(e.el)}findRowByKey(e){let t;for(let i of this.refs){let n=this.activeRep(i);if(!(n<0||this.opts.keyOf(n)!==e)){if(t)return;t=i}}return t}goTo(e,t){if(e.hit){this.opts.onTravelHeading(e.hit,t);return}let i=this.activeRep(e);i>=0&&this.opts.onTravel(i,t)}travel(e,t){let i=e??this.selected;return!i||!i.hit&&this.activeRep(i)<0?!1:(this.goTo(i,t),!0)}choose(e,t=!1){this.selected?.el!==e.el&&(this.selected?.el.removeClass("is-selected"),this.selected?.el.setAttr("aria-selected","false")),this.selected=e,e.el.addClass("is-selected"),e.el.setAttr("aria-selected","true"),this.reveal(e.el,t),this.opts.onActiveRow(e.el.id)}reveal(e,t){let i=this.opts.list.getBoundingClientRect();if(!t||i.height<=0){e.scrollIntoView({block:"nearest"});return}let n=e.getBoundingClientRect(),s=Dr(n.top,n.height,i.top,i.height);s!==void 0&&(this.opts.list.scrollTop+=s)}clearSelection(){this.selected?.el.removeClass("is-selected"),this.selected?.el.setAttr("aria-selected","false"),this.selected=void 0,this.opts.onActiveRow(void 0)}hideTip(){this.tip.retract()}destroy(){this.tip.destroy(),this.press?.destroy(),this.unmark(),this.doc.removeEventListener("pointerup",this.onLift),this.doc.removeEventListener("pointercancel",this.onLift)}move(e){let t=this.refs.length;if(t===0)return;let i=this.selected?this.refs.indexOf(this.selected):-1;if(i===-1){this.choose(this.refs[e>0?0:t-1],!0);return}this.choose(this.refs[(i+e+t)%t],!0)}};var Ji=require("obsidian");var Or=[["back","forward"],["top","bottom"]],Ir={back:"arrow-left",forward:"arrow-right",top:"arrow-up-to-line",bottom:"arrow-down-to-line"},Hr={back:"navHistory.commands.navigateBack",forward:"navHistory.commands.navigateForward",top:"noteEdge.commands.top",bottom:"noteEdge.commands.bottom"},qe=class{constructor(e,t,i){this.host=e;this.arrows=t;this.beforeAct=i;this.byAct=new Map;let n=e.createDiv({cls:"position-restore-nav-arrows"});for(let s of Or){let o=n.createDiv({cls:"position-restore-nav-arrow-group"});for(let a of s)this.byAct.set(a,this.button(o,a))}}refresh(){let e=this.arrows;this.enabled("back",e.canBack()),this.enabled("forward",e.canForward());let t=e.canEdge();this.enabled("top",t),this.enabled("bottom",t)}press(e){this.beforeAct();let t=this.arrows,i=e==="back"?t.back():e==="forward"?t.forward():e==="top"?t.top():t.bottom();Promise.resolve(i).then(()=>this.refresh())}forget(){this.byAct.clear()}button(e,t){let i=l(Hr[t]),n=e.createEl("button",{cls:"clickable-icon position-restore-nav-arrow",attr:{type:"button","aria-label":i,title:i}});return(0,Ji.setIcon)(n,Ir[t]),n.addEventListener("mousedown",s=>s.preventDefault()),n.addEventListener("click",()=>this.press(t)),n}enabled(e,t){let i=this.byAct.get(e);i&&(i.disabled=!t,i.toggleClass("is-disabled",!t))}};var Vr=600,At="is-flashing",Je=class{constructor(){this.running=!1;this.session=!1;this.wantCover=!1;this.hidden=[];this.deadline=0}attach(e,t){this.parent=e,this.onOpen=t}ask(e){if(this.session=!0,this.wantCover=e,e){let t=this.parent?.hoverPopover?.hoverEl;t&&t.isConnected&&this.beginCover(t)}this.start()}hoverEnded(){this.session=!1,this.wantCover=!1,this.coveredEl&&(this.reveal(),this.coveredEl=void 0)}isOpen(){let e=this.parent?.hoverPopover?.hoverEl;return!!e&&e.isConnected}stop(){this.running=!1,this.session=!1,this.wantCover=!1,this.popover=void 0,this.coveredEl=void 0,this.reveal()}start(){this.running||(this.running=!0,this.loop())}async loop(){for(;this.running&&(this.session||this.coveredEl);)this.tick(),await u();this.running=!1}tick(){let e=this.parent?.hoverPopover??void 0,t=e?.hoverEl;if(!e||!t||!t.isConnected){this.popover=void 0,this.coveredEl=void 0,this.reveal();return}if(e!==this.popover){this.reveal(),this.popover=e,this.coveredEl=void 0,this.onOpen?.(t),this.wantCover&&this.beginCover(t);return}if(this.coveredEl&&this.coveredEl!==t&&(this.reveal(),this.beginCover(t)),!!this.coveredEl){if(this.hideNew(this.coveredEl),this.coveredEl.querySelector(`.${At}`)){this.unflash(this.coveredEl),this.reveal(),this.coveredEl=void 0;return}Date.now()>this.deadline&&(this.reveal(),this.coveredEl=void 0)}}beginCover(e){this.reveal(),this.coveredEl=e,this.deadline=Date.now()+Vr,this.hideNew(e)}hideNew(e){for(let t of Array.from(e.children))t.instanceOf(HTMLElement)&&!this.hidden.includes(t)&&(t.setCssStyles({opacity:"0"}),this.hidden.push(t))}unflash(e){for(let t of Array.from(e.querySelectorAll(`.${At}`)))t.classList.remove(At)}reveal(){for(let e of this.hidden)e.setCssStyles({opacity:""});this.hidden=[]}};var _r=/[#^|[\]]/,Br="position-restore-nav-preview",Xe=class{constructor(e,t,i,n,s){this.app=e;this.reads=t;this.entries=i;this.previewFocus=n;this.onShown=s;this.hoverParent={hoverPopover:null};this.settle=new Je;this.settle.attach(this.hoverParent,o=>{this.lift(o),this.onShown()})}hoverRow(e,t,i,n,s){let o=this.entries()[e];if(!o||o.kind==="view")return;let a=this.reads.describe(e),d=s?s.line:this.wantsLine(n)?a.lineIndex:void 0,c=this.askFor(o,o.path,n,d);this.app.workspace.trigger("hover-link",{event:t,source:Q,hoverParent:this.hoverParent,targetEl:i,linktext:c.linktext,sourcePath:o.path,state:c.state}),this.settle.ask(c.state!==void 0)}hoverEnded(){this.settle.hoverEnded()}quiet(){return this.settle.isOpen()}stop(){this.settle.stop()}wantsLine(e){return!e||this.previewFocus()==="line"}askFor(e,t,i,n){if(i)return this.wantsLine(i)?{linktext:t,state:n===void 0?void 0:{scroll:n}}:{linktext:t};let s=n===void 0?void 0:this.subpathHeading(e,t,n);return s!==void 0?{linktext:`${t}#${s}`}:{linktext:t,state:n===void 0?void 0:{scroll:n}}}subpathHeading(e,t,i){if(e.kind==="view")return;let n=this.reads.headingsFor(t),s=J(n,i),o=s[s.length-1];if(!(!o||_r.test(o))&&!(n&&n.filter(a=>a.heading===o).length!==1))return o}lift(e){e.addClass(Br)}};var Kr=0;function $r(r){switch(r){case"folder":return l("recentFiles.folders.name");case"property":return l("recentFiles.frontmatterExclude.name");case"image":return l("recentFiles.excludeImages.name");case"system":return}}var Z=class{constructor(e){this.opts=e;this.filter="";this.listId=`position-restore-nav-list-${++Kr}`;this.existenceRefs=[];this.onVisibilityChange=()=>{!document.hidden&&this.opts.prefs.rowTime()&&this.render()};this.forgetMenu=()=>{this.hearPresses(!1),this.menu=void 0};this.onAnyPress=e=>{!this.menu||(e.target instanceof Element?e.target:null)?.closest(".menu-item, .nav-row-menu")||this.closeMenu()};this.reads=new Ue(e.app,{savedPosition:e.savedPosition,entries:()=>e.places.entries,onLateRead:()=>this.redrawSoon(),titleProperty:()=>this.opts.prefs.titleProperty(),onTitleChange:()=>this.render()})}mount(){this.opts.host.addClass("position-restore-nav-host"),this.opts.touch&&this.opts.host.addClass("is-touch"),this.toolbar();let e=this.opts.host.createDiv({cls:"position-restore-nav-list"});e.setAttr("id",this.listId),e.setAttr("role","listbox"),e.setAttr("aria-label",l("recentFiles.name")),this.listOpts={list:e,listId:this.listId,outlineSearch:()=>this.opts.prefs.outlineSearch(),pathDisplay:()=>this.opts.prefs.pathDisplay(),rowTime:()=>this.opts.prefs.rowTime(),pinned:()=>this.opts.places.pinned,order:()=>this.frozenOrder,keyOf:t=>{let i=this.opts.places.entries[t];return i?y(i):void 0},entries:this.opts.places.entries,currentIndex:this.opts.places.index,filter:()=>this.filter,describe:t=>this.reads.describe(t),clearDescribeCache:()=>this.reads.clearDescribeCache(),noteExists:t=>this.reads.hasFile(t),headingsFor:t=>this.reads.headingsFor(t),otherNames:(t,i)=>this.reads.otherNamesFor(t,i),onActiveRow:t=>this.setActiveRow(t),onTravel:(t,i)=>this.jump(t,i),onTravelHeading:(t,i)=>this.jumpToHeading(t,i),onHoverRow:(t,i,n,s,o)=>this.preview.hoverRow(t,i,n,s,o),tipsQuiet:()=>this.preview.quiet(),onHoverEnd:()=>this.preview.hoverEnded(),onContextRow:(t,i,n,s)=>this.contextRow(t,i,n,s),takeMenuBack:()=>this.takeMenuBack(),onForget:t=>this.forgetRow(t),touch:this.opts.touch},this.list=new Ge(this.listOpts),this.preview=new Xe(this.opts.app,this.reads,()=>this.opts.places.entries,()=>this.opts.prefs.previewFocus(),()=>this.list.hideTip()),e.addEventListener("pointerover",t=>{t.pointerType!=="touch"&&this.freezeOrder()}),e.addEventListener("pointerleave",t=>{t.pointerType!=="touch"&&this.thawOrder()}),e.addEventListener("click",t=>this.list.onUnansweredClick(t)),this.arrowBar=new qe(this.opts.host,this.opts.arrows,()=>this.shellReacts()),this.opts.host.addEventListener("keydown",t=>this.onKeyDown(t)),this.render(),this.timer=window.setInterval(()=>{document.hidden||!this.opts.prefs.rowTime()||this.render()},3e5),document.addEventListener("visibilitychange",this.onVisibilityChange),this.watchExistence(),this.opts.focusFilter&&!this.opts.touch&&this.opts.places.entries.length>0&&this.filterInput.focus()}render(){this.reads.clearDescribeCache(),this.listOpts.entries=this.opts.places.entries,this.listOpts.currentIndex=this.opts.places.index,this.list.render(),this.arrowBar.refresh()}freezeOrder(){if(this.frozenOrder)return;let e=this.list.orderedKeys();e.length&&(this.frozenOrder=e)}thawOrder(){this.frozenOrder&&(this.frozenOrder=void 0,this.render())}redrawSoon(){this.lateTimer===void 0&&(this.lateTimer=window.setTimeout(()=>{this.lateTimer=void 0,this.render()},60))}watchExistence(){let e=this.opts.app.vault;this.existenceRefs=[e.on("create",t=>this.redrawForPath(t.path)),e.on("delete",t=>this.redrawForPath(t.path)),e.on("rename",(t,i)=>{this.redrawForPath(i),this.redrawForPath(t.path)})]}redrawForPath(e){this.opts.places.entries.some(t=>t.kind!=="view"&&t.path===e)&&this.redrawSoon()}destroy(){this.closeMenu(),this.list.destroy(),this.reads.dispose(),this.preview.stop(),this.timer!==void 0&&window.clearInterval(this.timer),this.timer=void 0,this.lateTimer!==void 0&&window.clearTimeout(this.lateTimer),this.lateTimer=void 0,document.removeEventListener("visibilitychange",this.onVisibilityChange);for(let e of this.existenceRefs)this.opts.app.vault.offref(e);this.existenceRefs=[],this.arrowBar.forget()}onKeyDown(e){if(!(e.target instanceof Element?e.target:null)?.closest(".position-restore-nav-arrows")){if(e.key==="ArrowDown")e.preventDefault(),this.list.move(1);else if(e.key==="ArrowUp")e.preventDefault(),this.list.move(-1);else if(e.key==="Enter"){let i=R.Keymap.isModifier(e,"Mod")?"tab":void 0;this.list.travel(void 0,i)&&e.preventDefault()}}}setActiveRow(e){e?this.filterInput.setAttr("aria-activedescendant",e):this.filterInput.removeAttribute("aria-activedescendant")}toolbar(){let t=this.opts.host.createDiv({cls:"position-restore-nav-toolbar"}).createDiv({cls:"position-restore-nav-search"}),i=t.createEl("input",{type:"text",cls:"position-restore-nav-filter",attr:{placeholder:l("recentFiles.searchPlaceholder"),role:"combobox","aria-controls":this.listId,"aria-expanded":"true","aria-autocomplete":"list"}}),n=t.createDiv({cls:"clickable-icon position-restore-nav-clear"});(0,R.setIcon)(n,"x");let s=()=>{let a=i.value!==""||!this.opts.onDismiss?l("recentFiles.clearFilter"):l("recentFiles.close");n.setAttr("aria-label",a),n.setAttr("title",a)},o=()=>{this.filter=i.value,s(),this.render()};i.addEventListener("input",a=>{a.isComposing||o()}),i.addEventListener("compositionend",o),this.filterInput=i,s(),n.addEventListener("mousedown",a=>a.preventDefault()),n.addEventListener("click",()=>{if(i.value===""){this.opts.onDismiss?.();return}i.value="",o(),this.opts.touch||i.focus()})}depart(e){this.opts.collapseOnJump&&this.list.collapse(),this.shellReacts(),e().catch(t=>console.error("Position Restore: recent-files travel failed:",t))}jump(e,t){this.depart(()=>this.opts.places.travel(e,t))}jumpToHeading(e,t){this.depart(()=>this.opts.places.travelToHeading(e.path,e.heading,e.line,e.leafId,t))}contextRow(e,t,i,n){let s=this.opts.places.entries[e];if(!s)return;if(this.menu){this.closeMenu();return}let o=new R.Menu;if(o.addItem(a=>a.setSection("action").setTitle(l(n?"recentFiles.openHereInNewTab":"recentFiles.openInNewTab")).setIcon("file-plus").onClick(()=>n?this.jumpToHeading(n,"tab"):this.jump(e,"tab"))),i&&this.pinItems(o,y(s)),s.kind!=="view"){let a=this.opts.app.vault.getAbstractFileByPath(s.path);if(!(a instanceof R.TFile))return;this.opts.app.workspace.trigger("file-menu",o,a,"link-context-menu")}this.menu=o,o.onHide(this.forgetMenu),o.showAtPosition(t),this.hearPresses(!0)}pinItems(e,t){let i=this.opts.places.pinned.indexOf(t);if(i<0){this.pinItem(e,"recentFiles.pin","pin",()=>this.pin(t));return}let n=this.opts.places.pinned.length-1,s=this.opts.places.wouldUnpinDrop(t);this.pinItem(e,s?"recentFiles.unpinExcluded":"recentFiles.unpin","pin-off",()=>this.unpin(t),!!s),i>0&&(this.pinItem(e,"recentFiles.pinUp","arrow-up",()=>this.movePin(t,-1)),i>1&&this.pinItem(e,"recentFiles.pinFirst","arrow-up-to-line",()=>this.movePin(t,-i))),ithis.movePin(t,1)),ithis.movePin(t,n-i)))}pinItem(e,t,i,n,s=!1){e.addItem(o=>{o.setSection("action").setTitle(l(t)).setIcon(i).onClick(n),s&&o.setWarning(!0)})}pin(e){this.opts.places.pin(e),this.render()}unpin(e){let t=this.opts.places.unpin(e);this.render(),t.dropped&&t.place&&this.explainUnpinDrop(t,t.place)}explainUnpinDrop(e,t){let i=e.reason?$r(e.reason):void 0,n=new R.Notice(i?l("recentFiles.unpin.removedByRule",i):l("recentFiles.unpin.removed"),8e3);n.messageEl.createEl("button",{text:l("recentFiles.unpin.undo"),cls:"position-restore-unpin-undo"}).addEventListener("click",()=>{this.opts.places.restorePinned(t),this.render(),n.hide()})}movePin(e,t){this.opts.places.movePinned(e,t),this.render()}closeMenu(){this.hearPresses(!1);let e=this.menu;this.menu=void 0,e?.hide()}takeMenuBack(){return this.menu?(this.closeMenu(),!0):!1}hearPresses(e){let t=this.opts.host.ownerDocument;t&&(e?t.addEventListener("pointerdown",this.onAnyPress,!0):t.removeEventListener("pointerdown",this.onAnyPress,!0))}forgetRow(e){this.opts.places.forget(e),this.render()}shellReacts(){try{this.opts.onJump?.()}catch(e){console.error("Position Restore: the panel shell failed to react to a travel:",e)}}};var Ye=class extends ze.Modal{constructor(t,i,n,s,o){super(t);this.places=i;this.savedPosition=n;this.prefs=s;this.arrows=o;this.mobile=ze.Platform.isMobile}onOpen(){this.modalEl.addClass("position-restore-nav-modal"),this.modalEl.addClass("position-restore-nav-panel"),this.modalEl.toggleClass("is-touch",this.mobile),this.modalEl.toggleClass("is-fixed",!this.mobile||this.places.entries.length>12),this.modalEl.toggleClass("is-dismissive",!this.mobile),this.titleEl.setText(l("recentFiles.name")),this.browser=new Z({app:this.app,places:this.places,host:this.contentEl,savedPosition:this.savedPosition,touch:this.mobile,collapseOnJump:!1,focusFilter:!0,onJump:()=>this.close(),onDismiss:()=>this.close(),arrows:this.arrows,prefs:this.prefs}),this.browser.mount()}onClose(){this.browser.destroy()}};var ee=require("obsidian");var _=Q,ce=class extends ee.ItemView{constructor(t,i,n,s,o){super(t);this.places=i;this.savedPosition=n;this.prefs=s;this.arrows=o;this.browser=null;this.unsubscribe=null;this.missedRender=!1}getViewType(){return _}getDisplayText(){return l("recentFiles.name")}getIcon(){return"clock"}async onOpen(){this.contentEl.addClass("position-restore-nav-panel","position-restore-nav-view"),ee.Platform.isMobile&&this.contentEl.addClass("is-touch"),this.browser=new Z({app:this.app,places:this.places,host:this.contentEl,savedPosition:this.savedPosition,touch:ee.Platform.isMobile,collapseOnJump:!0,onJump:()=>this.standAside(),focusFilter:!1,arrows:this.arrows,prefs:this.prefs}),this.browser.mount(),this.unsubscribe=this.places.subscribe(()=>this.hearPlaces())}async onClose(){this.unsubscribe?.(),this.unsubscribe=null,this.browser?.destroy(),this.browser=null,this.stopSuspending()}refresh(){this.browser?.render()}onPaneMenu(t){this.clearable()&&t.addItem(i=>i.setSection("action").setTitle(l("recentFiles.clearList")).setIcon("eraser").onClick(()=>this.places.clear()))}clearable(){return this.places.entries.some(t=>!this.places.isPinned(y(t)))}hearPlaces(){if(this.suspendTimer!==void 0){this.missedRender=!0;return}this.browser?.render()}standAside(){ee.Platform.isMobile&&(this.browser?.closeMenu(),this.dismissOnMobile(),this.suspendRedraws())}suspendRedraws(){this.stopSuspending(),this.suspendTimer=window.setTimeout(()=>{this.suspendTimer=void 0,this.missedRender&&(this.missedRender=!1,this.browser?.render())},300)}stopSuspending(){this.suspendTimer!==void 0&&(window.clearTimeout(this.suspendTimer),this.suspendTimer=void 0,this.missedRender=!1)}dismissOnMobile(){let t=this.leaf.parent;t?.collapsed===!1&&typeof t.collapse=="function"&&t.collapse()}};async function Xi(r,e,t,i){let n=r.workspace.getLeavesOfType(_)[0];if(n){await r.workspace.revealLeaf(n);return}let s=r.workspace.getRightLeaf(!1);s&&(await s.setViewState({type:_,active:!0}),await r.workspace.revealLeaf(s))}function Yi(r,e,t,i){return n=>new ce(n,r,e,t,i)}var Jr=1e4,Qe=class{constructor(e,t,i,n){this.app=e;this.store=t;this.navStores=i;this.state=n;this.pendingDeletes=new Map;this.pendingSweeps=new Map}renameFile(e,t){this.cancelPending(e.path),this.store.renameFile(e.path,t);for(let i of this.navStores)i.renameFile(t,e.path);this.state.lastLoadedFilePath==t&&(this.state.lastLoadedFilePath=e.path)}deleteFile(e){this.deferMissing(this.pendingDeletes,e.path,()=>this.prune(e.path))}fileCreated(e){this.cancelPending(e.path)}cancelPending(e){for(let t of[this.pendingDeletes,this.pendingSweeps]){let i=t.get(e);i!==void 0&&(window.clearTimeout(i),t.delete(e))}}sweepMissingHistory(){let e=new Set;for(let t of this.navStores)for(let i of t.knownPaths())e.add(i);for(let t of e)this.app.vault.getAbstractFileByPath(t)||this.deferMissing(this.pendingSweeps,t,()=>{for(let i of this.navStores)i.deleteFile(t);for(let i of this.navStores)i.persist()})}deferMissing(e,t,i){let n=e.get(t);n!==void 0&&window.clearTimeout(n);let s=window.setTimeout(()=>{this.confirmGone(e,t,s,i)},Jr);e.set(t,s)}async confirmGone(e,t,i,n){if(this.app.vault.getAbstractFileByPath(t)){e.delete(t);return}let s;try{s=await this.app.vault.adapter.exists(t)}catch{s=!0}s||e.get(t)!==i||(e.delete(t),n())}prune(e){this.store.deleteFile(e);for(let t of this.navStores)t.deleteFile(e)}dispose(){for(let e of[this.pendingDeletes,this.pendingSweeps]){for(let t of e.values())window.clearTimeout(t);e.clear()}}};var Xr=400,Yr=2,zi=["pointerdown","touchstart","wheel","keydown"],zr=3,Qr=".embedded-backlinks",Zr=[".mobile-navbar",".mobile-toolbar"],es=1;function Qi(r,e){let t=x(r);return!!t&&sn(t,e)}function Zi(r,e){let t=r.editor;if(!t)return!0;let i=t.getCursor();if(e==="top")return i.line===0&&i.ch===0;let n=t.lastLine();return i.line===n&&i.ch>=(t.getLine(n)??"").length}function en(r,e){Mt(r,e);let t=x(r);t&&on(t,e)}async function tn(r,e){let t=x(r);if(!t)return;let i=!1,n=()=>{i=!0};for(let s of zi)t.addEventListener(s,n,{capture:!0,once:!0});try{let s=Date.now()+Xr,o=0;for(;!i&&t.isConnected&&Date.now()Yr)return;on(t,e)}}finally{for(let s of zi)t.removeEventListener(s,n,{capture:!0})}}async function nn(r){for(let e=0;e0?i:r.scrollHeight}function is(r){let e=r.getBoundingClientRect();if(e.height<=0)return 0;let t=0;for(let i of Zr)for(let n of Array.from(r.ownerDocument.querySelectorAll(i))){let s=n.getBoundingClientRect();s.height<=0||s.bottom=e.right||(t=Math.max(t,Math.min(e.bottom,s.bottom)-Math.max(e.top,s.top)))}return Math.max(0,Math.min(t,e.height))}function ns(r){let e=Math.max(0,r.scrollHeight-r.clientHeight),t=r.clientHeight-is(r);return Math.max(0,Math.min(e,Math.round(ts(r)-t)))}function rn(r,e){return e==="top"?0:ns(r)}function sn(r,e){return Math.abs(r.scrollTop-rn(r,e))<=es}function on(r,e){r.scrollTop=rn(r,e)}function Mt(r,e){let t=r.editor;if(!t)return;let i=e==="top"?0:t.lastLine();t.setCursor({line:i,ch:e==="top"?0:t.getLine(i).length})}var et=class{constructor(e,t,i){this.settings=i;this.app=e,this.database=t,this.state=new Te(i),this.funnel=new Ve(e,this.state),this.stack=new _e(e,i,this.state,this.funnel,n=>this.database.db[n]),this.places=new Be(e,i),this.funnel.subscribe(this.stack),this.funnel.subscribe({onVisit:n=>this.places.remember(n.record),onLanded:n=>this.places.settle(n),onHere:n=>this.places.markCurrent(n)}),this.places.attach({openFile:(n,s,o)=>this.stack.openFilePlain(n,s,o),openJump:(n,s)=>this.stack.travelTo(n,s),openView:(n,s)=>this.stack.openViewPlace(n,s)}),this.store=new Ee(e,t),this.restorer=new Ae(e,i,this.store,this.state),this.sampler=new He(e,this.store,i,this.state,this.funnel),this.patcher=new Ce(e,i,this.store,this.state,this.funnel,this.sampler),this.explorerPreview=new Oe(e,t,i),this.backgroundSettler=new Re(e,this.store,this.state),this.bookkeeper=new Qe(e,this.store,[this.stack,this.places],this.state)}installPatches(e){this.patcher.installPatches(e),this.funnel.installOutlineCapture(e),this.sampler.installSearchAnchor(e),this.sampler.installFrontmatterWatch(e),te.Platform.isDesktopApp?(this.sampler.installScrollCapture(e),this.sampler.installUserIntentTracker(e),this.sampler.installTeleportWatcher(e)):this.sampler.installTouchListener(e)}installExplorerPreview(e){this.explorerPreview.install(e)}restoreEphemeralState(){this.restorer.restoreEphemeralState().catch(e=>console.error("Position Restore: restore failed:",e))}completeInjectedRestore(e){this.restorer.completeInjectedRestore(e).catch(t=>console.error("Position Restore: complete injected restore failed:",t))}installBackgroundSettle(e){this.backgroundSettler.start(e)}sampleActiveView(){this.sampler.sampleActiveView()}sampleActiveViewState(){if(!this.funnel.isRecording())return;let e=this.app.workspace.getActiveViewOfType(te.View);if(!e||e instanceof te.FileView)return;let t=e.getViewType();if(!Me(t))return;let i=this.stack.entries[this.stack.index];if(!i||i.kind!=="view"||i.viewType!==t||!A(this.app,e.leaf))return;let n=O(e);!n||JSON.stringify(n)===JSON.stringify(i.state)||this.funnel.landing({kind:"view",leafId:i.leafId,viewType:t,state:n,label:$(e),icon:G(e)})}async storePositionData(){try{this.restorer.pruneStaleLeafIds(),this.store.persist(),this.stack.persist(),this.places.persist(),await this.database.writeDb()}catch(e){console.error("Position Restore: could not save positions:",e)}}navigateBack(){return this.stack.navigate(-1).catch(e=>console.error("Position Restore: navigate back failed:",e))}navigateForward(){return this.stack.navigate(1).catch(e=>console.error("Position Restore: navigate forward failed:",e))}goToEdge(e){let t=dt(this.app);if(!t?.file)return;if(Qi(t,e)){Zi(t,e)||this.funnel.runBracketed(async()=>{Mt(t,e)}).catch(o=>console.error("Position Restore: move caret to edge failed:",o));return}let i=t.file.path,n=this.state.leafId(t.leaf),s=S(t);s&&this.funnel.leave(i,n,s),this.funnel.visit({record:{kind:"visit",path:i,leafId:n},cause:"open",forced:!0}),this.funnel.runBracketed(async()=>{en(t,e),await tn(t,e),await nn(t)}).catch(o=>console.error("Position Restore: go to edge failed:",o))}canGoToEdge(){return!!dt(this.app)?.file}canNavigate(e){return this.stack.canNavigate(e)}openRecentFilesModal(){new Ye(this.app,this.places,e=>this.database.db[e],this.browserPrefs(),this.recentFilesArrows()).open()}openRecentFilesSidebar(){Xi(this.app,this.places,e=>this.database.db[e],this.browserPrefs())}recentFilesViewCreator(){return Yi(this.places,e=>this.database.db[e],this.browserPrefs(),this.recentFilesArrows())}recentFilesArrows(){return{back:()=>this.navigateBack(),forward:()=>this.navigateForward(),top:()=>this.goToEdge("top"),bottom:()=>this.goToEdge("bottom"),canBack:()=>this.stack.hasStep(-1),canForward:()=>this.stack.hasStep(1),canEdge:()=>this.canGoToEdge()}}browserPrefs(){return{outlineSearch:()=>this.settings.recentFilesOutlineSearch,placesCap:()=>this.settings.recentFilesCap,pathDisplay:()=>this.settings.recentFilesPathDisplay,rowTime:()=>this.settings.recentFilesRowTime,titleProperty:()=>this.settings.recentFilesTitleProperty,previewFocus:()=>this.settings.recentFilesPreviewFocus}}refreshNavPanels(){for(let e of this.app.workspace.getLeavesOfType(_)){let t=e.view;t instanceof ce&&t.refresh()}}recordActivation(e){this.funnel.recordActivation(e)}isSearchAnchored(){return this.state.isSearchAnchored()}renameFile(e,t){this.bookkeeper.renameFile(e,t)}deleteFile(e){this.bookkeeper.deleteFile(e)}fileCreated(e){this.bookkeeper.fileCreated(e)}sweepMissingHistory(){this.bookkeeper.sweepMissingHistory()}installPathBookkeeping(e){e(()=>this.bookkeeper.dispose())}applyNavHistoryCap(){this.stack.applyStackCap()}applyRecentFilesExclusions(){this.places.pruneExcluded()>0&&this.places.applyCap()}applyRecentFilesCap(){this.places.applyCap()}applyChangedSettings(e){this.settings.navHistoryCap!==e.navHistoryCap&&this.applyNavHistoryCap(),this.settings.recentFilesCap!==e.recentFilesCap&&this.applyRecentFilesCap(),(!Ze(this.settings.recentFilesExcludeFolders,e.recentFilesExcludeFolders)||!Ze(this.settings.recentFilesExcludeProperties,e.recentFilesExcludeProperties)||this.settings.recentFilesExcludeImages!==e.recentFilesExcludeImages)&&this.applyRecentFilesExclusions(),(!Ze(this.settings.excludedFolders,e.excludedFolders)||!Ze(this.settings.frontmatterExcludeProperties,e.frontmatterExcludeProperties))&&this.prunePositions()}prunePositions(){return this.store.pruneDatabase()}};function Ze(r,e){return r.length===e.length&&r.every((t,i)=>t===e[i])}var tt=class extends it.Plugin{async onload(){await this.loadSettings(),this.database=new be(this,this.settings),this.manager=new et(this.app,this.database,this.settings),await this.database.readDb(),this.addSettingTab(new ge(this.app,this)),this.registerView(_,this.manager.recentFilesViewCreator()),this.registerPreviewSource(),this.manager.installPatches(e=>this.register(e)),this.manager.installExplorerPreview(e=>this.register(e)),this.manager.installBackgroundSettle(e=>this.register(e)),this.manager.installPathBookkeeping(e=>this.register(e)),this.registerCommands(),this.registerWorkspaceEvents(),this.registerPolling(),this.registerDbFlush(),this.registerSuspendFlush(),this.app.workspace.onLayoutReady(()=>{this.manager.prunePositions(),this.manager.sweepMissingHistory()}),this.manager.restoreEphemeralState()}async loadSettings(){let e=await this.loadData();this.settings?Object.assign(this.settings,H,e):this.settings={...H,...e}}async saveSettings(){await this.saveData(this.settings)}async onExternalSettingsChange(){let e={...this.settings};await this.loadSettings(),this.manager.applyChangedSettings(e)}registerPreviewSource(){this.registerHoverLinkSource(Q,{display:l("recentFiles.name"),defaultMod:!0})}registerCommands(){this.addCommand({id:"navigate-back",name:l("navHistory.commands.navigateBack"),icon:"arrow-left",checkCallback:t=>this.manager.canNavigate(-1)?(t||this.manager.navigateBack(),!0):!1}),this.addCommand({id:"navigate-forward",name:l("navHistory.commands.navigateForward"),icon:"arrow-right",checkCallback:t=>this.manager.canNavigate(1)?(t||this.manager.navigateForward(),!0):!1}),this.addCommand({id:"go-to-top",name:l("noteEdge.commands.top"),icon:"arrow-up",checkCallback:t=>this.manager.canGoToEdge()?(t||this.manager.goToEdge("top"),!0):!1}),this.addCommand({id:"go-to-bottom",name:l("noteEdge.commands.bottom"),icon:"arrow-down",checkCallback:t=>this.manager.canGoToEdge()?(t||this.manager.goToEdge("bottom"),!0):!1}),this.addCommand({id:"browse-recent-files",name:l("recentFiles.commands.open"),icon:"clock",callback:()=>this.manager.openRecentFilesModal()}),this.addCommand({id:"open-recent-files-sidebar",name:l("recentFiles.commands.openSidebar"),icon:"panel-right",callback:()=>this.manager.openRecentFilesSidebar()});let e=it.Platform.isMobile?()=>this.manager.openRecentFilesModal():()=>this.manager.openRecentFilesSidebar();this.addRibbonIcon("clock",l("recentFiles.name"),e)}registerWorkspaceEvents(){this.registerEvent(this.app.workspace.on("file-open",()=>this.manager.restoreEphemeralState())),this.registerEvent(this.app.workspace.on("active-leaf-change",e=>{this.manager.completeInjectedRestore(e),this.manager.recordActivation(e)})),this.registerEvent(this.app.vault.on("rename",(e,t)=>this.manager.renameFile(e,t))),this.registerEvent(this.app.vault.on("delete",e=>this.manager.deleteFile(e))),this.registerEvent(this.app.vault.on("create",e=>this.manager.fileCreated(e))),this.registerEvent(this.app.workspace.on("quit",e=>{e.addPromise(this.manager.storePositionData())}))}registerPolling(){this.registerInterval(window.setInterval(()=>this.manager.sampleActiveView(),100)),this.registerInterval(window.setInterval(()=>this.manager.sampleActiveViewState(),1e3))}registerDbFlush(){this.registerInterval(window.setInterval(()=>{this.database.mergeExternalChanges().then(()=>this.manager.storePositionData()).catch(e=>console.error("Position Restore: periodic flush failed:",e))},5e3))}registerSuspendFlush(){let e=()=>{this.manager.isSearchAnchored()||(this.manager.sampleActiveView(),this.manager.sampleActiveViewState()),this.manager.storePositionData()};this.registerDomEvent(document,"visibilitychange",()=>{document.hidden&&e()}),this.registerDomEvent(window,"pagehide",()=>e())}}; +module.exports = module.exports.default || module.exports; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/position-restore/manifest.json b/.obsidian/plugins/position-restore/manifest.json new file mode 100644 index 0000000..ff262e8 --- /dev/null +++ b/.obsidian/plugins/position-restore/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "position-restore", + "name": "Position Restore", + "version": "1.5.0", + "minAppVersion": "1.13.0", + "description": "Restore cursor and scroll position for each note across sessions and devices — exact landing, no jump — with VSCode-style back/forward navigation history.", + "author": "aisahpA", + "authorUrl": "https://github.com/aisahpA", + "isDesktopOnly": false +} diff --git a/.obsidian/plugins/position-restore/position-restore-data.json b/.obsidian/plugins/position-restore/position-restore-data.json new file mode 100644 index 0000000..718e1c9 --- /dev/null +++ b/.obsidian/plugins/position-restore/position-restore-data.json @@ -0,0 +1 @@ +{"schema":3,"lastPositions":{"README.md":{"s":24,"t":1791901526470},"笔记/考纲-课件覆盖对照.md":{"s":53,"t":1791902638219},"笔记/练习-齿轮-答案卷.md":{"s":33,"t":1791903439239},"笔记/知识点-齿轮(知识库整合).md":{"s":39,"c":[48,0,48,0],"t":1791904899132},"笔记/练习-齿轮-题目卷.md":{"s":138,"c":[106,3,106,3],"t":1791905153442},"笔记/知识点-轮系(齿轮系及其设计).md":{"s":61,"c":[67,0,67,0],"t":1791905157974}}} \ No newline at end of file diff --git a/.obsidian/plugins/position-restore/styles.css b/.obsidian/plugins/position-restore/styles.css new file mode 100644 index 0000000..62d76f0 --- /dev/null +++ b/.obsidian/plugins/position-restore/styles.css @@ -0,0 +1 @@ +.position-restore-db-path-input{width:100%}.position-restore-db-path-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.position-restore-db-path-row.is-actions{justify-content:flex-end}body.is-phone .position-restore-db-path-row.is-pickers>button{flex:1 1 100%}.position-restore-db-path-hint{margin:12px 0 20px}.position-restore-db-path-hint>summary{cursor:pointer;color:var(--text-muted);padding:4px 0}.position-restore-db-path-hint>p{margin:4px 0 0 1.4em}.position-restore-page-intro .setting-item-name{display:none}.position-restore-cue{position:absolute;top:30%;left:50%;transform:translate(-50%,-50%);max-width:44ch;z-index:100;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;text-align:center;overflow-wrap:anywhere;overflow:hidden;font-size:var(--font-ui-large);color:var(--text-normal);background:var(--background-secondary);border:1px solid var(--background-modifier-border);border-radius:6px;padding:4px 12px;box-shadow:var(--shadow-s);opacity:0;pointer-events:none}body.is-mobile .position-restore-cue{left:4%;right:4%;transform:translateY(-50%);max-width:none}.position-restore-cue-host{position:relative}.position-restore-cue-sep{opacity:.5;white-space:nowrap}.position-restore-cue-seg{white-space:normal;opacity:.75}.position-restore-cue-seg.is-deepest{opacity:1;font-weight:600}.position-restore-unpin-undo{margin-inline-start:.75em}.modal.position-restore-nav-modal{width:min(23em,94vw);max-width:min(23em,94vw)}.modal.position-restore-nav-modal:not(.is-touch){--nav-modal-top: 80px;width:var(--prompt-width, 700px);max-width:min(var(--prompt-max-width, 80vw),94vw);align-self:flex-start;margin-top:var(--nav-modal-top);--nav-item-size: var(--font-ui-medium)}.modal.position-restore-nav-modal.is-fixed:not(.is-touch){height:min(var(--prompt-max-height, 70vh),calc(100vh - var(--nav-modal-top) - 24px))}.modal.position-restore-nav-modal:not(.is-touch) .position-restore-nav-row{padding:6px 12px}.modal.position-restore-nav-modal:not(.is-touch) .nav-row-actions{inset-inline-end:10px}.modal.position-restore-nav-modal:not(.is-touch) .nav-row-path,.modal.position-restore-nav-modal:not(.is-touch) .nav-row-time,.modal.position-restore-nav-modal:not(.is-touch) .nav-row-heading,.modal.position-restore-nav-modal:not(.is-touch) .position-restore-nav-empty{font-size:var(--font-ui-small)}.modal.position-restore-nav-modal:not(.is-touch) .nav-row-name{max-width:34em}.position-restore-nav-modal:not(.is-touch) input.position-restore-nav-filter[type=text]{font-size:var(--font-ui-medium);padding-top:8px}.modal.position-restore-nav-modal:not(.is-touch) .modal-header{display:none}.modal.position-restore-nav-modal.is-dismissive:not(.is-touch) .modal-header-button,.modal.position-restore-nav-modal.is-dismissive:not(.is-touch) .modal-close-button{display:none}.position-restore-nav-panel{--nav-muted: color-mix(in srgb, var(--text-normal) 88%, transparent);--nav-faint: color-mix(in srgb, var(--text-normal) 55%, transparent);--icon-color: var(--text-normal);--icon-color-hover: var(--text-normal);--icon-opacity: 1;--icon-opacity-hover: 1;--nav-action-target: 36px;--nav-arrow-target: 28px;--no-tooltip: true}.modal.position-restore-nav-modal.is-fixed{display:flex;flex-direction:column;height:min(84vh,800px)}.modal.position-restore-nav-modal.is-fixed .modal-content{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow:hidden}.modal.position-restore-nav-modal.is-fixed .position-restore-nav-list{flex:1 1 auto;min-height:0;max-height:none}.position-restore-nav-list{position:relative;flex:1 1 auto;min-width:0;min-height:0;overflow-y:auto;max-height:60vh;padding-bottom:4px;touch-action:pan-y pinch-zoom;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.position-restore-nav-pinned-sep{height:0;margin:5px 8px 6px;border-top:1px solid var(--background-modifier-border)}.position-restore-nav-arrows{display:flex;align-items:center;justify-content:center;gap:22px;flex:0 0 auto;padding:8px 2px 6px;border-top:1px solid var(--background-modifier-border);margin-top:4px}.position-restore-nav-arrow-group{display:flex;align-items:center;gap:2px;padding:2px;border:1px solid var(--background-modifier-border);border-radius:999px;background:var(--background-secondary)}.position-restore-nav-arrow{display:flex;align-items:center;justify-content:center;width:var(--nav-arrow-target);height:var(--nav-arrow-target);padding:0;border:none;border-radius:999px;background:transparent;--icon-color: var(--text-normal);--icon-color-hover: var(--text-normal);color:var(--text-normal);--icon-size: var(--icon-m)}.position-restore-nav-arrow svg,.position-restore-nav-arrow svg *{color:var(--text-normal);stroke:currentColor;stroke-width:2}.position-restore-nav-arrow:hover:not(:disabled){background:var(--background-modifier-hover);color:var(--text-normal)}.position-restore-nav-arrow.is-disabled{opacity:.35;cursor:default}.position-restore-nav-host{display:flex;flex-direction:column;min-height:0}.position-restore-nav-view .position-restore-nav-arrows{padding-bottom:34px}.mod-left-split .position-restore-nav-arrows{padding-bottom:8px}.position-restore-nav-panel.is-touch .position-restore-nav-arrows{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));--nav-arrow-target: var(--touch-size-m)}.position-restore-nav-toolbar{display:flex;align-items:center;gap:10px;flex:0 0 auto;padding:0 2px 8px;--background-modifier-form-field: transparent;--background-modifier-form-field-hover: transparent;--input-border-width: 0;--input-border-width-focus: 0}.position-restore-nav-search{position:relative;display:flex;align-items:center;flex:1 1 auto;min-width:0}.position-restore-nav-panel input.position-restore-nav-filter[type=text]{flex:1 1 auto;min-width:0;height:auto;padding:0 0 4px;border:none;border-bottom:1px solid var(--background-modifier-border);border-radius:0;box-shadow:none;font-size:var(--font-ui-small)}.position-restore-nav-panel input.position-restore-nav-filter[type=text]:not(:placeholder-shown),.position-restore-nav-modal.is-dismissive:not(.is-touch) input.position-restore-nav-filter[type=text]{padding-inline-end:1.6em}.position-restore-nav-panel input.position-restore-nav-filter[type=text]:focus,.position-restore-nav-panel input.position-restore-nav-filter[type=text]:focus-visible{border-bottom-color:var(--interactive-accent);box-shadow:none;outline:none}.position-restore-nav-panel input.position-restore-nav-filter::placeholder{color:var(--nav-faint)}.position-restore-nav-panel .position-restore-nav-search .position-restore-nav-clear{position:absolute;inset-inline-end:0;top:0;bottom:4px;margin:auto;padding:2px;--nav-clear-ink: var(--nav-faint);--icon-size: var(--icon-xs);--icon-color: var(--nav-clear-ink);--icon-opacity: 1;color:var(--nav-clear-ink);opacity:1}.position-restore-nav-panel .position-restore-nav-search .position-restore-nav-clear svg{color:var(--nav-clear-ink);stroke:currentColor}.position-restore-nav-panel:not(.is-dismissive) .position-restore-nav-search input:placeholder-shown~.position-restore-nav-clear{display:none}.position-restore-nav-panel .position-restore-nav-search .position-restore-nav-clear:hover{--nav-clear-ink: var(--text-normal);background-color:var(--background-modifier-hover)}.position-restore-nav-panel.is-touch .position-restore-nav-search .position-restore-nav-clear{padding:5px;--icon-size: var(--icon-s)}.position-restore-nav-row{column-gap:8px;align-items:baseline;white-space:nowrap;overflow:hidden;position:relative;padding:4px 8px;border-radius:var(--radius-s);cursor:pointer;font-size:var(--nav-item-size, var(--font-ui-small))}.position-restore-nav-panel:not(.is-touch) .position-restore-nav-row:hover:not(.is-selected):not(.is-pressed){background-color:var(--background-modifier-hover)}.position-restore-nav-panel .position-restore-nav-row.is-pressed{background-color:var(--background-modifier-active, var(--background-modifier-hover))}.position-restore-nav-row.is-selected.is-pressed{background-color:color-mix(in srgb,var(--interactive-accent) 28%,transparent)}.position-restore-nav-row.is-selected{background-color:color-mix(in srgb,var(--interactive-accent) 12%,transparent)}.position-restore-nav-row.is-selected:hover{background-color:color-mix(in srgb,var(--interactive-accent) 20%,transparent)}.position-restore-nav-row.is-file{display:grid;grid-template-columns:minmax(0,1fr);align-items:baseline}.position-restore-nav-row.is-file.is-timed{grid-template-columns:minmax(0,1fr) auto}.position-restore-nav-row.is-heading{display:grid;grid-template-columns:minmax(0,1fr);align-items:baseline;margin-inline-start:1.5em;box-shadow:inset 2px var(--background-modifier-border)}.position-restore-nav-more{margin-inline-start:1.5em;padding:2px 8px;box-shadow:inset 2px var(--background-modifier-border);color:var(--nav-faint);font-size:var(--font-ui-smaller)}.position-restore-nav-row .nav-row-file{display:flex;align-items:baseline;min-width:0;flex-wrap:wrap;column-gap:.5em}.position-restore-nav-row .nav-row-head{display:flex;align-items:baseline;flex-wrap:nowrap;min-width:0;column-gap:.5em}.position-restore-nav-row .nav-file-tag{margin-inline-start:0;flex:0 0 auto}.position-restore-nav-row .nav-row-view-icon{flex:0 0 auto;display:inline-flex;align-items:center;color:var(--nav-faint)}.position-restore-nav-row .nav-row-view-icon .svg-icon{width:1em;height:1em}.position-restore-nav-row .nav-row-path{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--nav-faint);font-size:var(--font-ui-smaller)}.position-restore-nav-row.is-file.is-path-before .nav-row-path{order:-1}.position-restore-nav-row .nav-row-heading{min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--nav-muted);font-size:var(--font-ui-smaller)}.modal.position-restore-nav-modal:not(.is-touch) .position-restore-nav-row .nav-row-path{white-space:normal;overflow-wrap:break-word;overflow:visible;text-overflow:clip;color:var(--nav-muted)}.position-restore-nav-row .nav-row-time{color:var(--nav-faint);font-size:var(--font-ui-smaller)}.position-restore-nav-row .nav-row-actions{position:absolute;inset-inline-end:4px;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:flex-end;gap:2px;background:inherit;pointer-events:none}.position-restore-nav-row .nav-row-forget,.position-restore-nav-row .nav-row-menu{display:flex;align-items:center;justify-content:center;padding:1px;border-radius:var(--radius-s);--nav-action-ink: var(--nav-muted);color:var(--nav-action-ink);--icon-size: var(--icon-xs);opacity:0;pointer-events:none}.position-restore-nav-row .nav-row-actions svg,.position-restore-nav-row .nav-row-actions svg *{color:var(--nav-action-ink);stroke:currentColor;stroke-width:2.25}.position-restore-nav-panel:not(.is-touch) .position-restore-nav-row .nav-row-forget:hover{--nav-action-ink: var(--text-normal);background-color:var(--background-modifier-hover)}.position-restore-nav-panel:not(.is-touch) .position-restore-nav-row:hover .nav-row-time{color:transparent}.position-restore-nav-panel:not(.is-touch) .position-restore-nav-row:hover .nav-row-actions>*{opacity:1;pointer-events:auto}.position-restore-nav-panel:not(.is-touch) .position-restore-nav-row:hover .nav-row-actions,.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed .nav-row-actions{pointer-events:auto}.position-restore-nav-panel.is-touch .position-restore-nav-row{-webkit-touch-callout:none;user-select:none}.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed{padding-inline-end:calc(2 * var(--nav-action-target) + 12px)}.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed:not(.is-pressed){background:var(--background-modifier-hover)}.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed .nav-row-time{color:transparent}.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed .nav-row-actions{inset-block:0;inset-inline-end:0;transform:none;gap:0;padding-inline:8px 4px}.position-restore-nav-panel.is-touch .position-restore-nav-row.is-armed .nav-row-actions>*{opacity:1;pointer-events:auto;--icon-size: var(--icon-s);align-self:stretch;min-width:var(--nav-action-target)}.position-restore-nav-row .nav-row-name{flex:0 1 auto;max-width:20em;min-width:0;overflow:hidden;text-overflow:ellipsis}.position-restore-nav-empty{padding:10px 8px;color:var(--nav-muted);font-size:var(--font-ui-smaller)}.position-restore-nav-tip{position:fixed;z-index:var(--layer-tooltip);pointer-events:none;max-width:min(56ch,86vw);padding:6px 9px;background-color:var(--background-secondary);border:1px solid var(--background-modifier-border);border-radius:var(--radius-s);box-shadow:var(--shadow-s);color:var(--text-normal);text-align:start}.position-restore-nav-tip .nav-tip-path{font-family:var(--font-monospace);font-size:var(--font-ui-small);line-height:1.35;overflow-wrap:anywhere}.position-restore-nav-tip .nav-tip-seg{color:color-mix(in srgb,var(--text-normal) 78%,transparent)}.position-restore-nav-tip .nav-tip-sep{padding:0 .12em;font-weight:700}.position-restore-nav-tip .nav-tip-name{font-weight:500}.position-restore-nav-tip .nav-tip-text,.position-restore-nav-tip .nav-tip-trail{font-size:var(--font-ui-smaller);line-height:1.4;color:color-mix(in srgb,var(--text-normal) 82%,transparent);overflow-wrap:anywhere}.position-restore-nav-panel.is-touch .position-restore-nav-row{row-gap:2px;padding:6px 8px}.popover.hover-popover.position-restore-nav-preview{z-index:calc(var(--layer-modal) + 1)}.workspace-leaf-content .view-content.position-restore-nav-view{display:flex;flex-direction:column;overflow:hidden;padding:0}.position-restore-nav-view{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}.position-restore-nav-view .position-restore-nav-list{flex:1 1 auto;width:auto;max-height:none;padding:0 8px 8px}.position-restore-nav-view .position-restore-nav-toolbar{padding:12px 8px 8px}@media(max-height:520px){.position-restore-nav-modal.is-touch .modal-header{display:none}.position-restore-nav-modal.is-touch .modal-content{padding-top:var(--size-4-3, 12px)}.position-restore-nav-modal.is-touch .position-restore-nav-toolbar{padding-bottom:4px;min-height:var(--touch-size-m, 44px);padding-inline-end:calc(var(--touch-size-m, 44px) + var(--size-4-1, 4px))}.modal.position-restore-nav-modal input.position-restore-nav-filter{flex:1 1 5em;min-width:5em}.modal.position-restore-nav-modal.is-fixed{height:min(92vh,800px)}} diff --git a/README.md b/README.md new file mode 100644 index 0000000..afc16e8 --- /dev/null +++ b/README.md @@ -0,0 +1,166 @@ +# 机械原理与机械设计 · 考研复习笔记库 + +> 把"扫描版 / 图片版课件"转成**可检索、可复习、可自测**的结构化笔记。 +> 课程:**机械原理与机械设计(天津大学 · 张策主编教材体系)** + +--- + +## 一、考试信息(803 科目) + +| 项目 | 内容 | +|---|---| +| 专业代码 | 080200(机械工程·学硕)、085501(机械工程·专硕) | +| 考试科目代码 / 名称 | **803 / 机械原理与机械设计** | +| 考试形式 | 笔试,**3 小时,满分 150 分** | +| 参考书 | 《机械原理与机械设计》(上、下册)**第 4 版,张策 主编,机械工业出版社** | + +**试卷结构** + +| 部分 | 占比 | 题型及比例 | +|---|---|---| +| 机械原理 | 50% | 填空、选择 10%~20%;计算、图解分析 **80%~90%** | +| 机械设计 | 50% | 填空、选择 20%~30%;分析、简答 10%~15%;计算、结构设计 **55%~70%** | + +> 大纲原文见 `考试大纲/803_机械原理与机械设计_考试大纲.pdf`。 + +--- + +## 二、考试大纲要点 + +### 1. 机械原理部分(占 50%) + +1. **机构的组成和结构分析**:结构分析、自由度计算、拆杆组、确定机构级别。 +2. **平面机构的运动分析**:速度瞬心法、相对运动图解法、平面矢量复数极坐标表示法、整体运动分析法。 +3. **平面机构的力分析**:动态静力分析、平衡力/平衡力矩的解析确定、机械效率与运动副摩擦及自锁。 +4. **平面连杆机构及其设计**:类型与特点、运动和动力特性、刚体位移矩阵、刚体导引/函数生成/轨迹生成机构综合、按行程速度变化系数综合。 +5. **凸轮机构及其设计**:从动件运动规律、平面凸轮廓线设计、基本尺寸确定。 +6. **齿轮机构及其设计**:特点、渐开线标准直齿圆柱齿轮基本参数与尺寸、啮合传动、加工原理、变位齿轮传动、几何设计、斜齿轮、蜗杆与直齿锥齿轮。 +7. **轮系及其设计**:定轴 / 周转 / 复合轮系传动比计算、轮系功用。 +8. **其他常用机构**:间歇运动机构、组合机构、螺旋机构的运动特点。 +9. **机器的运转和调速**:多自由度/单自由度系统动力学分析、速度波动及调节、飞轮设计。 +10. **机械的平衡**:目的与分类、刚性转子平衡设计、平衡试验。 + +### 2. 机械设计部分(占 50%) + +1. 机械零件工作能力及计算准则。 +2. 与工程实践结合的疲劳强度计算、摩擦、磨损及润滑。 +3. 连接(螺纹组合计算、键、花键、过盈)强度校核。 +4. 机械传动(带、链、**齿轮、蜗杆**)的传动特点和设计方法。 +5. 轴的强度校核方法。 +6. 滚动轴承组合结构设计与寿命计算、滑动轴承传动特点。 +7. 联轴器和离合器的传动特点。 +8. 弹簧基本知识(材料特点、特性线、旋绕比、强度、刚度)。 + +--- + +## 三、目录结构 + +``` +机械设计笔记/ +├── README.md ← 本文件(项目说明) +├── 欢迎.md ← Obsidian 默认文件(可删) +├── 考试大纲/ +│ └── 803_机械原理与机械设计_考试大纲.pdf +├── 知识库/ +│ ├── {3}--资源/ ← 天大配套课件(以「机械设计」各章为主) +│ └── 补充资源/ +│ └── 机械原理PPT/ ← 「机械原理」全套课件 00~11(与考纲逐章对应) +└── 笔记/ ← 全部笔记产物 + ├── 知识点-齿轮(知识库整合).md + ├── 知识点-轮系(齿轮系及其设计).md + ├── 练习-齿轮-题目卷.md + ├── 练习-齿轮-答案卷.md + └── images/ ← 配图(PNG)+ 绘图脚本 + ├── gen_figures.py (齿轮配图:fig01 ~ fig12) + └── gen_figures_geartrain.py (轮系配图:figG01 ~ figG11) +``` + +--- + +## 四、知识库资源说明 + +### 1. `知识库/{3}--资源/` —— 以「机械设计」各章为主 + +天大《机械原理与机械设计》配套课件,编号形式为 `(N)--标题`。要点: + +- **PDF 与 PPT 大量互为同一份内容**(如 `(22)第18章齿轮传动.pdf` = `(95)….ppt`),**抽取文本优先用 PDF**。 +- **机械设计部分**章节齐全(第 13 ~ 26 章): + + | 章 | 文件 | 章 | 文件 | + |---|---|---|---| + | 13 机械零件设计基础 | (17)/(90) | 20 轴的设计计算 | (15)/(88) | + | 14 螺纹联接 | (18)/(91) | 21 滚动轴承 | (14)/(87) | + | 15 轴毂联接 | (19)/(92) | 22 滑动轴承 | (10)/(83) | + | 16 螺旋传动 | (20)/(93) | 23 联轴器 | (12)/(85) | + | 17 带传动和链传动 | (21)/(94) | 24 弹簧 | (13)/(86) | + | 18 齿轮传动 | (22)/(95) | 26 轴系设计 | (11)/(84) | + | 19 蜗杆传动 | (16)/(89) | | | + +- **机械原理部分**在该目录内**课件很少**:仅 `(36)/(97) 第八章 齿轮机构`、`(37~39) 第二章 第一/二/三节`(机构分析),其余为 `(40~53) 绪论/机械史`、`(54~81) 习题试卷`。机械原理的完整讲授课件见下方"补充资源"。 + +### 2. `知识库/补充资源/机械原理PPT/` —— 「机械原理」全套课件 00~11 ★ + +**补齐了机械原理的全部章节**,编号与考试大纲逐条对应: + +| 文件 | 对应考纲条目 | +|---|---| +| `00 绪论.ppt` | (绪论) | +| `01 机构的结构分析.ppt` | ① 机构的组成和结构分析 | +| `02 平面机构的运动分析.ppt` | ② 平面机构的运动分析 | +| `03 平面机构的力分析.ppt` | ③ 平面机构的力分析 | +| `04 机械的平衡.ppt` | ⑩ 机械的平衡 | +| `05 平面连杆机构及其设计.ppt` | ④ 平面连杆机构及其设计 | +| `06 凸轮机构及其设计.ppt` | ⑤ 凸轮机构及其设计 | +| `07 齿轮机构及其设计.ppt` | ⑥ 齿轮机构及其设计 | +| `08 齿轮系及其设计.ppt` | ⑦ 轮系及其设计 | +| `09 其它常用机构和组合机构.ppt` | ⑧ 其他常用机构 | +| `10 机械的运转与速度波动的调速.ppt` | ⑨ 机器的运转和调速 | +| `11 机械传动系统方案设计.ppt` | (传动系统方案设计) | + +> ⚠️ `.ppt` 为**老式 OLE2 二进制格式**,纯 Python 不易直接解析;抽文本时建议先转成 `.pptx`(PowerPoint/WPS 另存为,或让课程方提供 `.pptx` 版)。本项目整理轮系时即使用 `08 齿轮系及其设计.pptx`。 + +### 3. 版权 + +以上课件均为教材配套教学资源,版权归天大教研室 / 机械工业出版社,**仅作个人考研复习用**,请勿传播或商用。 + +--- + +## 五、工作流(本项目标准流程) + +1. **字幕 → 笔记**:`.srt` 去时间轴 → 分段 → 提取正文 → 纠正同音错字 → 结构化整理。 +2. **课件 → 笔记**: + - `.pdf` → PyMuPDF(`page.get_text("text")`)抽文本; + - `.pptx` → 用 `tencent-pptx` skill 或 python-pptx 逐页导出文本框内容; + - `.ppt`(老式二进制)→ **先转 `.pptx`** 再抽。 +3. **配图**:用 `笔记/images/` 下的脚本**程序化生成**(matplotlib/numpy 几何精确作图,**禁止 AI 扩散式生图**),300 dpi,图片以相对路径嵌入笔记。 +4. **出题**:按 **判断题 + 简答/分析题 + 计算题** 三类,**题目卷与答案卷分离**为两份文件。 + +### 环境与工具 + +- 托管 venv:`C:\Users\Wang Ling\.workbuddy\binaries\python\envs\default`(已装 `pymupdf`、`matplotlib`、`numpy`) +- 装包需走代理:`export http_proxy=http://127.0.0.1:7897 https_proxy=http://127.0.0.1:7897` +- 注意:numpy 2.x 下 `float(np.array([x]))` 会报错,且 `float()` 不能作用于 1 维数组;PyMuPDF 新包名为 `import pymupdf as fitz`。 +- 已装 skill:`matplotlib`(用户级 `~/.workbuddy/skills/matplotlib`)。 + +--- + +## 六、复习进度 + +| 模块 | 知识点笔记 | 配图 | 练习(题目/答案) | 状态 | +|---|---|---|---|---| +| 机械原理·齿轮机构(第八章) | ✅ | ✅ 12 张 | ✅ | **已完成** | +| 机械设计·齿轮传动(第18章) | ✅(并入"知识库整合"一份) | ✅ | ✅ | **已完成** | +| 机械原理·轮系(齿轮系及其设计) | ✅ | ✅ 11 张 | ⬜ | 知识点完成,练习待做 | +| 机械原理·其余章节 | ⬜ | ⬜ | ⬜ | 未开始(课件已备:补充资源 01~06、09~11) | +| 机械设计·第 13~26 章 | ⬜ | ⬜ | ⬜ | 未开始(课件已备:蜗杆传动等) | + +> **说明**:齿轮部分(机械原理第八章 + 机械设计第18章)合并整理为 `笔记/知识点-齿轮(知识库整合).md`(含 12 张程序化配图);轮系为 `笔记/知识点-轮系(齿轮系及其设计).md`(含 11 张程序化配图)。 + +--- + +## 七、命名与格式约定 + +- 知识点笔记:`知识点-XXX.md` +- 练习:`练习-XXX-题目卷.md` + `练习-XXX-答案卷.md`(**答案与题目必须分离**) +- 图片:`笔记/images/figNN_描述.png`(齿轮)/ `figGNN_描述.png`(轮系),脚本自包含、可一键重生成 +- 本库为 Obsidian 仓库,笔记间可用 `[[双链]]` 互联 diff --git a/欢迎.md b/欢迎.md new file mode 100644 index 0000000..034ec91 --- /dev/null +++ b/欢迎.md @@ -0,0 +1,5 @@ +这是你的新*仓库*。 + +写点笔记,[[创建链接]],或者试一试[导入器](https://help.obsidian.md/Plugins/Importer)插件! + +当你准备好了,就将该笔记文件删除,使这个仓库为你所用。 \ No newline at end of file diff --git a/笔记/images/fig01_involute_form.png b/笔记/images/fig01_involute_form.png new file mode 100644 index 0000000..70da464 Binary files /dev/null and b/笔记/images/fig01_involute_form.png differ diff --git a/笔记/images/fig02_pressure_angle.png b/笔记/images/fig02_pressure_angle.png new file mode 100644 index 0000000..bd95be6 Binary files /dev/null and b/笔记/images/fig02_pressure_angle.png differ diff --git a/笔记/images/fig03_gear_parts.png b/笔记/images/fig03_gear_parts.png new file mode 100644 index 0000000..3075ac6 Binary files /dev/null and b/笔记/images/fig03_gear_parts.png differ diff --git a/笔记/images/fig04_pitch_law.png b/笔记/images/fig04_pitch_law.png new file mode 100644 index 0000000..279591e Binary files /dev/null and b/笔记/images/fig04_pitch_law.png differ diff --git a/笔记/images/fig05_mesh_line.png b/笔记/images/fig05_mesh_line.png new file mode 100644 index 0000000..95ff729 Binary files /dev/null and b/笔记/images/fig05_mesh_line.png differ diff --git a/笔记/images/fig06_contact_ratio.png b/笔记/images/fig06_contact_ratio.png new file mode 100644 index 0000000..ef606ab Binary files /dev/null and b/笔记/images/fig06_contact_ratio.png differ diff --git a/笔记/images/fig07_undercut.png b/笔记/images/fig07_undercut.png new file mode 100644 index 0000000..c631824 Binary files /dev/null and b/笔记/images/fig07_undercut.png differ diff --git a/笔记/images/fig08_modification.png b/笔记/images/fig08_modification.png new file mode 100644 index 0000000..9819857 Binary files /dev/null and b/笔记/images/fig08_modification.png differ diff --git a/笔记/images/fig09_helical.png b/笔记/images/fig09_helical.png new file mode 100644 index 0000000..8aca027 Binary files /dev/null and b/笔记/images/fig09_helical.png differ diff --git a/笔记/images/fig10_bevel.png b/笔记/images/fig10_bevel.png new file mode 100644 index 0000000..871e141 Binary files /dev/null and b/笔记/images/fig10_bevel.png differ diff --git a/笔记/images/fig11_worm.png b/笔记/images/fig11_worm.png new file mode 100644 index 0000000..85cc7b9 Binary files /dev/null and b/笔记/images/fig11_worm.png differ diff --git a/笔记/images/fig12_force.png b/笔记/images/fig12_force.png new file mode 100644 index 0000000..7bf3ae3 Binary files /dev/null and b/笔记/images/fig12_force.png differ diff --git a/笔记/images/figG01_geartrain_class.png b/笔记/images/figG01_geartrain_class.png new file mode 100644 index 0000000..77fba08 Binary files /dev/null and b/笔记/images/figG01_geartrain_class.png differ diff --git a/笔记/images/figG02_fixed_train.png b/笔记/images/figG02_fixed_train.png new file mode 100644 index 0000000..9bc9f9e Binary files /dev/null and b/笔记/images/figG02_fixed_train.png differ diff --git a/笔记/images/figG03_direction.png b/笔记/images/figG03_direction.png new file mode 100644 index 0000000..2b829dc Binary files /dev/null and b/笔记/images/figG03_direction.png differ diff --git a/笔记/images/figG04_epicyclic.png b/笔记/images/figG04_epicyclic.png new file mode 100644 index 0000000..83a943b Binary files /dev/null and b/笔记/images/figG04_epicyclic.png differ diff --git a/笔记/images/figG05_inversion.png b/笔记/images/figG05_inversion.png new file mode 100644 index 0000000..945e45e Binary files /dev/null and b/笔记/images/figG05_inversion.png differ diff --git a/笔记/images/figG06_formula.png b/笔记/images/figG06_formula.png new file mode 100644 index 0000000..e43760b Binary files /dev/null and b/笔记/images/figG06_formula.png differ diff --git a/笔记/images/figG07_composite.png b/笔记/images/figG07_composite.png new file mode 100644 index 0000000..cef275c Binary files /dev/null and b/笔记/images/figG07_composite.png differ diff --git a/笔记/images/figG08_functions.png b/笔记/images/figG08_functions.png new file mode 100644 index 0000000..f73ae88 Binary files /dev/null and b/笔记/images/figG08_functions.png differ diff --git a/笔记/images/figG09_differential.png b/笔记/images/figG09_differential.png new file mode 100644 index 0000000..519349f Binary files /dev/null and b/笔记/images/figG09_differential.png differ diff --git a/笔记/images/figG10_assembly.png b/笔记/images/figG10_assembly.png new file mode 100644 index 0000000..8c48477 Binary files /dev/null and b/笔记/images/figG10_assembly.png differ diff --git a/笔记/images/figG11_small_diff.png b/笔记/images/figG11_small_diff.png new file mode 100644 index 0000000..4adbcc3 Binary files /dev/null and b/笔记/images/figG11_small_diff.png differ diff --git a/笔记/images/gen_figures.py b/笔记/images/gen_figures.py new file mode 100644 index 0000000..0b9e619 --- /dev/null +++ b/笔记/images/gen_figures.py @@ -0,0 +1,754 @@ +# -*- coding: utf-8 -*- +""" +《知识点-齿轮》配图生成脚本 +- 全部为**几何/数学作图**(渐开线方程、齿廓展成、摆线包络、受力分解…),非生成式 AI。 +- 参照 matplotlib skill:OO 接口、300 dpi、留白构图、注释框避让、引线标注。 +运行:python gen_figures.py → 同目录输出 figXX_*.png +""" +import os +import numpy as np +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +from matplotlib.patches import Polygon, Arc + +for fp in [r"C:/Windows/Fonts/simhei.ttf", r"C:/Windows/Fonts/msyh.ttc"]: + if os.path.exists(fp): + try: + matplotlib.font_manager.fontManager.addfont(fp) + except Exception: + pass +plt.rcParams.update({ + "font.sans-serif": ["SimHei", "Microsoft YaHei"], + "axes.unicode_minus": False, + "savefig.bbox": "tight", + "figure.facecolor": "white", + "savefig.facecolor": "white", +}) + +OUT = os.path.dirname(os.path.abspath(__file__)) +DPI = 300 + +C_MAIN = "#1a1a1a" +C_BLUE = "#1f6fb2" +C_RED = "#d62728" +C_GREEN = "#2ca02c" +C_ORANGE = "#e6791b" +C_PURPLE = "#8e44ad" +C_GRAY = "#9a9a9a" + + +def inv(a): + return np.tan(a) - a + + +def new_ax(w=7.6, h=5.6): + fig, ax = plt.subplots(figsize=(w, h)) + ax.set_aspect("equal") + ax.axis("off") + return fig, ax + + +def save(fig, name): + fig.savefig(os.path.join(OUT, name), dpi=DPI) + plt.close(fig) + print("saved:", name) + + +def arc(cx, cy, r, a0, a1, n=240): + t = np.radians(np.linspace(a0, a1, n)) + return cx + r * np.cos(t), cy + r * np.sin(t) + + +def note(ax, x, y, s, fs=11, ha="left", va="top", ec="#d5d5d5", fc="white"): + ax.text(x, y, s, fontsize=fs, ha=ha, va=va, zorder=10, linespacing=1.6, + bbox=dict(boxstyle="round,pad=0.45", fc=fc, ec=ec, alpha=0.96)) + + +# ===================================================================== +# 渐开线 / 齿廓 生成 +# ===================================================================== +def gear_profile(z, m, alpha_deg=20.0, x=0.0, ha_star=1.0, c_star=0.25, + nf=60, one_tooth=None): + """渐开线直齿圆柱齿轮齿廓点集。one_tooth 指定则只生成单个齿。""" + z = int(round(z)) + a = np.radians(alpha_deg) + r = m * z / 2.0 + rb = r * np.cos(a) + ra = r + (ha_star + x) * m + rf = r - (ha_star + c_star - x) * m + s = np.pi * m / 2 + 2 * x * m * np.tan(a) + inva = inv(a) + hp = s / (2 * r) + + def half_ang(rk): + rk = np.maximum(rk, rb) + ak = np.arccos(np.clip(rb / rk, -1, 1)) + return hp - (inv(ak) - inva) + + r0 = max(rb, rf) + h0 = float(np.asarray(half_ang(r0)).reshape(())) + hA = float(np.asarray(half_ang(ra)).reshape(())) + idxs = range(z) if one_tooth is None else [one_tooth] + pts = [] + for i in idxs: + phi = 2 * np.pi * i / z + pts.append((rf * np.cos(phi - h0), rf * np.sin(phi - h0))) + rk = np.linspace(r0, ra, nf) + ang = phi - half_ang(rk) + pts += list(zip(rk * np.cos(ang), rk * np.sin(ang))) + for aa in np.linspace(phi - hA, phi + hA, 12)[1:]: + pts.append((ra * np.cos(aa), ra * np.sin(aa))) + rk = np.linspace(ra, r0, nf) + ang = phi + half_ang(rk) + pts += list(zip(rk * np.cos(ang), rk * np.sin(ang))) + phin = 2 * np.pi * (i + 1) / z + for aa in np.linspace(phi + h0, phin - h0, 12)[1:]: + pts.append((rf * np.cos(aa), rf * np.sin(aa))) + return np.array(pts) + + +# ===================================================================== +# 图1 渐开线的形成 +# ===================================================================== +def fig01(): + rb = 1.0 + ts = np.linspace(0, 1.25, 600) + x = rb * (np.cos(ts) + ts * np.sin(ts)) + y = rb * (np.sin(ts) - ts * np.cos(ts)) + fig, ax = new_ax(7.6, 5.8) + ax.plot(*arc(0, 0, rb, 0, 360), color=C_MAIN, lw=1.8) + ax.plot(x, y, color=C_BLUE, lw=2.6) + ax.plot(0, 0, "ko", ms=5) + ax.text(0.03, -0.16, "O", fontsize=13) + ax.plot([0, rb], [0, 0], "k--", lw=1.0) + ax.text(rb * 0.45, -0.16, r"$r_b$", fontsize=14) + ax.plot(rb, 0, "o", color=C_RED, ms=6) + ax.text(rb + 0.04, -0.06, "A", color=C_RED, fontsize=13) + + t0 = 0.95 + Bx, By = rb * np.cos(t0), rb * np.sin(t0) + Kx = rb * (np.cos(t0) + t0 * np.sin(t0)) + Ky = rb * (np.sin(t0) - t0 * np.cos(t0)) + ax.plot([Bx, Kx], [By, Ky], color=C_GREEN, lw=2.2) + ax.plot([0, Bx], [0, By], "k--", lw=0.9) + ax.plot([0, Kx], [0, Ky], color=C_MAIN, lw=1.0) + ax.plot(Bx, By, "o", color=C_GREEN, ms=6) + ax.text(Bx - 0.02, By + 0.09, "B", color=C_GREEN, fontsize=13) + ax.plot(Kx, Ky, "o", color=C_RED, ms=6) + ax.text(Kx + 0.04, Ky + 0.03, "K", color=C_RED, fontsize=13) + ax.text(Kx * 0.5 + 0.05, Ky * 0.5 + 0.06, r"$r_K$", fontsize=13) + + angK = np.degrees(np.arctan2(Ky, Kx)) + ax.add_patch(Arc((0, 0), 0.66, 0.66, theta1=0, theta2=angK, + color=C_PURPLE, lw=1.6)) + ax.text(0.37, 0.07, r"$\theta_K$", color=C_PURPLE, fontsize=14) + n_ang = np.degrees(np.arctan2(By - Ky, Bx - Kx)) + v_ang = np.degrees(np.arctan2(Kx, -Ky)) + ax.add_patch(Arc((Kx, Ky), 0.46, 0.46, theta1=min(n_ang, v_ang), + theta2=max(n_ang, v_ang), color=C_ORANGE, lw=1.6)) + ax.text(Kx - 0.16, Ky + 0.10, r"$\alpha_K$", color=C_ORANGE, fontsize=14) + + ax.text(1.22, 1.18, "渐开线", color=C_BLUE, fontsize=13) + ax.text(0.60, 0.60, "发生线", color=C_GREEN, fontsize=13, rotation=38) + ax.text(-0.98, 0.30, "基圆", color=C_MAIN, fontsize=13) + note(ax, -1.15, -0.55, + "发生线沿基圆纯滚动时,\n其上一点的轨迹即为该基圆的渐开线\n" + r"$\theta_K=\tan\alpha_K-\alpha_K=\mathrm{inv}\,\alpha_K$", fs=10.5) + ax.set_xlim(-1.25, 2.25) + ax.set_ylim(-1.35, 1.75) + save(fig, "fig01_involute_form.png") + + +# ===================================================================== +# 图2 压力角随半径变化 +# ===================================================================== +def fig02(): + rb = 1.0 + ts = np.linspace(0, 1.0, 500) + x = rb * (np.cos(ts) + ts * np.sin(ts)) + y = rb * (np.sin(ts) - ts * np.cos(ts)) + fig, ax = new_ax(7.6, 5.6) + ax.plot(*arc(0, 0, rb, 0, 360), color=C_MAIN, lw=1.8) + ax.plot(x, y, color=C_BLUE, lw=2.6) + ax.plot(0, 0, "ko", ms=5) + ax.text(0.04, -0.17, "O", fontsize=13) + labs = [(0.35, r"$\alpha=19^\circ$", -0.62), + (0.60, r"$\alpha=31^\circ$", 0.0), + (0.85, r"$\alpha=40^\circ$", 0.62)] + for tt, lab, dy in labs: + Bx, By = rb * np.cos(tt), rb * np.sin(tt) + Kx = rb * (np.cos(tt) + tt * np.sin(tt)) + Ky = rb * (np.sin(tt) - tt * np.cos(tt)) + ax.plot([Bx, Kx], [By, Ky], color=C_GRAY, lw=1.0, ls=":") + ax.plot([0, Kx], [0, Ky], color=C_GRAY, lw=0.8) + ax.plot(Kx, Ky, "o", color=C_RED, ms=5, zorder=5) + ax.annotate(lab, xy=(Kx, Ky), xytext=(1.98, 0.05 + dy), fontsize=11.5, + color=C_ORANGE, va="center", + arrowprops=dict(arrowstyle="-", color=C_ORANGE, lw=0.8, ls=":")) + note(ax, -1.28, 1.62, "齿廓上各点压力角不同:\n" + "基圆上 $\\alpha_b=0$,越远离基圆压力角越大", fs=10.5) + ax.text(-1.05, -0.30, "基圆", color=C_MAIN, fontsize=13) + ax.text(-1.05, -0.50, r"$\alpha_b=0$", color=C_MAIN, fontsize=12) + ax.set_xlim(-1.35, 2.75) + ax.set_ylim(-1.05, 1.95) + save(fig, "fig02_pressure_angle.png") + + +# ===================================================================== +# 图3 齿轮各部分名称(四圆三高) +# ===================================================================== +def fig03(): + z, m = 18, 1.0 + al = np.radians(20) + r = m * z / 2 + rb = r * np.cos(al) + ra = r + m + rf = r - 1.25 * m + fig, ax = new_ax(8.2, 6.6) + ax.add_patch(Polygon(gear_profile(z, m), closed=True, facecolor="#eef3f8", + edgecolor=C_MAIN, lw=1.2, zorder=2)) + ax.plot(*arc(0, 0, ra, 0, 360), color=C_GREEN, lw=1.5, zorder=3) + ax.plot(*arc(0, 0, r, 0, 360), color=C_ORANGE, lw=1.7, ls="-.", zorder=3) + ax.plot(*arc(0, 0, rb, 0, 360), color=C_BLUE, lw=1.3, zorder=3) + ax.plot(*arc(0, 0, rf, 0, 360), color=C_RED, lw=1.3, ls="--", zorder=3) + ax.plot(0, 0, "k+", ms=9) + # 全齿高 h + ang = np.radians(82) + ce, se = np.cos(ang), np.sin(ang) + ax.annotate("", xy=(ra * ce, ra * se), xytext=(rf * ce, rf * se), + arrowprops=dict(arrowstyle="<->", color=C_MAIN, lw=1.2)) + ax.text(ra * ce + 0.55, (ra + rf) / 2 * se - 0.1, r"$h$", fontsize=14) + # 四圆数值 + tags = [(ra, C_GREEN, r"$d_a=20$", 90), + (r, C_ORANGE, r"$d=18$", 145), + (rb, C_BLUE, r"$d_b=16.91$", 178), + (rf, C_RED, r"$d_f=15.5$", 212)] + for rad, col, lab, deg in tags: + aa = np.radians(deg) + p0 = np.array([rad * np.cos(aa), rad * np.sin(aa)]) + p1 = np.array([(rad + 2.4) * np.cos(aa), (rad + 2.4) * np.sin(aa)]) + ax.plot(*p0, "o", color=col, ms=4) + ax.plot([p0[0], p1[0]], [p0[1], p1[1]], color=col, lw=0.9, ls=":") + if abs(deg - 90) < 1: + ax.text(p1[0], p1[1] + 0.35, lab, color=col, fontsize=12, ha="center") + elif deg in (178, 212): + ax.text(p1[0] - 0.25, p1[1], lab, color=col, fontsize=12, ha="right") + else: + ax.text(p1[0] + 0.25, p1[1] + 0.2, lab, color=col, fontsize=12, ha="left") + note(ax, -ra - 3.2, -ra - 0.3, + "四圆:齿顶圆 $d_a$、分度圆 $d$、基圆 $d_b$、齿根圆 $d_f$\n" + "三高:齿顶高 $h_a$、齿根高 $h_f$、全齿高 $h=h_a+h_f$\n" + "齿距 $p=\\pi m$;齿厚 $s=\\pi m/2$;齿槽宽 $e=\\pi m/2$", fs=11.5) + ax.set_xlim(-ra - 3.4, ra + 3.4) + ax.set_ylim(-ra - 3.6, ra + 2.2) + save(fig, "fig03_gear_parts.png") + + +# ===================================================================== +# 图4 齿廓啮合基本定律 +# ===================================================================== +def mesh_geom(z1, z2, m, alpha_deg=20.0, ha_star=1.0, top=False): + a = np.radians(alpha_deg) + r1, r2 = m * z1 / 2, m * z2 / 2 + A = r1 + r2 + rb1, rb2 = r1 * np.cos(a), r2 * np.cos(a) + ra1, ra2 = r1 + ha_star * m, r2 + ha_star * m + O1 = np.array([0.0, 0.0]) + O2 = np.array([A, 0.0]) + P = np.array([r1, 0.0]) + d = np.array([np.sin(a), np.cos(a)]) + N1 = P + np.dot(O1 - P, d) * d + N2 = P + np.dot(O2 - P, d) * d + sN1, sN2 = np.dot(O1 - P, d), np.dot(O2 - P, d) + + def line_circle(c, R): + f = P - c + B = 2 * np.dot(f, d) + C = np.dot(f, f) - R * R + disc = B * B - 4 * C + if disc < 0: + return [] + return [(-B - np.sqrt(disc)) / 2, (-B + np.sqrt(disc)) / 2] + + def pick(c, R): + cand = [s for s in line_circle(c, R) if min(sN1, sN2) - 1e-9 <= s <= max(sN1, sN2) + 1e-9] + s = cand[0] if cand else line_circle(c, R)[0] + return P + s * d + + B1 = pick(O1, ra1) + B2 = pick(O2, ra2) + return dict(r1=r1, r2=r2, A=A, rb1=rb1, rb2=rb2, ra1=ra1, ra2=ra2, O1=O1, + O2=O2, P=P, d=d, N1=N1, N2=N2, B1=B1, B2=B2) + + +def fig04(): + g = mesh_geom(20, 30, 1.0) + r1, r2, A, d = g["r1"], g["r2"], g["A"], g["d"] + fig, ax = new_ax(8.4, 5.8) + ax.plot([-4, A + 4], [0, 0], color=C_MAIN, lw=1.1, ls="--", zorder=1) + ax.plot(*arc(0, 0, r1, -150, 150), color=C_ORANGE, lw=1.5, ls="-.", zorder=2) + ax.plot(*arc(A, 0, r2, 30, 330), color=C_ORANGE, lw=1.5, ls="-.", zorder=2) + ax.plot(*arc(0, 0, g["rb1"], -150, 150), color=C_BLUE, lw=1.2, zorder=2) + ax.plot(*arc(A, 0, g["rb2"], 30, 330), color=C_BLUE, lw=1.2, zorder=2) + L = np.linspace(-4.0, 6.5, 2) + ax.plot(g["N1"][0] + L * d[0], g["N1"][1] + L * d[1], color=C_GREEN, lw=1.9, zorder=3) + for O, N, lab in [(g["O1"], g["N1"], "$N_1$"), (g["O2"], g["N2"], "$N_2$")]: + ax.plot([O[0], N[0]], [O[1], N[1]], color=C_BLUE, lw=0.9, ls=":", zorder=2) + ax.plot(*N, "o", color=C_BLUE, ms=6, zorder=4) + ax.text(g["N1"][0] - 0.4, g["N1"][1] - 1.3, "$N_1$", color=C_BLUE, fontsize=14) + ax.text(g["N2"][0] + 0.3, g["N2"][1] + 0.3, "$N_2$", color=C_BLUE, fontsize=14) + ax.plot(*g["P"], "o", color=C_RED, ms=8, zorder=4) + ax.text(g["P"][0] + 0.3, g["P"][1] - 1.4, "P", color=C_RED, fontsize=15) + for O, lab in [(g["O1"], "$O_1$"), (g["O2"], "$O_2$")]: + ax.plot(*O, "ko", ms=5, zorder=4) + ax.text(O[0] - 0.1, O[1] - 1.4, lab, fontsize=14) + ax.add_patch(Arc((g["P"][0], g["P"][1]), 3.4, 3.4, theta1=90, + theta2=np.degrees(np.arctan2(d[1], d[0])), + color=C_PURPLE, lw=1.6)) + ax.text(g["P"][0] - 0.2, g["P"][1] + 2.6, r"$\alpha'$", color=C_PURPLE, fontsize=15) + ax.text(r1 / 2 - 0.2, -2.9, r"$O_1P$", fontsize=13) + ax.text(r1 + r2 / 2 - 0.3, -2.9, r"$O_2P$", fontsize=13) + ax.text(11.6, 1.6, "啮合线 $N_1N_2$", color=C_GREEN, fontsize=12) + ax.text(A / 2 - 3.4, -6.0, "节圆", color=C_ORANGE, fontsize=12) + note(ax, -4.2, 12.4, + "齿廓啮合基本定律\n" + r"$i_{12}=\dfrac{\omega_1}{\omega_2}=\dfrac{O_2P}{O_1P}=$ 常数" "\n" + "过接触点的公法线 $N_1N_2$ 必与连心线交于定点 $P$", fs=11) + ax.set_xlim(-4.5, A + 4.5) + ax.set_ylim(-7.5, 12.8) + save(fig, "fig04_pitch_law.png") + + +# ===================================================================== +# 图5 一对轮齿的啮合过程(实际啮合线 B1B2) +# ===================================================================== +def fig05(): + g = mesh_geom(20, 30, 1.0) + A, d = g["A"], g["d"] + fig, ax = new_ax(8.6, 7.4) + ax.plot([4, A + 4], [0, 0], color=C_MAIN, lw=1.1, ls="--", zorder=1) + # 齿轮1 弧 + ax.plot(*arc(0, 0, g["ra1"], -58, 58), color=C_GREEN, lw=1.3, zorder=2) + ax.plot(*arc(0, 0, g["r1"], -58, 58), color=C_ORANGE, lw=1.3, ls="-.", zorder=2) + ax.plot(*arc(0, 0, g["rb1"], -58, 58), color=C_BLUE, lw=1.1, zorder=2) + # 齿轮2 弧 + ax.plot(*arc(A, 0, g["ra2"], 122, 238), color=C_GREEN, lw=1.3, zorder=2) + ax.plot(*arc(A, 0, g["r2"], 122, 238), color=C_ORANGE, lw=1.3, ls="-.", zorder=2) + ax.plot(*arc(A, 0, g["rb2"], 122, 238), color=C_BLUE, lw=1.1, zorder=2) + # 理论啮合线 + L = np.linspace(-4.4, 6.6, 2) + ax.plot(g["N1"][0] + L * d[0], g["N1"][1] + L * d[1], color=C_GRAY, lw=1.2, + ls=":", zorder=2) + # 实际啮合线 + ax.plot([g["B2"][0], g["B1"][0]], [g["B2"][1], g["B1"][1]], color=C_RED, lw=3.6, + zorder=4, solid_capstyle="round") + for p, lab, dx, dy in [(g["B1"], "$B_1$", 0.25, 0.35), + (g["B2"], "$B_2$", -0.9, -0.2), + (g["N1"], "$N_1$", -0.15, -1.0), + (g["N2"], "$N_2$", 0.25, 0.25)]: + ax.plot(*p, "o", color=C_RED if lab.startswith("$B") else C_BLUE, ms=6, zorder=5) + ax.text(p[0] + dx, p[1] + dy, lab, + color=C_RED if lab.startswith("$B") else C_BLUE, fontsize=14) + ax.plot(*g["P"], "o", color=C_MAIN, ms=6, zorder=5) + ax.text(g["P"][0] + 0.25, g["P"][1] - 0.2, "P", fontsize=14) + ax.text(g["P"][0] - 0.3, -6.2, "节圆", color=C_ORANGE, fontsize=12) + ax.text(12.1, 4.4, "实际啮合线 $B_1B_2$", color=C_RED, fontsize=12.5) + ax.text(g["P"][0] - 0.6, -6.3, "节圆", color=C_ORANGE, fontsize=12) + note(ax, 5.7, 12.7, + "理论啮合线 $N_1N_2$(灰虚线)\n" + "实际啮合线 $B_1B_2\\subset N_1N_2$(红粗线)\n" + "连续传动条件:$B_1B_2\\geq p_b$", fs=11) + ax.set_xlim(5.4, 14.6) + ax.set_ylim(-7.4, 13.1) + save(fig, "fig05_mesh_line.png") + + +# ===================================================================== +# 图6 重合度与单/双齿啮合区 +# ===================================================================== +def fig06(): + eps = 1.45 + pb = 1.0 + L = eps * pb + x0 = 0.0 + xB2, xB1 = x0, x0 + L + xB3, xB4 = x0 + (eps - 1) * pb, x0 + pb + y = 0.0 + fig, ax = new_ax(8.6, 3.4) + ax.add_patch(plt.Rectangle((xB2, y - 0.16), xB3 - xB2, 0.32, + facecolor="#fde3d6", edgecolor="none")) + ax.add_patch(plt.Rectangle((xB4, y - 0.16), xB1 - xB4, 0.32, + facecolor="#fde3d6", edgecolor="none")) + ax.add_patch(plt.Rectangle((xB3, y - 0.16), xB4 - xB3, 0.32, + facecolor="#d9ecf7", edgecolor="none")) + ax.plot([xB2, xB1], [y, y], color=C_MAIN, lw=2.0) + for xp, lab in [(xB2, "$B_2$"), (xB3, "$B_3$"), (xB4, "$B_4$"), (xB1, "$B_1$")]: + ax.plot([xp, xp], [-0.5, 0.5], color=C_MAIN, lw=1.4) + ax.text(xp, 0.62, lab, ha="center", fontsize=14) + for xm, sym in [((xB2 + xB3) / 2, "①"), ((xB3 + xB4) / 2, "②"), + ((xB4 + xB1) / 2, "③")]: + ax.text(xm, -0.40, sym, ha="center", va="top", fontsize=13) + ax.annotate("", xy=(xB2 + pb, 1.0), xytext=(xB2, 1.0), + arrowprops=dict(arrowstyle="<->", color=C_GREEN, lw=1.3)) + ax.text(xB2 + pb / 2, 1.08, "$p_b$", ha="center", color=C_GREEN, fontsize=13) + ax.annotate("", xy=(xB2, 1.6), xytext=(xB1, 1.6), + arrowprops=dict(arrowstyle="<->", color=C_RED, lw=1.5)) + ax.text((xB2 + xB1) / 2, 1.70, + r"$B_1B_2=\varepsilon_\alpha p_b=%.2fp_b$" % eps, ha="center", + color=C_RED, fontsize=13) + note(ax, xB2 - 0.15, -1.30, + r"①③ 双齿区:$L_2=2(\varepsilon_\alpha-1)p_b=%.2fp_b$" % (2 * (eps - 1)) + + "\n" + r"② 单齿区:$L_1=(2-\varepsilon_\alpha)p_b=%.2fp_b$" % (2 - eps), + fs=11) + ax.set_xlim(xB2 - 0.7, xB1 + 0.7) + ax.set_ylim(-2.6, 2.2) + save(fig, "fig06_contact_ratio.png") + + +# ===================================================================== +# 图7 根切(齿条刀具展成 + 摆线包络) +# ===================================================================== +def fig07(): + m, z = 1.0, 10 + ad = np.radians(20) + ha, c = 1.0, 0.25 + r = m * z / 2 + rb = r * np.cos(ad) + ra = r + ha * m + rf = r - (ha + c) * m + ha_t = (ha + c) * m + w_pitch = np.pi * m / 4 + w_tip = w_pitch - ha_t * np.tan(ad) + fig, ax = new_ax(7.8, 6.2) + ax.add_patch(Polygon(gear_profile(z, m), closed=True, facecolor="#f7f7f7", + edgecolor=C_MAIN, lw=1.3, zorder=2)) + ax.plot(*arc(0, 0, rb, 0, 360), color=C_BLUE, lw=1.2, zorder=3) + ax.plot(*arc(0, 0, r, 0, 360), color=C_ORANGE, lw=1.1, ls="-.", zorder=3) + # 滚刀齿条(齿顶朝下):仅画两个刀齿 + top = r + ha + for xoff in (0.0, np.pi): + tooth = np.array([(xoff - w_pitch - ha * np.tan(ad), top), + (xoff + w_pitch + ha * np.tan(ad), top), + (xoff + w_tip, r - ha_t), + (xoff - w_tip, r - ha_t)]) + ax.add_patch(Polygon(tooth, closed=True, facecolor="#eaeaea", + edgecolor=C_GRAY, lw=1.2, zorder=5)) + # 摆线包络(齿顶圆角切出的齿根过渡曲线) + phis = np.linspace(-0.62, 0.62, 600) + for k in (-1, 0, 1): + for sgn in (+1, -1): + xi0 = sgn * w_tip + k * np.pi * m + Gx = np.cos(phis) * (xi0 - r * phis) + np.sin(phis) * (r - ha_t) + Gy = -np.sin(phis) * (xi0 - r * phis) + np.cos(phis) * (r - ha_t) + ax.plot(Gx, Gy, color=C_RED, lw=1.3, ls="--", zorder=6) + # 啮合线、N1、B2 + u = np.array([np.cos(ad), -np.sin(ad)]) + P = np.array([0.0, r]) + sN1 = np.dot(-P, u) + N1 = P + sN1 * u + sB2 = (rf - r) / u[1] + B2 = P + sB2 * u + L = np.linspace(-1.5, 6.0, 2) + ax.plot(P[0] + L * u[0], P[1] + L * u[1], color=C_GREEN, lw=1.6, ls=":", zorder=4) + ax.plot(*N1, "o", color=C_BLUE, ms=6, zorder=7) + ax.text(N1[0] + 0.05, N1[1] + 0.55, "$N_1$", color=C_BLUE, fontsize=13) + ax.plot(*B2, "o", color=C_RED, ms=6, zorder=7) + ax.text(B2[0] + 0.28, B2[1] + 0.15, "$B_2$", color=C_RED, fontsize=13) + ax.plot(*P, "o", color=C_MAIN, ms=6, zorder=7) + ax.text(P[0] - 0.7, P[1] - 0.1, "$P$", fontsize=13) + ax.plot(0, 0, "k+", ms=8) + note(ax, -6.6, 11.7, + "红色虚线:齿条刀齿顶圆角切出的齿根过渡曲线\n" + r"$z=10PN_1$)→ 齿根被多切去一块 = 根切", fs=10.5) + ax.text(4.3, 6.3, "齿条刀具", color=C_GRAY, fontsize=11.5) + ax.set_xlim(-6.8, 6.8) + ax.set_ylim(-6.6, 12.1) + save(fig, "fig07_undercut.png") + + +# ===================================================================== +# 图8 变位齿轮齿形对比(同一齿位叠加) +# ===================================================================== +def fig08(): + z, m = 18, 1.0 + al = np.radians(20) + r = m * z / 2 + rb = r * np.cos(al) + fig, ax = new_ax(7.8, 5.6) + ax.plot(*arc(0, 0, rb, -60, 60), color=C_BLUE, lw=1.3, ls="--", zorder=2) + ax.plot(*arc(0, 0, r, -45, 45), color=C_ORANGE, lw=1.5, ls="-.", zorder=2) + specs = [(-0.6, C_GREEN, "负变位 $x=-0.6$"), (0.0, C_MAIN, "标准 $x=0$"), + (0.6, C_RED, "正变位 $x=+0.6$")] + for x, col, lab in specs: + p = gear_profile(z, m, x=x, one_tooth=0) + ax.plot(p[:, 0], p[:, 1], color=col, lw=1.9, label=lab, zorder=3) + ax.plot(0, 0, "k+", ms=9) + ax.annotate("", xy=(r * np.cos(np.radians(6)), r * np.sin(np.radians(6))), + xytext=(r * np.cos(np.radians(-6)), r * np.sin(np.radians(-6))), + arrowprops=dict(arrowstyle="<->", color=C_PURPLE, lw=1.3)) + ax.text(9.3, -2.7, "分度圆齿厚 $s$", color=C_PURPLE, fontsize=11.5) + note(ax, -6.6, 5.2, + "同一个基圆 → 同一条渐开线的不同段\n" + r"$s=\dfrac{\pi m}{2}+2xm\tan\alpha$" "\n" + "正变位:齿厚增宽、齿槽变窄、齿顶高增大\n" + "负变位:齿厚变窄、齿槽变宽、齿顶高减小", fs=11) + ax.legend(loc="lower left", fontsize=11, framealpha=0.95) + ax.set_xlim(-6.8, 11.8) + ax.set_ylim(-4.2, 5.6) + save(fig, "fig08_modification.png") + + +# ===================================================================== +# 图9 斜齿轮:螺旋角与法面/端面参数 +# ===================================================================== +def fig09(): + fig, axes = plt.subplots(1, 2, figsize=(9.8, 4.6)) + ax1, ax2 = axes + for ax in axes: + ax.set_aspect("equal") + ax.axis("off") + R, H = 1.0, 2.4 + ax1.plot(R * np.cos(np.linspace(0, 2 * np.pi, 240)), + 0.22 * np.sin(np.linspace(0, 2 * np.pi, 240)) + H / 2, + color=C_MAIN, lw=1.2) + ax1.plot(R * np.cos(np.linspace(0, 2 * np.pi, 240)), + 0.22 * np.sin(np.linspace(0, 2 * np.pi, 240)) - H / 2, + color=C_MAIN, lw=1.2) + ax1.plot([R, R], [-H / 2, H / 2], color=C_MAIN, lw=1.2) + ax1.plot([-R, -R], [-H / 2, H / 2], color=C_MAIN, lw=1.2) + tt = np.linspace(-np.pi / 2, 3 * np.pi / 2, 400) + hx = R * np.cos(tt) + hy = -H / 2 + H * (tt + np.pi / 2) / (2 * np.pi) + msk = (hy >= -H / 2 - 1e-9) & (hy <= H / 2 + 1e-9) + ax1.plot(hx[msk], hy[msk], color=C_BLUE, lw=2.4) + ax1.plot([0, 0], [-H / 2, H / 2], color=C_GRAY, lw=1.0, ls="--") + ax1.text(0.12, H / 2 + 0.18, "分度圆柱", fontsize=11) + ax1.text(-0.15, -H / 2 - 0.45, "螺旋线", color=C_BLUE, fontsize=11) + ax1.set_title("(a) 分度圆柱面上的螺旋线", fontsize=11.5) + ax1.set_xlim(-1.8, 1.9) + ax1.set_ylim(-H / 2 - 0.8, H / 2 + 0.7) + + beta = np.radians(20) + pd = 3.2 + H2 = pd / np.tan(beta) + ax2.plot([0, pd, pd, 0, 0], [0, 0, H2, H2, 0], color=C_MAIN, lw=1.4) + ax.plot([0, pd], [0, H2], color=C_BLUE, lw=2.4) + ax.text(pd * 0.5, -0.55, r"$\pi d$", color=C_MAIN, fontsize=13, ha="center") + ax.text(pd * 0.5, H2 + 0.16, r"$l$", color=C_MAIN, fontsize=13, ha="center") + ax2.add_patch(Arc((0, 0), 2.4, 2.4, theta1=0, theta2=np.degrees(beta), + color=C_PURPLE, lw=1.6)) + ax2.text(1.28, 0.52, r"$\beta$", color=C_PURPLE, fontsize=14) + Pn = np.array([0.7, 0.7 * np.tan(beta)]) + ax2.plot([Pn[0], Pn[0] + 0.85 * np.cos(beta + np.pi / 2)], + [Pn[1], Pn[1] + 0.85 * np.sin(beta + np.pi / 2)], color=C_RED, lw=3.2) + ax2.text(0.28, 1.16, r"$p_n$", color=C_RED, fontsize=13) + ax2.plot([Pn[0], Pn[0] + 0.95], [Pn[1], Pn[1]], color=C_GREEN, lw=3.2) + ax2.text(Pn[0] + 0.40, Pn[1] - 0.42, r"$p_t$", color=C_GREEN, fontsize=13) + ax2.text(1.05, H2 * 0.62, + r"$p_n=p_t\cos\beta$" "\n" + r"$m_n=m_t\cos\beta$" "\n" + r"$\tan\alpha_n=\tan\alpha_t\cos\beta$", + fontsize=12.5, va="center") + ax2.set_title("(b) 分度圆柱展开图(法面 / 端面参数)", fontsize=11.5) + ax2.set_xlim(-0.5, pd + 1.8) + ax2.set_ylim(-0.95, H2 + 0.9) + fig.tight_layout() + save(fig, "fig09_helical.png") + + +# ===================================================================== +# 图10 直齿锥齿轮:分度圆锥 / 背锥 / 当量齿轮 +# ===================================================================== +def fig10(): + fig, axes = plt.subplots(1, 2, figsize=(10.0, 4.8)) + ax1, ax2 = axes + for ax in axes: + ax.set_aspect("equal") + ax.axis("off") + d1, d2 = np.radians(35), np.radians(55) + R = 4.0 + C = R * np.array([np.cos(d1), np.sin(d1)]) + ax1.plot([0, R + 0.6], [0, 0], color=C_MAIN, lw=1.1, ls="--") + ax1.plot([0, 0], [0, R + 0.6], color=C_MAIN, lw=1.1, ls="--") + ax1.add_patch(Polygon(np.array([[0, 0], [R * np.cos(d1), R * np.sin(d1)], + [R * np.cos(d1), -R * np.sin(d1)]]), + closed=True, facecolor="#eaf2fb", edgecolor=C_BLUE, lw=1.5)) + ax1.add_patch(Polygon(np.array([[0, 0], [R * np.sin(d2), R * np.cos(d2)], + [-R * np.sin(d2), R * np.cos(d2)]]), + closed=True, facecolor="#fdeee6", edgecolor=C_ORANGE, lw=1.5)) + ax1.plot([0, C[0]], [0, C[1]], color=C_RED, lw=2.2) + ax1.text(2.05, 1.0, r"$R$", color=C_RED, fontsize=13) + ax1.add_patch(Arc((0, 0), 2.2, 2.2, theta1=0, theta2=35, color=C_BLUE, lw=1.4)) + ax1.text(1.30, 0.20, r"$\delta_1$", color=C_BLUE, fontsize=13) + ax1.add_patch(Arc((0, 0), 3.2, 3.2, theta1=35, theta2=90, color=C_ORANGE, lw=1.4)) + ax1.text(0.42, 1.55, r"$\delta_2$", color=C_ORANGE, fontsize=13) + ax1.text(4.55, 0.30, r"$\Sigma=\delta_1+\delta_2=90^\circ$", fontsize=12) + ax1.text(2.35, -2.35, "分度圆锥", color=C_BLUE, fontsize=11) + ax1.set_title("(a) 轴交角 90° 的分度圆锥", fontsize=11.5) + ax1.set_xlim(-2.6, 6.9) + ax1.set_ylim(-3.2, 5.0) + + # (b) 背锥 → 当量齿轮 + L = 4.0 + Cp = L * np.array([np.cos(d1), np.sin(d1)]) + Ov = np.array([L / np.cos(d1), 0.0]) + rv = np.linalg.norm(Cp - Ov) + ax2.plot([0, L + 1.2], [0, 0], color=C_MAIN, lw=1.1, ls="--") + ax2.plot([0, Cp[0]], [0, Cp[1]], color=C_RED, lw=1.8) + ax2.text(1.35, 1.15, "分度圆锥", color=C_RED, fontsize=11) + ax2.add_patch(Arc((0, 0), 2.4, 2.4, theta1=0, theta2=35, color=C_BLUE, lw=1.3)) + ax2.text(1.40, 0.22, r"$\delta$", color=C_BLUE, fontsize=13) + ax2.plot([Cp[0], Ov[0]], [Cp[1], 0], color=C_PURPLE, lw=2.0) + ax2.text(Ov[0] - 0.1, -0.62, "$O_v$", color=C_PURPLE, fontsize=12, ha="right") + ax2.text((Cp[0] + Ov[0]) / 2 + 0.1, Cp[1] / 2 + 0.25, "背锥", color=C_PURPLE, + fontsize=11, rotation=-33) + ax2.add_patch(Arc(Ov, 2 * rv, 2 * rv, theta1=120, theta2=168, + color=C_BLUE, lw=1.6, ls="--")) + ax2.plot(*Cp, "o", color=C_MAIN, ms=5) + ax2.text(Ov[0] - rv - 0.2, rv * 0.72, r"$r_v$", color=C_BLUE, fontsize=13) + note(ax2, -0.3, 4.9, + "把球面齿形向背锥投影并展直\n→ 当量齿轮(齿形相当)\n" + r"$z_v=\dfrac{z}{\cos\delta}$", fs=11) + ax2.set_title("(b) 背锥与当量齿轮", fontsize=11.5) + ax2.set_xlim(-1.6, 7.2) + ax2.set_ylim(-1.6, 5.6) + fig.tight_layout() + save(fig, "fig10_bevel.png") + + +# ===================================================================== +# 图11 蜗杆机构 +# ===================================================================== +def fig11(): + fig, ax = new_ax(9.4, 5.0) + x0, x1, Rw = -3.0, 3.8, 0.75 + ax.plot([x0, x1], [Rw, Rw], color=C_MAIN, lw=1.2) + ax.plot([x0, x1], [-Rw, -Rw], color=C_MAIN, lw=1.2) + for xe in [x0, x1]: + ell = np.linspace(-np.pi / 2, np.pi / 2, 120) + ax.plot(np.full_like(ell, xe), Rw * np.sin(ell), color=C_MAIN, lw=1.1) + tt = np.linspace(0, 4 * np.pi, 500) + hx = np.linspace(x0, x1, 500) + ax.plot(hx, Rw * np.cos(tt), color=C_BLUE, lw=1.9) + ax.plot([x0, x1], [0, 0], color=C_GRAY, lw=0.8, ls="--") + cx, cy, rw = 1.5, 0.0, 1.95 + ax.plot(*arc(cx, cy, rw, 0, 360), color=C_ORANGE, lw=1.6, ls="--") + for i in range(24): + a = 2 * np.pi * i / 24 + ax.plot([cx + rw * np.cos(a), cx + (rw + 0.22) * np.cos(a)], + [cy + rw * np.sin(a), cy + (rw + 0.22) * np.sin(a)], + color=C_ORANGE, lw=1.2) + ax.plot([cx, cx], [cy - rw - 0.7, cy + rw + 0.7], color=C_MAIN, lw=1.1, ls="--") + ax.text(cx + 0.95, cy + rw + 0.35, "蜗轮", color=C_ORANGE, fontsize=12, + ha="center") + ax.text(x0, Rw + 0.75, "蜗杆", color=C_BLUE, fontsize=12) + ax.annotate("", xy=(x1 + 1.0, 0), xytext=(x1 + 0.15, 0), + arrowprops=dict(arrowstyle="->", color=C_MAIN, lw=1.4)) + ax.text(x1 + 0.25, 0.18, r"$\omega_1$", fontsize=12) + ax.annotate("", xy=(cx, cy - rw - 1.05), xytext=(cx, cy - rw + 0.05), + arrowprops=dict(arrowstyle="->", color=C_MAIN, lw=1.4)) + ax.text(cx + 0.18, cy - rw - 1.35, r"$\omega_2$", fontsize=12) + # 导程角 γ1 小图 + bx, by, s = -5.2, 0.9, 1.15 + ax.plot([bx, bx + s], [by, by], color=C_MAIN, lw=1.1) + ax.plot([bx, bx + s * np.cos(np.radians(-54))], + [by, by + s * np.sin(np.radians(-54))], color=C_PURPLE, lw=1.5) + ax.add_patch(Arc((bx, by), 1.3, 1.3, theta1=-54, theta2=0, color=C_PURPLE, lw=1.2)) + ax.text(bx + 0.80, by - 0.08, r"$\gamma_1$", color=C_PURPLE, fontsize=12) + ax.text(bx, by + 0.60, "导程角", color=C_PURPLE, fontsize=10.5) + note(ax, -5.4, 4.3, + "交错角 $\\Sigma=90^\\circ$;传动比 " + r"$i=\dfrac{\omega_1}{\omega_2}=\dfrac{z_2}{z_1}$($z_1$=蜗杆头数)", fs=11) + note(ax, -5.4, -3.7, + "正确啮合:$m_{x1}=m_{t2}=m$,$\\alpha_{x1}=\\alpha_{t2}=\\alpha$," + r"$\gamma_1=\beta_2$" "\n" + "阿基米德蜗杆:轴面内齿形为标准齿条\n(主平面内啮合=齿轮齿条啮合)", fs=10.5) + ax.set_xlim(-5.6, 5.4) + ax.set_ylim(-7.6, 4.7) + save(fig, "fig11_worm.png") + + +# ===================================================================== +# 图12 轮齿受力分析 +# ===================================================================== +def fig12(): + fig, axes = plt.subplots(1, 2, figsize=(10.2, 4.8)) + ax1, ax2 = axes + for ax in axes: + ax.set_aspect("equal") + ax.axis("off") + # (a) 直齿 + r = 2.4 + al = np.radians(20) + ax1.plot(*arc(0, 0, r, -55, 55), color=C_ORANGE, lw=1.5, ls="-.") + ax1.plot(0, 0, "ko", ms=5) + ax1.text(0.08, -0.38, "$O_1$", fontsize=13) + ax1.plot([0, r], [0, 0], color=C_MAIN, lw=1.0, ls="--") + ax1.text(r / 2 - 0.35, -0.38, r"$d_1/2$", fontsize=12) + P = np.array([r, 0]) + Ftv = 3.0 * np.array([0, 1]) + Frv = 3.0 * np.tan(al) * np.array([1, 0]) + Fnvec = Ftv + Frv + ax1.annotate("", xy=P + Ftv, xytext=P, + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=2.2)) + ax1.annotate("", xy=P + Frv, xytext=P, + arrowprops=dict(arrowstyle="-|>", color=C_GREEN, lw=2.2)) + ax1.annotate("", xy=P + Fnvec, xytext=P, + arrowprops=dict(arrowstyle="-|>", color=C_RED, lw=2.4)) + ax1.plot([P[0] + Ftv[0], P[0] + Fnvec[0]], [P[1] + Ftv[1], P[1] + Fnvec[1]], + color=C_GRAY, lw=0.9, ls=":") + ax1.plot([P[0] + Frv[0], P[0] + Fnvec[0]], [P[1] + Frv[1], P[1] + Fnvec[1]], + color=C_GRAY, lw=0.9, ls=":") + ax1.text(*(P + Ftv + np.array([-0.15, 0.05])), "$F_t$", color=C_BLUE, fontsize=14) + ax1.text(*(P + Frv + np.array([0.08, -0.35])), "$F_r$", color=C_GREEN, fontsize=14) + ax1.text(*(P + Fnvec + np.array([0.06, 0.08])), "$F_n$", color=C_RED, fontsize=14) + ax1.add_patch(Arc(P, 1.5, 1.5, theta1=70, theta2=90, color=C_PURPLE, lw=1.4)) + ax1.text(P[0] - 0.55, P[1] + 0.78, r"$\alpha$", color=C_PURPLE, fontsize=13) + ax1.text(-2.9, 4.0, + r"$F_t=\dfrac{2T_1}{d_1}$" "\n" r"$F_r=F_t\tan\alpha$" "\n" + r"$F_n=\dfrac{F_t}{\cos\alpha}$", fontsize=12.5, va="top") + ax1.set_title("(a) 直齿圆柱齿轮", fontsize=11.5) + ax1.set_xlim(-3.2, 4.8) + ax1.set_ylim(-1.6, 4.4) + # (b) 斜齿 + bet = np.radians(18) + Ft = np.array([3.0, 0.0]) + Fa = np.array([0.0, -3.0 * np.tan(bet)]) + Fp = Ft + Fa + ax2.annotate("", xy=Ft, xytext=(0, 0), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=2.2)) + ax2.annotate("", xy=Fa, xytext=(0, 0), + arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=2.2)) + ax2.annotate("", xy=Fp, xytext=(0, 0), + arrowprops=dict(arrowstyle="-|>", color=C_RED, lw=2.4)) + ax2.plot([Ft[0], Fp[0]], [Ft[1], Fp[1]], color=C_GRAY, lw=0.9, ls=":") + ax2.plot([Fa[0], Fp[0]], [Fa[1], Fp[1]], color=C_GRAY, lw=0.9, ls=":") + ax2.text(Ft[0] + 0.06, Ft[1] - 0.4, "$F_t$", color=C_BLUE, fontsize=14) + ax2.text(Fa[0] + 0.12, Fa[1] + 0.05, "$F_a$", color=C_ORANGE, fontsize=14) + ax2.text(Fp[0] - 0.05, Fp[1] + 0.12, "$F'$", color=C_RED, fontsize=14) + ax2.add_patch(Arc((0, 0), 2.2, 2.2, theta1=-np.degrees(bet), theta2=0, + color=C_PURPLE, lw=1.3)) + ax2.text(1.25, -0.28, r"$\beta$", color=C_PURPLE, fontsize=13) + ax2.text(0.05, 2.45, + r"$F'=\dfrac{F_t}{\cos\beta}$" "\n" r"$F_a=F_t\tan\beta$" "\n" + r"$F_r=F'\tan\alpha_n=\dfrac{F_t\tan\alpha_n}{\cos\beta}$", + fontsize=12, va="top") + ax2.set_title("(b) 斜齿圆柱齿轮(法向力分解)", fontsize=11.5) + ax2.set_xlim(-0.7, 5.2) + ax2.set_ylim(-1.5, 2.95) + fig.tight_layout() + save(fig, "fig12_force.png") + + +if __name__ == "__main__": + for f in [fig01, fig02, fig03, fig04, fig05, fig06, fig07, fig08, + fig09, fig10, fig11, fig12]: + try: + f() + except Exception as e: + import traceback + print("FAILED", f.__name__, "->", repr(e)) + traceback.print_exc() + print("done") diff --git a/笔记/images/gen_figures_geartrain.py b/笔记/images/gen_figures_geartrain.py new file mode 100644 index 0000000..758c2e4 --- /dev/null +++ b/笔记/images/gen_figures_geartrain.py @@ -0,0 +1,821 @@ +# -*- coding: utf-8 -*- +""" +《知识点-齿轮系(轮系)》配图生成脚本 +- 全部为**几何/数学作图**(啮合圆几何、转化轮系、差速器运动分解、配齿几何…),非生成式 AI。 +- 复用 gen_figures.py 的绘图工具(配色 / 留白 / 注释框 / 300 dpi)。 +运行:python gen_figures_geartrain.py → 同目录输出 figGXX_*.png +""" +import numpy as np +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +from matplotlib.patches import Circle, Arc, Rectangle, FancyBboxPatch + +from gen_figures import (OUT, DPI, C_MAIN, C_BLUE, C_RED, C_GREEN, + C_ORANGE, C_PURPLE, C_GRAY, arc, save, note) + + +# ===================================================================== +# 基础工具 +# ===================================================================== +def new_ax(w=7.4, h=5.6): + fig, ax = plt.subplots(figsize=(w, h)) + ax.set_aspect("equal") + ax.axis("off") + return fig, ax + + +def free_ax(w=9.6, h=5.4, xlim=(0, 10), ylim=(0, 5.6)): + fig, ax = plt.subplots(figsize=(w, h)) + ax.set_xlim(*xlim) + ax.set_ylim(*ylim) + ax.axis("off") + return fig, ax + + +def grid(nr, nc, w, h): + fig, axes = plt.subplots(nr, nc, figsize=(w, h)) + axes = np.atleast_1d(axes).ravel() + for ax in axes: + ax.set_aspect("equal") + ax.axis("off") + return fig, axes + + +def box(ax, x, y, w, h, s, fc="#eef4fb", ec=C_BLUE, fs=10.5, tc=None, lw=1.2, + va="center"): + ax.add_patch(FancyBboxPatch((x - w / 2, y - h / 2), w, h, + boxstyle="round,pad=0.02,rounding_size=0.06", + fc=fc, ec=ec, lw=lw, zorder=3)) + ax.text(x, y, s, ha="center", va=va, fontsize=fs, zorder=4, + color=tc or C_MAIN, linespacing=1.55) + + +def line(ax, p, q, color=C_GRAY, lw=1.1, ls="-", zorder=1): + ax.plot([p[0], q[0]], [p[1], q[1]], color=color, lw=lw, ls=ls, zorder=zorder) + + +def gear(ax, cx, cy, r, color=C_MAIN, lw=1.7, teeth=0, tin=False, ls="-", + fc="none", zorder=3, alpha=1.0, tlen=0.13): + """齿轮简图:节圆 + 可选轮齿短线。tin=True 表示内齿轮(齿朝内)。""" + if fc != "none": + ax.add_patch(Circle((cx, cy), r, fc=fc, ec="none", alpha=alpha, + zorder=zorder - 1)) + ax.add_patch(Circle((cx, cy), r, fc="none", ec=color, lw=lw, ls=ls, + alpha=alpha, zorder=zorder)) + if teeth: + for a in np.linspace(0, 2 * np.pi, teeth, endpoint=False): + r0 = r - tlen if tin else r + r1 = r if tin else r + tlen + ax.plot([cx + r0 * np.cos(a), cx + r1 * np.cos(a)], + [cy + r0 * np.sin(a), cy + r1 * np.sin(a)], + color=color, lw=0.85, alpha=alpha, zorder=zorder) + + +def rot_arrow(ax, cx, cy, r, a0, a1, color=C_RED, lw=1.7, zorder=6): + """绕 (cx,cy) 的转向箭头;a1>a0 为逆时针。""" + lo, hi = min(a0, a1), max(a0, a1) + ax.add_patch(Arc((cx, cy), 2 * r, 2 * r, theta1=lo, theta2=hi, + color=color, lw=lw, zorder=zorder)) + t = np.radians(a1) + px, py = cx + r * np.cos(t), cy + r * np.sin(t) + d = 1.0 if a1 > a0 else -1.0 + tx, ty = -np.sin(t) * d, np.cos(t) * d + ax.annotate("", xy=(px, py), xytext=(px - 0.40 * tx, py - 0.40 * ty), + arrowprops=dict(arrowstyle="-|>", color=color, lw=lw, + mutation_scale=15), zorder=zorder + 1) + + +def shaft(ax, x, y0, y1, color=C_MAIN, lw=2.2, zorder=2): + ax.plot([x, x], [y0, y1], color=color, lw=lw, solid_capstyle="round", + zorder=zorder) + + +def dot(ax, x, y, color=C_RED, ms=5.5, zorder=8): + ax.plot(x, y, "o", color=color, ms=ms, zorder=zorder) + + +def lead(ax, p, q, color=C_GRAY, lw=0.9, ls=":"): + line(ax, p, q, color=color, lw=lw, ls=ls, zorder=5) + + +def ground(ax, x, y, w=0.8, color=C_MAIN, lw=1.3, up=True): + s = 1 if up else -1 + edge = y + s * 0.30 + ax.plot([x - w / 2, x + w / 2], [edge, edge], color=color, lw=lw, zorder=6) + for i in range(5): + xx = x - w / 2 + w * i / 4.0 + ax.plot([xx, xx - 0.16], [edge, edge + s * 0.20], color=color, lw=0.95, + zorder=6) + + +# ===================================================================== +# figG01 轮系分类 +# ===================================================================== +def figG01(): + fig, ax = free_ax(9.8, 5.6, (-1.0, 11.0), (0, 5.6)) + box(ax, 5.0, 5.05, 4.9, 0.70, "轮 系\n(由一系列齿轮组成的传动系统)", + fs=11.5, fc="#eaf1f8", ec=C_BLUE) + + box(ax, 1.65, 3.90, 2.85, 0.66, "定轴轮系\n(各轮轴线固定)", + fs=10.5, fc="#eaf7ea", ec=C_GREEN) + box(ax, 5.00, 3.90, 2.85, 0.66, "周转轮系\n(轴线有公转)", + fs=10.5, fc="#fdf2e5", ec=C_ORANGE) + box(ax, 8.35, 3.90, 2.85, 0.66, "复合轮系\n(两者混合)", + fs=10.5, fc="#f4ecfa", ec=C_PURPLE) + + box(ax, 0.90, 2.52, 1.90, 0.58, "平面定轴轮系", fs=9.8, fc="white", ec=C_GRAY) + box(ax, 2.95, 2.52, 1.90, 0.58, "空间定轴轮系", fs=9.8, fc="white", ec=C_GRAY) + box(ax, 4.50, 2.52, 1.75, 0.58, "差动轮系\nF = 2", fs=9.6, fc="white", ec=C_GRAY) + box(ax, 6.45, 2.52, 1.85, 0.58, "行星轮系\nF = 1", fs=9.6, fc="white", ec=C_GRAY) + + line(ax, (5, 4.70), (5, 4.58), C_GRAY, 1.2) + line(ax, (1.65, 4.58), (8.35, 4.58), C_GRAY, 1.2) + for x in (1.65, 5.0, 8.35): + line(ax, (x, 4.58), (x, 4.23), C_GRAY, 1.2) + line(ax, (1.65, 3.57), (1.65, 3.42), C_GRAY, 1.2) + line(ax, (5.00, 3.57), (5.00, 3.42), C_GRAY, 1.2) + line(ax, (0.90, 3.42), (2.95, 3.42), C_GRAY, 1.2) + line(ax, (4.50, 3.42), (6.45, 3.42), C_GRAY, 1.2) + for x in (0.90, 2.95, 4.50, 6.45): + line(ax, (x, 3.42), (x, 2.81), C_GRAY, 1.2) + + box(ax, 5.0, 1.28, 9.6, 1.30, + "本章两大问题:① 轮系传动比 $i$ 的计算  ② 从动轮转向的判断\n" + "重点:定轴轮系、周转轮系、复合轮系传动比的计算方法\n" + "行星轮系配齿公式、少齿差行星轮系 —— 一般了解", + fs=10.5, fc="#fbfbf6", ec="#d9d2c2") + save(fig, "figG01_geartrain_class.png") + + +# ===================================================================== +# figG02 定轴轮系传动比(惰轮) +# ===================================================================== +def figG02(): + fig, ax = new_ax(9.6, 8.0) + G = { # r = z/10,几何精确相切 + "1": (0.0, 10.0, 2.0), + "2": (6.0, 10.0, 4.0), + "2'": (6.0, 3.5, 2.0), + "3": (13.0, 3.5, 5.0), + "3'": (13.0, -3.5, 2.0), + "4": (19.0, -3.5, 4.0), + } + for (x, y, r) in G.values(): + gear(ax, x, y, r, lw=1.8) + shaft(ax, 0.0, 5.6, 14.0) # 轴Ⅰ + shaft(ax, 6.0, -0.2, 14.6) # 轴Ⅱ + shaft(ax, 13.0, -7.2, 9.0) # 轴Ⅲ + shaft(ax, 19.0, -8.6, 0.6) # 轴Ⅳ + + for p in [(3.0, 10.0), (9.5, 3.5), (16.0, -3.5)]: + ax.plot(p[0], p[1], "o", mfc="white", mec=C_RED, ms=10, mew=1.5, zorder=9) + + # 转向:1顺 → 2逆 → 2′逆 → 3顺 → 3′顺 → 4逆 + rot_arrow(ax, 0.0, 10.0, 2.55, 110, -40, C_RED) + rot_arrow(ax, 6.0, 10.0, 4.55, -40, 110, C_BLUE) + rot_arrow(ax, 6.0, 3.5, 2.55, -40, 110, C_BLUE) + rot_arrow(ax, 13.0, 3.5, 5.55, 110, -40, C_RED) + rot_arrow(ax, 13.0, -3.5, 2.55, 110, -40, C_RED) + rot_arrow(ax, 19.0, -3.5, 4.55, -40, 110, C_BLUE) + + ax.text(-3.1, 10.0, "1\n$z_1$=20", ha="right", va="center", fontsize=10.5) + ax.text(6.0, 15.35, "2\n$z_2$=40", ha="center", va="bottom", fontsize=10.5) + ax.text(3.65, 2.45, "2′\n$z_{2'}$=20", ha="right", va="center", fontsize=10.5) + ax.text(13.0, 9.35, "3\n$z_3$=50", ha="center", va="bottom", fontsize=10.5) + ax.text(11.55, -5.0, "3′\n$z_{3'}$=20", ha="right", va="center", fontsize=10.5) + ax.text(19.0, 1.35, "4\n$z_4$=40", ha="center", va="bottom", fontsize=10.5) + + ax.text(-5.2, 21.0, "定轴轮系传动比", fontsize=14, ha="left", va="center") + note(ax, -5.2, 19.7, + "$i_{14}=\\dfrac{\\omega_1}{\\omega_4}" + "=\\dfrac{z_2\\,z_3\\,z_4}{z_1\\,z_{2'}\\,z_{3'}}" + "=(-1)^3\\dfrac{40\\times50\\times40}{20\\times20\\times20}=-10$", + fs=12.5) + note(ax, -5.2, -10.2, + "大小:所有从动轮齿数连乘积 ÷ 所有主动轮齿数连乘积\n" + "转向:平面定轴轮系用 $(-1)^m$($m$=外啮合次数,本例 3 次 → 负号)\n" + "惰轮(过轮):齿数在分子、分母同时出现,只改变转向、不影响 $i$ 的大小", + fs=10.5) + ax.set_xlim(-5.6, 26.5) + ax.set_ylim(-14.0, 22.2) + save(fig, "figG02_fixed_train.png") + + +# ===================================================================== +# figG03 定轴轮系转向判定 +# ===================================================================== +def figG03(): + fig, axes = grid(2, 2, 9.8, 8.0) + a, b, c, d = axes + + # (a) 平面:外啮合 + a.set_title("(a) 平面定轴轮系 · 外啮合 → 转向相反($i_{12}$ 取负)", + fontsize=10.5) + gear(a, -1.0, 0, 1.0) + gear(a, 1.0, 0, 1.0) + dot(a, 0, 0, C_RED, ms=6) + rot_arrow(a, -1.0, 0, 1.55, 110, -40, C_RED) + rot_arrow(a, 1.0, 0, 1.55, -40, 110, C_BLUE) + a.text(-1.0, 2.05, "1", ha="center", fontsize=11) + a.text(1.0, 2.05, "2", ha="center", fontsize=11) + a.text(0, -2.25, "两箭头反向:$i_{12}=-z_2/z_1$", ha="center", fontsize=10) + a.set_xlim(-3.0, 3.0) + a.set_ylim(-2.9, 2.9) + + # (b) 平面:内啮合 + b.set_title("(b) 平面定轴轮系 · 内啮合 → 转向相同($i_{12}$ 取正)", + fontsize=10.5) + gear(b, 0, 0, 1.85, lw=2.0, teeth=44, tin=True) + gear(b, 0.85, 0, 1.00) + dot(b, 1.85, 0, C_RED, ms=6) + rot_arrow(b, 0, 0, 2.35, -40, 110, C_RED, lw=1.5) + rot_arrow(b, 0.85, 0, 1.45, -40, 110, C_RED, lw=1.5) + b.text(-1.85, 1.95, "内齿轮 1", ha="center", fontsize=10) + b.text(0.85, -0.06, "2", ha="center", fontsize=11) + b.text(0, -2.70, "两箭头同向:$i_{12}=+z_2/z_1$", ha="center", fontsize=10) + b.set_xlim(-3.0, 3.0) + b.set_ylim(-2.9, 2.9) + + # (c) 空间:锥齿轮 + c.set_title("(c) 锥齿轮:两箭头同时指向\n(或同时背离)啮合点", fontsize=10.2) + c.plot([-2.6, 0], [0, 0], color=C_MAIN, lw=1.4) + c.plot([0, 0], [0, -2.6], color=C_MAIN, lw=1.4) + c.add_patch(plt.Polygon([(0, 0), (-1.5, 0.62), (-1.5, -0.62)], closed=True, + fc="#dbe8f5", ec=C_BLUE, lw=1.5, zorder=3)) + c.add_patch(plt.Polygon([(0, 0), (-0.62, -1.5), (0.62, -1.5)], closed=True, + fc="#fdeada", ec=C_ORANGE, lw=1.5, zorder=3)) + dot(c, 0, 0, C_RED, ms=6) + c.annotate("", xy=(-0.18, 0.12), xytext=(-1.35, 0.12), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8)) + c.annotate("", xy=(0.12, -0.18), xytext=(0.12, -1.35), + arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=1.8)) + c.text(-1.95, 1.00, "齿轮1", color=C_BLUE, fontsize=10, ha="center") + c.text(1.35, -1.55, "齿轮2", color=C_ORANGE, fontsize=10, ha="center") + c.text(0.15, 0.32, "啮合点", fontsize=9.5, color=C_RED) + c.set_xlim(-3.0, 3.2) + c.set_ylim(-3.0, 2.9) + + # (d) 空间:蜗杆蜗轮 + d.set_title("(d) 蜗杆蜗轮:左旋左手、右旋右手", fontsize=10.2) + d.add_patch(Rectangle((-2.2, -0.42), 3.6, 0.84, fc="#dbe8f5", + ec=C_BLUE, lw=1.5, zorder=3)) + for x in np.linspace(-2.05, 1.25, 9): + d.plot([x, x + 0.32], [-0.42, 0.42], color=C_BLUE, lw=1.0, zorder=4) + d.plot([-2.6, 1.9], [0, 0], color=C_MAIN, lw=1.2, ls="-.", zorder=2) + gear(d, 0.0, -1.75, 1.35, lw=1.8, teeth=30) + d.plot([0.0, 0.0], [-1.75, -0.40], color=C_MAIN, lw=1.2, ls="-.", zorder=2) + dot(d, 0.0, -0.42, C_RED, ms=6) + d.annotate("", xy=(0.9, 0.95), xytext=(-2.1, 0.95), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8)) + rot_arrow(d, 0.0, -1.75, 1.80, 110, -40, C_ORANGE) + d.text(-2.3, 1.30, "蜗杆(右旋)", color=C_BLUE, fontsize=10, ha="left") + d.text(1.95, -2.55, "蜗轮", color=C_ORANGE, fontsize=10, ha="left") + d.text(0.0, -3.55, + "四指弯曲方向=蜗杆转向,拇指反向=蜗轮节点线速度方向", + fontsize=9.5, ha="center") + d.set_xlim(-3.0, 3.6) + d.set_ylim(-4.0, 2.9) + + fig.tight_layout() + save(fig, "figG03_direction.png") + + +# ===================================================================== +# figG04 2K-H 周转轮系的组成 +# ===================================================================== +def figG04(): + fig, ax = new_ax(8.6, 7.2) + r1, r2, r3 = 1.2, 0.9, 3.0 + dO = r1 + r2 + assert abs((r3 - r2) - dO) < 1e-9 + gear(ax, 0, 0, r3, lw=1.9, teeth=54, tin=True) + gear(ax, 0, 0, r1, lw=1.9, teeth=28) + for a in (90, 210, 330): + t = np.radians(a) + px, py = dO * np.cos(t), dO * np.sin(t) + gear(ax, px, py, r2, lw=1.7, teeth=22) + line(ax, (0, 0), (px, py), color=C_ORANGE, lw=2.0, zorder=2) + gear(ax, 0, 0, 0.34, fc=C_ORANGE, lw=1.4, zorder=5) + ax.plot(0, 0, "k+", ms=8) + + lead(ax, (0.80, 0.80), (4.05, 2.55)) + ax.text(4.20, 2.55, "1 太阳轮(中心轮)", fontsize=10.5, va="center") + lead(ax, (-dO * 0.866, -dO * 0.5), (-5.10, -3.60)) + ax.text(-5.25, -3.60, "2 行星轮", fontsize=10.5, ha="left", va="center") + lead(ax, (-2.12, 2.12), (-6.20, 3.55)) + ax.text(-6.35, 3.55, "3 内齿圈(中心轮,固定)", fontsize=10.5, + ha="left", va="center") + lead(ax, (dO * 0.55, -dO * 0.05), (2.75, -2.15)) + ax.text(2.90, -2.15, "H 系杆(行星架)", fontsize=10.5, ha="left", + va="center", color=C_ORANGE) + rot_arrow(ax, 0, 0, r1 + 0.45, 110, -40, C_RED) + rot_arrow(ax, 0, 0, r3 + 0.45, -40, 110, C_BLUE, lw=1.4) + + note(ax, -7.6, -4.60, + "基本构件:太阳轮(中心轮)、系杆(行星架);行星轮既自转又绕中心轮公转\n" + "一个基本周转轮系中:至少 1 个行星轮,最多 2 个中心轮," + "且两中心轮与系杆的轴线必须重合\n" + "差动轮系 $F=2$(两中心轮都不固定);行星轮系 $F=1$(一个中心轮固定)", + fs=10.5) + ax.set_xlim(-7.9, 7.9) + ax.set_ylim(-7.4, 5.2) + save(fig, "figG04_epicyclic.png") + + +# ===================================================================== +# figG05 反转原理(转化轮系) +# ===================================================================== +def figG05(): + fig, axes = grid(1, 2, 10.6, 5.4) + r1, r2, r3 = 2.0, 1.5, 5.0 + dO = r1 + r2 + + titles = (r"原周转轮系:$\omega_1,\ \omega_3,\ \omega_H$ 均不为 0", + r"施加 $-\omega_H$ 后:系杆成机架 → 转化轮系(定轴轮系)") + for ax, ttl, inv in zip(axes, titles, (False, True)): + ax.set_title(ttl, fontsize=11) + gear(ax, 0, 0, r3, lw=1.8, teeth=48, tin=True) + gear(ax, 0, 0, r1, lw=1.8, teeth=26) + gear(ax, dO, 0, r2, lw=1.6, teeth=18) + line(ax, (0, 0), (dO, 0), color=C_ORANGE, lw=2.0, zorder=2) + gear(ax, 0, 0, 0.4, fc=C_MAIN if inv else C_ORANGE, lw=1.4, zorder=5) + ax.plot(0, 0, "k+", ms=7) + rot_arrow(ax, 0, 0, r1 + 0.45, 110, -40, C_RED) + rot_arrow(ax, 0, 0, r3 + 0.40, -40, 110, C_BLUE, lw=1.3) + rot_arrow(ax, 0, 0, dO - 0.32, -40, 110, C_ORANGE, lw=1.5) + ax.text(-r3 - 0.05, r3 + 0.55, "3", fontsize=11, ha="center") + ax.text(-0.16, r1 - 0.30, "1", fontsize=11, ha="right") + ax.text(dO + 0.25, r2 + 0.55, "2", fontsize=11, ha="left") + ax.text(0.55, 0.95, "H", fontsize=12, color=C_ORANGE) + ax.set_xlim(-r3 - 1.9, r3 + 2.1) + ax.set_ylim(-r3 - 2.5, r3 + 2.1) + if inv: + ax.text(0.65, -0.85, "H 为机架", fontsize=10.6, color=C_MAIN, + zorder=9, + bbox=dict(boxstyle="round,pad=0.30", fc="white", + ec=C_MAIN, lw=1.0, alpha=0.97)) + ax.text(0, -r3 - 1.55, + r"$\omega_H^{H}=\omega_H-\omega_H=0$", ha="center", + fontsize=10.5, color=C_ORANGE) + ax.text(0, -r3 - 2.15, + "各构件角速度:$\\omega_i^{H}=\\omega_i-\\omega_H$", + ha="center", fontsize=10) + else: + ax.text(0, -r3 - 1.55, + r"$\omega_1,\ \omega_3,\ \omega_2$(2 既有自转又有公转)", + ha="center", fontsize=10) + ax.text(0, -r3 - 2.15, "不能直接求传动比", ha="center", + fontsize=10, color="#555555") + + fig.tight_layout(rect=(0, 0.20, 1, 1)) + fig.text(0.5, 0.03, + "反转原理:给整个周转轮系施加公共角速度 $-\\omega_H$," + "各构件之间的相对运动不变,但系杆变为“静止”,\n" + "原周转轮系 → 转化轮系(定轴轮系),可直接套用定轴轮系的公式。", + ha="center", va="bottom", fontsize=10.8, linespacing=1.7, + bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2")) + save(fig, "figG05_inversion.png") + + +# ===================================================================== +# figG06 周转轮系传动比通用公式 + 注意事项 +# ===================================================================== +def figG06(): + fig, ax = free_ax(9.8, 5.4, (0, 10), (0, 5.4)) + box(ax, 5.0, 4.82, 9.3, 0.80, + "$i_{GK}^{H}=\\dfrac{\\omega_G-\\omega_H}{\\omega_K-\\omega_H}" + "=\\pm\\dfrac{z_{\\mathrm{driven}}}{z_{\\mathrm{driver}}}$", + fs=15, fc="#eaf1f8", ec=C_BLUE) + box(ax, 5.0, 3.92, 9.3, 0.76, + "分子 = 转化轮系中 G→K 间所有从动轮齿数的连乘积;分母 = 所有主动轮齿数的连乘积\n" + "G=主动轮(通常为中心轮),K=从动轮,H=系杆;" + "$\\omega_G,\\omega_K,\\omega_H$ 为各构件的绝对角速度", + fs=10.3, fc="white", ec=C_GRAY) + + items = [ + "① 符号必须带正负号:转向相同取同号,转向相反取异号 —— " + "$\\omega$ 与 $n$ 可互换,但 $n$ 同样要带符号。", + "② 齿数比前的 $\\pm$ 由转化轮系中 $G\\to K$ 的外啮合次数 $m$ 决定," + "取 $(-1)^m$;它只表示转化轮系中的转向,不代表两轮的实际转向。", + "③ 公式要求 $G$、$K$ 与系杆 $H$ 的轴线互相平行;空间(锥齿轮)周转轮系" + "也可用它求两中心轮与系杆之间的转速关系。", + "④ 若为行星轮系,$\\omega_G$、$\\omega_K$ 中必有一个为 0" + "(设 $\\omega_K=0$,则 $i_{GK}^{H}=\\dfrac{\\omega_G-\\omega_H}{-\\omega_H}$)。", + "⑤ 两齿轮轴线不平行时 $\\omega_2^{H}\\neq\\omega_2-\\omega_H$," + "不能直接对行星轮本身套用此式,否则会得出错误结论。", + ] + y = 3.03 + for txt in items: + ax.text(0.20, y, txt, fontsize=10.3, ha="left", va="top", linespacing=1.6) + y -= 0.60 + save(fig, "figG06_formula.png") + + +# ===================================================================== +# figG07 复合轮系:划分基本轮系 +# ===================================================================== +def figG07(): + fig, axes = grid(1, 2, 10.6, 5.6) + a, b = axes + + # (a) 周转轮系 1-2-3-H + r1, r2, r3 = 1.2, 1.8, 4.8 + dO = r1 + r2 + assert abs((r3 - r2) - dO) < 1e-9 + a.set_title("(a) 周转轮系 1–2–3–H(内齿圈 3 固定)", fontsize=10.8) + gear(a, 0, 0, r3, lw=1.8, teeth=60, tin=True) + gear(a, 0, 0, r1, lw=1.8, teeth=24) + gear(a, 0, dO, r2, lw=1.6, teeth=28) + line(a, (0, 0), (0, dO), color=C_ORANGE, lw=2.0, zorder=2) + gear(a, 0, 0, 0.32, fc=C_ORANGE, lw=1.3, zorder=5) + ground(a, 0, -r3 - 0.05, w=1.2, up=False) + rot_arrow(a, 0, 0, r1 + 0.42, 110, -40, C_RED) + rot_arrow(a, 0, 0, dO - 0.30, -40, 110, C_ORANGE, lw=1.6) + a.text(0.18, r1 - 0.35, "1", fontsize=11) + a.text(0.30, dO - 0.35, "2", fontsize=11) + a.text(-r3 - 0.15, r3 - 0.55, "3", fontsize=11, ha="right") + a.text(0.42, 1.30, "H", fontsize=12, color=C_ORANGE) + a.text(0, -r3 - 1.15, "输出 $\\omega_H$", ha="center", fontsize=10.5, + color=C_ORANGE) + a.text(0, -r3 - 1.95, "$z_1$=20,$z_2$=40,$z_3$=100", ha="center", + fontsize=10.2) + a.set_xlim(-r3 - 1.8, r3 + 1.8) + a.set_ylim(-r3 - 2.9, r3 + 1.5) + + # (b) 定轴轮系 0-1 + b.set_title("(b) 定轴轮系 0–1(与左图共用齿轮 1)", fontsize=10.8) + g0r, g1r = 1.5, 1.0 + gear(b, -g1r, 0, g0r, lw=1.8, teeth=30) + gear(b, g0r, 0, g1r, lw=1.8, teeth=20) + shaft(b, -g1r, -g0r - 1.0, g0r + 1.0, lw=2.0) + shaft(b, g0r, -g1r - 1.0, g1r + 1.0, lw=2.0) + dot(b, 0.0, 0.0, C_RED, ms=6) + rot_arrow(b, -g1r, 0, g0r + 0.5, 110, -40, C_BLUE) + rot_arrow(b, g0r, 0, g1r + 0.5, -40, 110, C_RED, lw=1.5) + b.text(-g1r, g0r + 1.35, "0\n$z_0$=30", ha="center", va="bottom", fontsize=10.5) + b.text(g0r, g1r + 1.35, "1\n$z_1$=20", ha="center", va="bottom", fontsize=10.5) + b.annotate("", xy=(-3.55, 0.0), xytext=(-2.30, 0.0), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.8)) + b.text(-3.70, 0.0, "输入\n$\\omega_0$", ha="right", va="center", + fontsize=10.5, color=C_BLUE) + b.text(0, -g0r - 1.75, + "$i_{01}=\\dfrac{\\omega_0}{\\omega_1}=-\\dfrac{z_1}{z_0}" + "=-\\dfrac{20}{30}=-\\dfrac{2}{3}$", + ha="center", fontsize=11) + b.set_xlim(-5.6, 4.4) + b.set_ylim(-g0r - 2.7, g0r + 2.2) + + fig.tight_layout(rect=(0, 0.24, 1, 1)) + fig.text(0.5, 0.185, + "① 划分基本轮系:先找轴线不固定的行星轮 → 再找支承它的系杆 → " + "再找与行星轮啮合的太阳轮,剩下的就是定轴轮系", + ha="center", va="top", fontsize=10.5) + fig.text(0.5, 0.03, + "② 分别列式 ③ 用公共构件的转速联立:\n" + "$i_{1H}=1+\\dfrac{z_3}{z_1}=1+\\dfrac{100}{20}=6$" + " → $i_{0H}=i_{01}\\cdot i_{1H}" + "=\\left(-\\dfrac{2}{3}\\right)\\times6=-4$", + ha="center", va="bottom", fontsize=11, linespacing=1.9, + bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2")) + save(fig, "figG07_composite.png") + + +# ===================================================================== +# figG08 轮系的功用 +# ===================================================================== +def _ic_gears(ax, x, y, s=0.34): + ax.add_patch(Circle((x - s * 0.9, y), s * 0.80, fc="#eaf1f8", ec=C_BLUE, + lw=1.5, zorder=3)) + ax.add_patch(Circle((x + s * 1.0, y), s * 1.35, fc="#fdf2e5", ec=C_ORANGE, + lw=1.5, zorder=3)) + + +def _ic_split(ax, x, y, s=0.46, n=3): + ax.annotate("", xy=(x + s * 0.4, y), xytext=(x - s * 1.1, y), + arrowprops=dict(arrowstyle="-|>", color=C_MAIN, lw=1.3)) + for dy in np.linspace(s * 0.9, -s * 0.9, n): + ax.annotate("", xy=(x + s * 1.5, y + dy), xytext=(x + s * 0.45, y), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.1)) + + +def _ic_reverse(ax, x, y, s=0.46): + ax.annotate("", xy=(x + s * 1.3, y + s * 0.45), + xytext=(x - s * 0.2, y + s * 0.45), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.5)) + ax.annotate("", xy=(x - s * 0.2, y - s * 0.45), + xytext=(x + s * 1.3, y - s * 0.45), + arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=1.5)) + + +def _ic_shift(ax, x, y, s=0.42): + ax.add_patch(Circle((x - s * 0.9, y - 0.10), s * 0.62, fc="#eaf1f8", + ec=C_BLUE, lw=1.5, zorder=3)) + ax.add_patch(Circle((x + s * 0.85, y + 0.18), s * 0.95, fc="#fdf2e5", + ec=C_ORANGE, lw=1.5, zorder=3)) + ax.annotate("", xy=(x + s * 0.85, y - s * 1.30), + xytext=(x - s * 0.9, y - s * 1.30), + arrowprops=dict(arrowstyle="-|>", color=C_PURPLE, lw=1.2)) + + +def _ic_merge(ax, x, y, s=0.46): + for dy in (s * 0.85, -s * 0.85): + ax.annotate("", xy=(x + s * 0.6, y), xytext=(x - s * 1.1, y + dy), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=1.1)) + ax.annotate("", xy=(x + s * 1.7, y), xytext=(x + s * 0.65, y), + arrowprops=dict(arrowstyle="-|>", color=C_RED, lw=1.6)) + + +def _ic_power(ax, x, y, s=0.42): + ax.add_patch(Rectangle((x - s * 1.25, y - s * 0.85), s * 2.5, s * 1.7, + fc="#f4ecfa", ec=C_PURPLE, lw=1.4, zorder=3)) + ax.text(x, y, "kW", fontsize=8.0, ha="center", va="center", color=C_PURPLE, + zorder=4) + + +def figG08(): + fig, ax = free_ax(10.2, 6.8, (0, 12), (-0.55, 7.5)) + cards = [ + ("①", "获得很大的传动比,结构紧凑", + "一对齿轮 $i<5\\sim7$;轮系 $i$ 可达 10000", _ic_gears), + ("②", "实现分路传动", "钟表的时、分、秒针等(1 路输入 → 多路输出)", _ic_split), + ("③", "实现换向传动", "改变从动轴的转向", _ic_reverse), + ("④", "实现变速传动", "移动双联齿轮,改变输出轴转速", _ic_shift), + ("⑤", "运动的合成(加减法运算)", + "差动轮系 $n_H=(n_1+n_3)/2$($z_1=z_2=z_3$)", _ic_merge), + ("⑥", "运动的分解", "汽车差速器自动分配两后轮转速", _ic_split), + ("⑦", "尺寸、重量较小时实现大功率传动", + "航空发动机主减 $\\phi$430 mm,2850 kW", _ic_power), + ] + W, H = 5.85, 1.60 + xs = [3.05, 8.95] + ys = [6.10, 4.34, 2.58, 0.82] + for i, (tag, title, desc, icon) in enumerate(cards): + cx, cy = xs[i % 2], ys[i // 2] + ax.add_patch(FancyBboxPatch((cx - W / 2, cy - H / 2), W, H, + boxstyle="round,pad=0.02,rounding_size=0.12", + fc="#fbfbf8", ec="#cfd6dd", lw=1.1, zorder=2)) + ax.add_patch(Circle((cx - W / 2 + 0.42, cy + 0.42), 0.25, + fc="#eaf1f8", ec=C_BLUE, lw=1.0, zorder=3)) + ax.text(cx - W / 2 + 0.42, cy + 0.42, tag, fontsize=10, ha="center", + va="center", zorder=4, color=C_BLUE) + icon(ax, cx - W / 2 + 1.32, cy - 0.02) + ax.text(cx - W / 2 + 2.22, cy + 0.38, title, fontsize=10.4, ha="left", + va="center", zorder=4) + ax.text(cx - W / 2 + 2.22, cy - 0.40, desc, fontsize=9.2, ha="left", + va="center", color="#555555", zorder=4) + ax.text(6.0, 7.24, "轮系的功用(共七个方面)", fontsize=13.5, ha="center", + va="center") + ax.text(6.0, -0.32, "轮系的用途:减速器、增速器、变速器、换向机构", + fontsize=10.2, ha="center", va="center", color="#555555") + save(fig, "figG08_functions.png") + + +# ===================================================================== +# figG09 汽车差速器(运动分解) +# ===================================================================== +def figG09(): + fig, ax = new_ax(9.4, 6.6) + L = 3.0 + P = (0.0, -7.0) + xl, xr = -L, L + + for xx, col in ((xl, C_BLUE), (xr, C_ORANGE)): + line(ax, P, (xx, 0), color=col, lw=1.0, ls=":", zorder=1) + ax.add_patch(Arc(P, 2 * 2.2, 2 * 2.2, theta1=72, theta2=108, + color=C_MAIN, lw=1.3, zorder=2)) + ax.text(0.55, -4.55, "$\\omega$", fontsize=13) + dot(ax, *P, C_MAIN, ms=6) + ax.text(0.45, -6.80, "$P$(转弯中心)", fontsize=10.5) + + for xx, col in ((xl, C_BLUE), (xr, C_ORANGE)): + ax.add_patch(Rectangle((xx - 0.22, -0.95), 0.44, 1.90, fc="#e6e6e6", + ec=C_MAIN, lw=1.6, zorder=4)) + ax.text(xl, 1.25, "轮1", color=C_BLUE, fontsize=11, ha="center") + ax.text(xr, 1.25, "轮3", color=C_ORANGE, fontsize=11, ha="center") + line(ax, (xl, 0), (xr, 0), C_MAIN, 2.0) + ax.add_patch(Rectangle((-0.95, -0.75), 1.90, 1.50, fc="#fdf2e5", + ec=C_ORANGE, lw=1.6, zorder=3)) + ax.text(0, 0, "差速器", fontsize=9.5, ha="center", va="center", zorder=5, + color=C_ORANGE) + ax.text(0, 1.95, "$H$(行星架,由发动机驱动)", fontsize=10.2, ha="center", + color=C_ORANGE) + + ax.annotate("", xy=(xl, -1.95), xytext=(xl, -0.95), + arrowprops=dict(arrowstyle="-|>", color=C_BLUE, lw=2.0)) + ax.text(xl, -2.35, "$v_1=(r-L)\\,\\omega$", color=C_BLUE, fontsize=11, + ha="center") + ax.annotate("", xy=(xr, -1.95), xytext=(xr, -0.95), + arrowprops=dict(arrowstyle="-|>", color=C_ORANGE, lw=2.6)) + ax.text(xr, -2.35, "$v_3=(r+L)\\,\\omega$", color=C_ORANGE, fontsize=11, + ha="center") + + ax.set_xlim(-4.3, 4.3) + ax.set_ylim(-8.5, 3.0) + fig.tight_layout(rect=(0, 0.30, 1, 1)) + fig.text(0.5, 0.155, + "$z_1=z_3$(两半轴齿轮相同),$n_H=n_4$(行星架与壳体同速);" + "$n_H=\\dfrac{n_1+n_3}{2}$ → 行星架转速是两轮的“中间值”\n" + "该式只有 2 个方程、3 个未知数:直线行驶时还需 $n_1=n_3$ 才能求解", + ha="center", va="bottom", fontsize=10.3, linespacing=1.8, + bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2")) + fig.text(0.5, 0.02, + "转弯时车体绕 $P$ 点转动:$n_1/n_3=v_1/v_3=(r-L)/(r+L)$;" + "轮系按转弯半径自动把 $n_H$ 分解为 $n_1$、$n_3$\n" + "(内侧轮慢、外侧轮快),使车轮始终作纯滚动", + ha="center", va="bottom", fontsize=10.3, linespacing=1.8, + bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2")) + save(fig, "figG09_differential.png") + + +# ===================================================================== +# figG10 行星轮系配齿四条件 +# ===================================================================== +def figG10(): + fig, axes = grid(2, 2, 10.0, 7.8) + a, b, c, d = axes + r1, r2, r3 = 1.1, 0.85, 2.8 + dO = r1 + r2 + + a.set_title("(a) 同心条件:$r_3=r_1+2r_2$ ($z_3=z_1+2z_2$)", fontsize=10.8) + gear(a, 0, 0, r3, lw=1.7, teeth=48, tin=True) + gear(a, 0, 0, r1, lw=1.7, teeth=24) + gear(a, dO, 0, r2, lw=1.6, teeth=18) + line(a, (0, 0), (0, -r3 - 0.55), C_GRAY, 1.0) + line(a, (0, 0), (dO, 0), C_GRAY, 0.9) + a.annotate("", xy=(0, 0.28), xytext=(0, 1.38), + arrowprops=dict(arrowstyle="<->", color=C_BLUE, lw=1.3)) + a.text(0.16, 0.83, "$r_1$", color=C_BLUE, fontsize=11) + a.annotate("", xy=(dO, 0.28), xytext=(dO, 1.95), + arrowprops=dict(arrowstyle="<->", color=C_GREEN, lw=1.3)) + a.text(dO + 0.16, 1.11, "$r_2$", color=C_GREEN, fontsize=11) + a.annotate("", xy=(-0.55, -r3 + 0.05), xytext=(-0.55, -r3 - 0.55), + arrowprops=dict(arrowstyle="<->", color=C_ORANGE, lw=1.3)) + a.text(-0.42, -r3 - 0.25, "$r_3$", color=C_ORANGE, fontsize=11) + a.text(0, r3 + 0.95, "两中心轮齿数应同时为偶数或奇数", fontsize=9.8, + ha="center") + a.set_xlim(-3.4, 4.6) + a.set_ylim(-r3 - 1.3, r3 + 1.5) + + b.set_title("(b) 装配条件:$(z_1+z_3)/N$ 必须为整数", fontsize=10.8) + gear(b, 0, 0, r3, lw=1.6, teeth=40, tin=True) + gear(b, 0, 0, r1, lw=1.7, teeth=24) + for ang in (0, 120, 240): + t = np.radians(ang) + px, py = dO * np.cos(t), dO * np.sin(t) + gear(b, px, py, r2, lw=1.5, teeth=16) + line(b, (0, 0), (px, py), C_ORANGE, 1.6, zorder=2) + b.add_patch(Arc((0, 0), 2 * 1.72, 2 * 1.72, theta1=0, theta2=120, + color=C_PURPLE, lw=1.5)) + b.text(2.30, 2.45, "$\\varphi_H=2\\pi/N$", color=C_PURPLE, fontsize=10.5, + ha="left", va="center") + lead(b, (0.86, 1.49), (2.20, 2.36), C_PURPLE, 0.9) + b.text(0, -r3 - 0.95, "$N$=行星轮个数;$K=z_1 i_{1H}/N$ 须为整数", + fontsize=9.8, ha="center") + b.set_xlim(-3.4, 4.6) + b.set_ylim(-r3 - 1.6, r3 + 1.4) + + c.set_title("(c) 邻接条件:$O_1O_2>2r_{a2}$", fontsize=10.8) + rc, r2c, dOc = 0.60, 0.75, 1.35 + gear(c, 0, 0, rc, lw=1.7, teeth=18, fc="#fdf2e5") + t1 = np.radians(105) + p1 = (dOc * np.cos(t1), dOc * np.sin(t1)) + p2 = (dOc * np.cos(t1 + np.radians(120)), dOc * np.sin(t1 + np.radians(120))) + for p in (p1, p2): + gear(c, p[0], p[1], r2c, lw=1.5, teeth=14) + line(c, (0, 0), p, C_ORANGE, 1.3, zorder=2) + dot(c, p[0], p[1], C_RED, ms=6) + c.add_patch(Arc(p1, 2 * (r2c + 0.20), 2 * (r2c + 0.20), + theta1=np.degrees(t1) - 160, theta2=np.degrees(t1) - 30, + color=C_GREEN, lw=1.4, ls=":")) + line(c, p1, p2, C_RED, 1.8, ls="--", zorder=1) + c.text(p1[0] - 0.15, p1[1] + 1.00, "$O_1$", color=C_RED, fontsize=10.5, + ha="center") + c.text(p2[0] - 1.15, p2[1] - 0.85, "$O_2$", color=C_RED, fontsize=10.5, + ha="center") + lead(c, p1, (p1[0] - 0.12, p1[1] + 0.92), C_GRAY, 0.9) + lead(c, p2, (p2[0] - 1.10, p2[1] - 0.80), C_GRAY, 0.9) + c.text(0.92, 0.05, "太阳轮\n(中心轮)", fontsize=9.2, ha="left", + va="center", color=C_ORANGE) + lead(c, (0.75, 0.02), (0.88, 0.05), C_GRAY, 0.9) + c.text(0.62, 1.28, "行星轮", fontsize=9.2, ha="left", + va="center", color=C_MAIN) + lead(c, (p1[0] + 0.78, p1[1]), (0.58, 1.28), C_GRAY, 0.9) + c.text(0.75, -2.15, "$O_1O_2>2r_{a2}=2(r_2+h_a^{*}m)$", + fontsize=9.8, ha="left", va="center", color="#555555") + c.text(-2.55, -2.15, "$(z_1+z_2)\\sin\\dfrac{\\pi}{N}>z_2+2h_a^{*}$", + fontsize=11, ha="left", va="center") + c.set_xlim(-2.9, 3.3) + c.set_ylim(-2.6, 2.9) + + d.set_title("(d) 配齿公式(前三个条件合并)", fontsize=10.8) + d.text(0.55, 0.55, + "$z_2=\\dfrac{z_1\\,(i_{1H}-2)}{2}$\n\n" + "$z_3=z_1\\,(i_{1H}-1)$\n\n" + "$K=\\dfrac{z_1\\,i_{1H}}{N}$", + fontsize=13, ha="center", va="center", linespacing=1.6) + d.text(0.55, -1.35, + "$z_1,z_2,z_3,K$ 均须为正整数,且 $z_1,z_2,z_3>z_{\\min}$", + fontsize=9.8, ha="center", va="center", color="#333333", + bbox=dict(boxstyle="round,pad=0.40", fc="#fbfbf6", ec="#d9d2c2")) + d.set_xlim(-0.75, 1.85) + d.set_ylim(-2.1, 1.9) + + fig.tight_layout() + save(fig, "figG10_assembly.png") + + +# ===================================================================== +# figG11 少齿差行星传动(K-H-V / 孔销式输出机构) +# ===================================================================== +def figG11(): + fig, axes = grid(1, 2, 10.6, 5.8) + a, b = axes + + a.set_title("(a) 渐开线少齿差(K-H-V 型):$z_2-z_1=1\\sim4$", fontsize=10.8) + R1, R2 = 6.0, 5.0 + off = R1 - R2 + gear(a, 0, 0, R1, lw=1.9, teeth=72, tin=True) + gear(a, off, 0, R2, lw=1.9, teeth=60, fc="#eaf1f8") + line(a, (0, 0), (off, 0), C_ORANGE, 2.2, zorder=2) + gear(a, 0, 0, 0.45, fc=C_ORANGE, lw=1.4, zorder=5) + a.plot(0, 0, "k+", ms=8) + dot(a, R1, 0, C_RED, ms=6) + rot_arrow(a, 0, 0, R1 + 0.50, 110, -40, C_BLUE, lw=1.5) + rot_arrow(a, off, 0, 1.30, -40, 110, C_ORANGE, lw=1.8) + a.text(0, R1 + 0.95, "1 内齿圈(固定)", fontsize=10.3, ha="center") + a.text(off, -1.85, "2 行星轮", fontsize=10.3, ha="center") + a.text(off * 0.5 + 0.18, 0.58, "$H$", color=C_ORANGE, fontsize=12) + a.text(0, -R1 - 1.30, + "$i_{H2}=\\dfrac{\\omega_H}{\\omega_2}=-\\dfrac{z_1}{z_2-z_1}$" + " ($z_1$=100,$z_2$=101 时 $i_{H2}=-100$)", + fontsize=10.5, ha="center", va="top") + a.text(0, -R1 - 2.85, + "系杆主动、行星轮作平面运动,须加输出机构 V 引出其自转", + fontsize=10.0, ha="center", va="top", color="#555555") + a.set_xlim(-R1 - 1.6, R1 + 1.8) + a.set_ylim(-R1 - 3.2, R1 + 1.8) + + b.set_title("(b) 孔销式输出机构:$d_h=d_s+2a$", fontsize=10.8) + rho, aa = 2.50, 0.85 + OV = (-3.90, -1.50) + O2 = (OV[0] - aa, OV[1]) + th = np.radians(62) + oh = (OV[0] + rho * np.cos(th), OV[1] + rho * np.sin(th)) + os_ = (O2[0] + rho * np.cos(th), O2[1] + rho * np.sin(th)) + line(b, OV, oh, C_PURPLE, 1.6, zorder=3) + line(b, oh, os_, C_RED, 1.8, ls="--", zorder=4) + line(b, os_, O2, C_GREEN, 1.6, zorder=3) + line(b, O2, OV, C_RED, 1.8, ls="--", zorder=4) + for p, col in ((OV, C_PURPLE), (oh, C_PURPLE), (os_, C_GREEN), + (O2, C_GREEN)): + dot(b, p[0], p[1], col, ms=6) + b.text(OV[0], OV[1] - 0.60, "$O_V$", color=C_PURPLE, fontsize=10.5, + ha="center", va="top") + b.text(O2[0], O2[1] - 0.60, "$O_2$", color=C_GREEN, fontsize=10.5, + ha="center", va="top") + b.text(oh[0] + 0.18, oh[1] + 0.10, "$o_h$", color=C_PURPLE, fontsize=10.5, + ha="left", va="bottom") + b.text(os_[0] - 0.20, os_[1] - 0.55, "$o_s$", color=C_GREEN, fontsize=10.5, + ha="center", va="top") + b.text(-3.90, -2.70, "四圆心连成平行四边形", fontsize=9.4, ha="center", + color="#555555") + + cx0, cy0 = 2.20, 0.60 + rh, rs = 0.90, 0.55 + b.add_patch(Circle((cx0, cy0), rh, fc="white", ec=C_PURPLE, lw=1.8, zorder=5)) + b.add_patch(Circle((cx0 - (rh - rs), cy0), rs, fc="#eaf7ea", ec=C_GREEN, + lw=1.8, zorder=6)) + dot(b, cx0, cy0, C_PURPLE, ms=6) + dot(b, cx0 - (rh - rs), cy0, C_GREEN, ms=6) + dot(b, cx0 - rh, cy0, C_RED, ms=5) + b.text(cx0, cy0 + rh + 0.28, "销孔 $d_h$", color=C_PURPLE, + fontsize=9.8, ha="center", va="bottom") + b.text(cx0, cy0 - rh - 0.28, "销轴 $d_s$", color=C_GREEN, + fontsize=9.8, ha="center", va="top") + b.text(cx0 - rh - 0.15, cy0 + 0.22, "始终相切", color=C_RED, fontsize=9.4, + ha="right", va="center") + b.text(cx0, -1.55, "$d_h=d_s+2a$", fontsize=12.5, ha="center") + b.set_xlim(-5.0, 4.4) + b.set_ylim(-3.3, 3.1) + + fig.tight_layout(rect=(0, 0.16, 1, 1)) + fig.text(0.5, 0.02, + "四个圆心:输出盘中心 $O_V$、销孔中心 $o_h$、销轴中心 $o_s$、" + "行星轮中心 $O_2$ —— 构成平行四边形;\n" + "$d_h$=销孔直径,$d_s$=销轴直径,$a$=行星轮与输出盘的中心距(偏心距)", + ha="center", va="bottom", fontsize=10.2, linespacing=1.8, + bbox=dict(boxstyle="round,pad=0.5", fc="#fbfbf6", ec="#d9d2c2")) + save(fig, "figG11_small_diff.png") + + +if __name__ == "__main__": + for f in [figG01, figG02, figG03, figG04, figG05, figG06, figG07, + figG08, figG09, figG10, figG11]: + try: + f() + except Exception as e: + import traceback + print("FAILED", f.__name__, "->", repr(e)) + traceback.print_exc() + print("done") diff --git a/笔记/知识点-轮系(齿轮系及其设计).md b/笔记/知识点-轮系(齿轮系及其设计).md new file mode 100644 index 0000000..f5bab88 --- /dev/null +++ b/笔记/知识点-轮系(齿轮系及其设计).md @@ -0,0 +1,318 @@ +# 知识点:轮系(齿轮系及其设计) + +> **来源**:`知识库/补充资源/机械原理PPT/08 齿轮系及其设计.pptx`(天大《机械原理》配套课件) +> **定位**:机械原理部分,紧接"齿轮机构"之后的一章(课件编号为第 8 章,即轮系章)。 +> **本章要解决的两件事**:① 各类轮系**传动比 $i$ 的计算**;② 从动轮**转向的判断**。 + +## 本章学习要求 + +| 层次 | 内容 | +|---|---| +| **熟练掌握** | 定轴轮系、周转轮系、复合轮系**传动比的计算方法** | +| 一般了解 | 轮系的功用;行星轮系**配齿公式**;几种典型的**少齿差行星轮系** | +| **本章重点** | 三类轮系传动比的计算 | + +--- + +## 1. 轮系的类型 + +**定义**:由一系列齿轮组成的传动系统,简称**轮系**。 + +> 导入实例(导弹快速反应装置):电动机两端各带一组齿轮,用两个电磁离合器 A、B 切换,使扇形蜗轮正转 / 反转 / 停转。因只有低速级参与反应、惯性力小,可在数毫秒内完成动作——说明轮系能实现**换向、变速、分路**等。 + +| 大类 | 子类 | 特征 | +|---|---|---| +| **定轴轮系** | 平面定轴轮系 | 各轮轴线**固定且互相平行** | +| | 空间定轴轮系 | 各轮轴线固定,但**不平行**(含锥齿轮、蜗杆等) | +| **周转轮系** | 差动轮系 | 自由度 **$F=2$** | +| | 行星轮系 | 自由度 **$F=1$**(有一个中心轮固定) | +| **复合轮系** | —— | 定轴轮系与周转轮系**混合**(或几个周转轮系串联) | + +![轮系的类型](images/figG01_geartrain_class.png) + +--- + +## 2. 定轴轮系的传动比 + +### 2.1 传动比大小的计算 + +- **一对齿轮**:$i_{12}=\dfrac{\omega_1}{\omega_2}=\dfrac{z_2}{z_1}$(主动轮 1、从动轮 2)。 +- **整个轮系**(**下标记法**,输入轴 1、输出轴 $K$): +$$i_{1K}=\dfrac{\omega_1}{\omega_K}=\dfrac{\text{所有从动轮齿数的连乘积}}{\text{所有主动轮齿数的连乘积}}$$ +- 判定增减速:$i_{1K}>1$ 为**减速**,$i_{1K}<1$ 为**增速**。 + +> **方法要点**:把轮系拆成若干"对",逐对写出传动比,再"**连乘**"。相邻两对中的**同一个齿轮(同轴双联齿轮)**既作前一对的从动轮、又作后一对的主动轮,故其齿数在分子分母中相消,**不影响传动比大小**。 + +![定轴轮系传动比](images/figG02_fixed_train.png) + +### 2.2 主、从动轮转向关系的确定 + +**(1)平面定轴轮系(各轮轴线互相平行)**——用符号 **+/-** 表示: + +| 啮合形式 | 两轮转向 | 符号 | +|---|---|---| +| 外啮合 | 相反 | **-** | +| 内啮合 | 相同 | **+** | + +设轮系中有 **$m$ 对外啮合齿轮**,则末轮转向可用 $(-1)^m$ 表示: +$$i_{1K}=(-1)^m\dfrac{\text{所有从动轮齿数的连乘积}}{\text{所有主动轮齿数的连乘积}}$$ + +**(2)空间定轴轮系(轴线不平行)**——**只能画箭头**判断转向: + +| 传动 | 判向规则 | +|---|---| +| **外啮合**(平行轴) | 两箭头**同时远离**或**同时指向**啮合点(头对头 / 尾对尾) | +| **内啮合**(平行轴) | 两箭头**同向** | +| **锥齿轮** | 两箭头**同时指向**啮合点或**同时背离**啮合点 | +| **蜗轮蜗杆** | **左旋用左手、右旋用右手**:四指弯曲方向为蜗杆转向,**拇指的相反方向**为蜗轮节点线速度方向 | + +![定轴轮系转向判断](images/figG03_direction.png) + +**(3)惰轮(过轮)**:轮系中齿数在分子、分母中**同时出现**的齿轮。 +- 对**传动比大小无影响**; +- 但能**改变从动轮的转向**(每增加一个外啮合惰轮,转向反一次)。 + +> **例题串**(课件):例1 求 $i_{15}$ 并定方向;例3 求 $i_{14}$、加一对齿轮后求 $i_{15}$;例4 **滚齿机主运动机构**——已知加工轮坯齿数 $=64$,反求齿轮 5、7 的齿数及滚刀旋向(含右旋单线蜗杆);另有空间定轴轮系的 $i_{17}$、$i_{15}$、蜗轮转向等例题。解题套路一致:**先写传动比大小通式 → 再逐轮画箭头定末轮转向**。 + +--- + +## 3. 周转轮系的传动比 + +### 3.1 组成与类型 + +- **基本构件**:**太阳轮(中心轮)**、**行星架(系杆 / 转臂)$H$**。 +- **其它构件**:**行星轮**——既有**自转**、又绕中心轮**公转**(类似行星运动,故名)。 +- 结构约束:**至少一个行星轮,最多两个中心轮**,且**中心轮与行星架的轴线必须重合**。 + +| 分类维度 | 类型 | 说明 | +|---|---|---| +| 按基本构件 | **2K-H 型** | 2 个中心轮 + 1 个行星架(最常见) | +| | **3K 型** | 3 个中心轮 | +| 按自由度 | **差动轮系** | $F=2$,需 2 个输入 | +| | **行星轮系** | $F=1$,1 个中心轮固定 | + +![周转轮系的组成](images/figG04_epicyclic.png) + +### 3.2 反转原理与"转化轮系" + +周转轮系中轮 1、3 和系杆作定轴转动,但**行星轮 2 既有自转又有公转**,故**不能直接求传动比**。 + +> **反转原理**:给整个周转轮系加上一个公共的附加角速度 **$-\omega_H$** 后,各构件之间的**相对运动不变**,但系杆被"固定",原周转轮系转化为一个**定轴轮系**——称为原轮系的**转化轮系**,于是可直接套用定轴轮系公式。 + +| 构件 | 原角速度 | 转化后角速度 | +|---|---|---| +| 1 | $\omega_1$ | $\omega_1^H=\omega_1-\omega_H$ | +| 2 | $\omega_2$ | $\omega_2^H=\omega_2-\omega_H$ | +| 3 | $\omega_3$ | $\omega_3^H=\omega_3-\omega_H$ | +| $H$ | $\omega_H$ | $\omega_H^H=\omega_H-\omega_H=0$(系杆成机架) | + +![反转原理与转化轮系](images/figG05_inversion.png) + +### 3.3 通用计算公式 + +$$\boxed{\;i_{GK}^{H}=\dfrac{\omega_G-\omega_H}{\omega_K-\omega_H}=\pm\dfrac{\text{转化轮系中 }G\to K\text{ 间所有从动轮齿数的连乘积}}{\text{转化轮系中 }G\to K\text{ 间所有主动轮齿数的连乘积}}\;}$$ + +其中 $G$ 为主动轮(通常取中心轮),$K$ 为从动轮,$H$ 为系杆;$\omega_G,\omega_K,\omega_H$ 均为**绝对角速度**。 + +**七个"特别注意"**: + +1. 右边齿数比前的 **± 号**判法与定轴轮系一致(由转化轮系中的外啮合对数决定),但该符号**只表示两轮在转化轮系中的转向**,**并不代表两轮的实际转向**。 +2. 公式中的 $\omega_G,\omega_K,\omega_H$ **自带正负号**:转向相同取同号、相反取异号。 +3. 齿轮 $G$、$K$ 与构件 $H$ 的**轴线必须平行**,公式才能用。 +4. 已知三个基本构件角速度中的**任意两个**,即可求第三个,进而求任意两构件间的传动比。 +5. **行星轮系**($F=1$):$\omega_G,\omega_K$ 中必有一个为 0(设 $\omega_K=0$),通式改写为 + $$i_{GK}^{H}=\dfrac{\omega_G-\omega_H}{0-\omega_H}=1-i_{GH}\quad\Longrightarrow\quad i_{GH}=1-i_{GK}^{H}$$ + 即 **$i_{1H}=1-i_{13}^{H}=1+\dfrac{z_3}{z_1}$**(中心轮 3 固定、2K-H 行星轮系,$1$ 主动)。 +6. 由**空间齿轮**组成的空间周转轮系,仍可用上式求**两中心轮与行星架之间**的转速关系。 +7. 公式中的 $\omega_i$ 可用转速 $n_i$ 代替(**同轴同向**时二者成比例)。 + +![周转轮系传动比公式](images/figG06_formula.png) + +### 3.4 典型例题 + +**例5(锥齿轮周转轮系——轴线不平行不能用通式)**:已知 $z_1=z_3=33$,$n_1=n_H=1\ \text{rpm}$ 但**转向相反**,求 $i_{13}^{H}$ 与 $n_3$。 +- 齿轮 1、3 在转化轮系中箭头方向相反 ⇒ $i_{13}^{H}=-1$; +- 取 $n_H$ 为正,则 $n_1$ 为负,$n_1-n_H=-2$; +- 由 $\dfrac{n_1-n_H}{n_3-n_H}=-1$ 得 $n_3-n_H=2$,即 **$n_3=3\ \text{rpm}$,与 $n_H$ 同向**。 +- **强调**:齿轮 1、3 与 $H$ **同轴**时公式成立;若**两者轴线不平行则不能直接算**(因 $\omega_2^{H}\neq\omega_2-\omega_H$),此时 $i_{13}\neq z_3/z_1$。 + +**例6(2K-H 行星轮系)**:$z_1=10,\ z_2=20$,轮 3 固定,求 $i_{1H}$。 +- 先求 $z_3=z_1+2z_2=50$; +- $i_{1H}=1+\dfrac{z_3}{z_1}=1+5=\mathbf{6}$,即小齿轮转 6 圈系杆转 1 圈,**两者转向相同**。 + +**例8(大传动比与齿数敏感性)**:双行星轮 2、2′ 的 2K-H 轮系。 + +| 齿数组合 | 结论 | +|---|---| +| $z_1=44,\ z_2=40,\ z_2'=42,\ z_3=42$ | 系杆转 11 圈时,轮 1 同向转 1 圈 | +| $z_1=100,\ z_2=101,\ z_2'=100,\ z_3=99$ | 系杆转 10000 圈时,轮 1 同向转 1 圈 | +| $z_1=100,\ z_2=101,\ z_2'=100,\ z_3=100$ | 系杆转 100 圈时,轮 1 **反向**转 1 圈 | + +> **重要结论**:行星轮系中**输出轴的转向不仅与输入轴转向有关,还与各轮齿数有关**——上表仅把轮 3 增加 1 个齿,轮 1 就反向旋转,且传动比发生**巨大变化**。这是行星轮系区别于定轴轮系的关键特性(齿数接近相等时,分母趋近于零 ⇒ 传动比趋向无穷大)。 + +--- + +## 4. 复合轮系的传动比 + +复合(混合)轮系 = 定轴轮系 + 周转轮系(或几个周转轮系串联)。**不能整体套一个公式**。 + +**解题三步**: + +1. **划分各个基本轮系**(**关键:先找出周转轮系**)。 + 1) 找**轴线不固定的齿轮**——即**行星轮**; + 2) 支承行星轮的构件——**行星架(系杆)**; + 3) 直接与行星轮啮合的齿轮——**太阳轮(中心轮)**。 + > 混合轮系中可能有多个周转轮系,但每个基本周转轮系"至少 1 个行星轮、最多 2 个中心轮";**剩下未划入周转轮系的部分就是定轴轮系**。 +2. 对每个基本轮系**分别列出传动比计算式**。 +3. 根据各基本轮系之间的**连接条件**(同轴、同构件)**联立方程**求解。 + +![复合轮系的划分与求解](images/figG07_composite.png) + +**课件例题**: + +- **例10**:电动卷扬机,$z_1=24,z_2=33,z_2'=21,z_3=78,z_3'=18,z_4=30,z_5=78$。 + 划分:周转轮系(行星轮 2、2′,行星架 5,太阳轮 1、3)+ 定轴轮系(3′、4、5)。 + 连接:$n_{3'} = n_3$,$n_5 = n_H$。联立可得 $i_{15}$(负号表示输入输出转向相反)。 +- **例11**:定轴轮系(1、1′、2、3)+ 周转轮系(3′、4、4′、5),联立求解 $i_{15}$。 +- **例12**:两个周转轮系串联(1、2、3、$H_1$ 与 4、5、6、$H_2$),求 $i_{1H_2}$。 + +--- + +## 5. 轮系的功用 + +![轮系的七项功用](images/figG08_functions.png) + +| # | 功用 | 说明与实例 | +|---|---|---| +| 1 | **获得大的传动比,且结构紧凑** | 一对齿轮 $i<5\sim7$;轮系 $i$ 可达 **10000** | +| 2 | **实现分路传动** | 钟表的时、分、秒针;1 路输入 → 多路输出 | +| 3 | **换向传动** | 改变从动轮转向(加惰轮 / 离合器切换) | +| 4 | **实现变速传动** | 移动双联齿轮,使不同齿数齿轮进入啮合以改变输出转速;也可用行星轮系变速 | +| 5 | **运动的合成(加减法运算)** | 差动轮系中 $z_1=z_2=z_3$ 时 $n_H=\dfrac{n_1+n_3}{2}$——行星架转速是轮 1、3 转速的**合成** | +| 6 | **运动的分解** | **汽车差速器**:由发动机给定的 $n_H$,按转弯半径自动分解为两后轮转速 $n_1,n_3$ | +| 7 | **小尺寸、小重量下实现大功率传动** | 如某涡桨发动机主减:外径仅 $\varnothing 430\,\text{mm}$,4 个行星轮 + 6 个中间轮,传递功率 **2850 kW**,$i_{1H}=11.45$ | + +**用途归纳**:减速器、增速器、变速器、换向机构。 + +### 汽车差速器(运动分解)详解 + +![汽车差速器(运动分解)](images/figG09_differential.png) + +- 结构:$z_1=z_3$(两半轴齿轮相同),行星架由发动机驱动、$n_H=n_4$。 +- 差动关系:$i_{13}^{H}=\dfrac{n_1-n_H}{n_3-n_H}=-1$ ⇒ $n_H=\dfrac{n_1+n_3}{2}$。 +- **仅由该式无法确定两后轮转速**,还需附加约束: + - **直线行驶(不打滑)**:$n_1=n_3$; + - **转弯**:车体绕 $P$ 点转动,$v_1=(r-L)\omega,\ v_3=(r+L)\omega$,故 + $$\frac{n_1}{n_3}=\frac{v_1}{v_3}=\frac{r-L}{r+L}$$ +- 结论:差速器按**转弯半径大小自动分解 $n_H$**,使 $n_1,n_3$ 符合转弯要求——**内侧轮慢、外侧轮快**,车轮始终作**纯滚动**。 + +--- + +## 6. 轮系的设计 + +### 6.1 定轴轮系的设计 + +**(1)类型选择**: +1. 优先选用**直齿圆柱齿轮**; +2. 高速、重载(为减小冲击、振动、噪音)时,用**平行轴斜齿轮**组成的定轴轮系; +3. 需**改变方向**(工作或结构空间要求)时,选含**圆锥齿轮**的空间定轴轮系; +4. 要求**传动比大、结构紧凑**或有**自锁**要求时,选含**蜗杆传动**的空间定轴轮系。 + +**(2)各轮齿数的确定**——关键是**合理分配各级传动比**: +1. 每一级传动比应在合理范围内:$i<5\sim7$; +2. **减速传动**(工程实际最常见)按"**前小后大**"原则分配; +3. 兼顾其它特殊要求。 + +### 6.2 周转轮系的设计 + +设计要解决两个问题:① **选择传动类型**;② **确定各轮齿数与行星轮个数**。 + +**(1)类型选择——正号机构与负号机构** + +| 类型 | 判据(转化轮系中 $H\to K$) | 特点 | +|---|---|---| +| **负号机构** | $i_{1K}^{H}<0$,$\omega_1^H$ 与 $\omega_K^H$ 方向**相反** | **效率高**,用于**传递动力** | +| **正号机构** | $i_{1K}^{H}>0$,二者方向**相同** | 理论传动比可达 $\infty$,但**效率低** | + +- **2K-H 轮系中有 4 种负号机构**,传动比范围分别约为 $i_{1H}=1.14\sim1.56$、$2$、$2.8\sim13$、$8\sim16$。 +- 选择原则: + 1. **正号机构**用在**传动比大、对效率要求不高**的辅助机构(如磨床进给机构、轧钢机指示器); + 2. **传递动力应采用负号机构**,因 **$\eta_{\text{负}}>\eta_{\text{正}}$**; + 3. 单级负号机构传动比不够时,可**串联几个负号机构**,或与定轴轮系组合成复合轮系,传动比范围 **$i_{1H}=10\sim60$**。 + +**(2)各轮齿数必须满足的四个条件**($z_1$ 为太阳轮、$z_2$ 为行星轮、$z_3$ 为内齿圈): + +| 条件 | 物理含义 | 表达式 | +|---|---|---| +| **①传动比条件** | 能实现给定传动比 | $z_3=i_{1H}z_1-z_1=(i_{1H}-1)z_1$ | +| **②同心条件** | 系杆轴线与两中心轮轴线重合 | $z_3=z_1+2z_2$(标准/等变位传动) | +| **③装配条件** | 能**均布装入 $N$ 个行星轮** | $\dfrac{z_1+z_3}{N}=K$(**整数**) | +| **④邻接条件** | 相邻两行星轮**不发生干涉** | $(z_1+z_2)\sin\dfrac{\pi}{N}>z_2+2h_a^*$ | + +![同心条件与装配条件](images/figG10_assembly.png) + +- **同心条件的推论**:$z_3=z_1+2z_2$ ⇒ **两中心轮齿数应同时为偶数或同为奇数**。 +- **装配条件的推导思路**:设 $N$ 个行星轮均布,相邻两轮夹角 $\varphi=2\pi/N$。固定内齿圈 3、转动系杆 $H$ 使 $\varphi_H=\varphi$,中心轮 1 转过角 $\varphi_1$;若 $\varphi_1=K\dfrac{2\pi}{z_1}$(即转过 **$K$ 个整齿**),则在原位又可装入下一个行星轮 ⇒ **$z_1+z_3$ 应能被行星轮个数 $N$ 整除**。 + +**(3)配齿公式**(合并前三个条件): +$$z_2=\dfrac{z_1(i_{1H}-2)}{2},\qquad z_3=z_1(i_{1H}-1),\qquad K=\dfrac{z_1 i_{1H}}{N}$$ +确定齿数时应保证 **$z_1,z_2,z_3,K$ 均为正整数**,且 **$z_1,z_2,z_3$ 均大于 $z_{\min}$**。 + +> **配齿例题**:已知 $i_{1H}=5$、$N=3$、标准齿轮,求各轮齿数。 +> $$z_1:z_2:z_3:K=1:\frac{5-2}{2}:(5-1):\frac{5}{3}=1:\frac{3}{2}:4:\frac{5}{3}=6:9:24:10$$ +> 取 $z_1=18$ ⇒ $z_2=27$、$z_3=72$。 +> 验算邻接条件:$(18+27)\sin\dfrac{\pi}{3}=39>27+2=29$,**满足要求**。 + +--- + +## 7. 其他类型行星传动简介:渐开线少齿差行星齿轮传动 + +在 2K-H 轮系中去掉小中心轮,把行星轮加大,使其与中心轮的**齿数差 $z_2-z_1=1\sim4$**,称为**少齿差行星传动**。 +- 系杆 $H$ 主动、输出行星轮的运动;但**行星轮作平面运动**,必须增加一个**运动输出机构 $V$** 才能把它的自转引出 ⇒ 称为 **K-H-V 型**行星轮系。 +- 传动比:$i_{H1}=\dfrac{n_H}{n_1}=\dfrac{z_1}{z_1-z_2}\cdot(-1)$ 型结构,齿数差很小时可获得**很大的单级传动比**。若 $z_2-z_1=1$(一齿差)、$z_1=100$,则 $|i_{H1}|=100$——输入轴转 100 圈,输出轴反向转 1 圈。 + +![少齿差行星传动与孔销式输出机构](images/figG11_small_diff.png) + +### 输出机构:孔销式 + +- 图示**双万向联轴节**输出机构:轴向尺寸大,且不适用于有两个行星轮的场合(不实用)。 +- 工程上广泛采用**孔销式输出机构**: + - 四个圆心(输出盘中心 $O_V$、销孔中心 $o_h$、销轴中心 $o_s$、行星轮中心 $O_2$)连线构成**平行四边形**; + - 满足条件 **$d_h=d_s+2a$**($d_h$ 销孔直径、$d_s$ 销轴直径、$a$ 行星轮与输出盘的中心距/偏心距)时,**销孔与销轴始终保持接触**。 + +### 优缺点 + +| 优点 | 缺点 | +|---|---| +| ① **传动比大**:一级 $i_{1H}$ 可达 135,二级可达 1000 以上 | ① 只能采用**正变位**齿轮传动,设计复杂,存在**重叠干涉** | +| ② **结构简单、体积小、重量轻**:同传动比同功率下比普通减速器轻 1/3 以上 | ② **传递功率不大**,$P\le45\,\text{kW}$(受输出机构限制) | +| ③ **加工简单、装配方便** | ③ **径向分力大**(啮合角 $\alpha'$ 大),行星轮轴承易损坏 | +| ④ **效率较高**:一级 $\eta=0.8\sim0.94$,比蜗杆传动高 | | + +根据齿廓曲线不同,工程上有两种结构:**渐开线少齿差行星减速器** 与 **摆线针轮减速器**。 + +--- + +## 易混点速查 + +| 易混内容 | 正确理解 | +|---|---| +| 定轴 vs 周转 | 判据是**轴线是否固定**(周转轮系中行星轮轴线绕中心轮公转) | +| 转化轮系里的 ± 号 | **只表示转化轮系中的转向关系**,不是两轮的实际转向 | +| 周转轮系用通式的前提 | $G,K,H$ **三者轴线必须平行**(锥齿轮空间轮系中"两齿轮轴线不平行"的**齿数比不能用**) | +| 行星轮系 $i_{1H}$ | $i_{1H}=1-i_{13}^{H}=1+\dfrac{z_3}{z_1}$(内齿圈固定、2K-H) | +| 正号 / 负号机构 | 以**转化轮系中 $\omega_1^H$ 与 $\omega_K^H$ 是否同向**判定;**动力传动选负号机构**(效率高) | +| 装配条件 vs 邻接条件 | 装配条件管"能否**均布装入 $N$ 个**行星轮";邻接条件管"相邻行星轮**别打架**" | +| 惰轮 | 只改转向、**不改**传动比大小 | +| 差速器 3 个未知数 | $n_1,n_3$ 需**附加约束**(直行 $n_1=n_3$ / 转弯按半径)才能求解 | +| 少齿差输出机构 | 因行星轮作**平面运动**,必须加**输出机构 $V$**(孔销式 $d_h=d_s+2a$) | + +## 本章要点回顾 + +1. **轮系分类**:定轴(平面/空间)、周转(差动 $F=2$ / 行星 $F=1$)、复合。 +2. **定轴传动比**:$i_{1K}=(-1)^m\dfrac{\prod z_{\text{从}}}{\prod z_{\text{主}}}$;平面用符号、空间画箭头;惰轮只改向。 +3. **周转传动比(反转原理)**:$i_{GK}^{H}=\dfrac{\omega_G-\omega_H}{\omega_K-\omega_H}=\pm\dfrac{\prod z_{\text{从}}}{\prod z_{\text{主}}}$(转化轮系内);注意符号与轴线平行前提。 +4. **复合轮系**:**先找行星轮 → 定行星架 → 定太阳轮**,划分基本轮系后分别列式、按连接条件联立。 +5. **七大功用**:大传动比、分路、换向、变速、运动合成、运动分解(差速器)、小体积大功率。 +6. **设计**:定轴——合理分配传动比(前小后大);周转——选型(动力用负号机构)+ 四条件配齿(传动比 / 同心 / 装配 / 邻接)。 +7. **少齿差行星传动**(K-H-V 型):$z_2-z_1=1\sim4$,配孔销式输出机构 $d_h=d_s+2a$,单级传动比大但功率受限。 diff --git a/笔记/知识点-齿轮(知识库整合).md b/笔记/知识点-齿轮(知识库整合).md new file mode 100644 index 0000000..21c5e89 --- /dev/null +++ b/笔记/知识点-齿轮(知识库整合).md @@ -0,0 +1,620 @@ +# 齿轮知识点总结 + +> **来源(唯一参考资料源)**:`知识库/{3}--资源/` +> - `(36)--第八章 齿轮机构.pdf`(机械原理 · 天津大学课件,123 页) +> - `(22)--第18章 齿轮传动.pdf`(机械设计 · 天津大学课件,96 页) +> +> **说明**:本文件按上述两份课件原文整理,分「机械原理(齿轮机构)」与「机械设计(齿轮传动)」两部分,末尾附易混点速查表。原基于已删除参考仓库的版本已作废。 +> 注:本资源未包含「齿轮系(轮系)」章节课件,故本文暂不含轮系内容。 + +--- + +# 第一部分 齿轮机构(机械原理 · 第八章) + +## 一、齿轮机构的特点与分类 + +**特点(优点)** +① 传动比准确、传动平稳;② 圆周速度范围大(高达 **300 m/s**);③ 传动功率范围大(几瓦 ~ 10 万千瓦);④ 效率高($\eta\approx0.98$)、寿命长、工作可靠;⑤ 可实现**平行轴、相交轴、交错轴**之间的传动。 +**缺点**:制造和安装精度要求高、加工成本高、不宜远距离传动。 + +**分类** + +| 分类依据 | 类型 | +| ------ | ---------------------------------------------------------------------------- | +| 两轴相对位置 | **平面齿轮机构**(平行轴:外啮合 / 内啮合 / 齿轮齿条);**空间齿轮机构**(相交轴→圆锥齿轮;交错轴→蜗杆机构、交错轴斜齿轮、准双曲面齿轮) | +| 轮齿排列方向 | 直齿、斜齿、人字齿、曲线齿 | +| 齿廓曲线 | 渐开线(1765)、摆线(1650)、圆弧(1950)、抛物线(近年)、球齿轮等 | +| 传动比 | 定传动比 / 变传动比(非圆齿轮) | +| 速度高低 | 高速 / 中速 / 低速 | +| 封闭形式 | 开式 / 闭式 | + +- **共轭齿廓**:一对能实现预定传动比 $i_{12}=\omega_1/\omega_2$ 规律的啮合齿廓。 +- 工程上应用最广的齿廓是**渐开线**(便于制造和检测)。 + +--- + +## 二、齿廓啮合基本定律与齿廓曲线 + +**传动比** +- 瞬时传动比 $i_{12}=\dfrac{\omega_1}{\omega_2}$;(由 $i_{12}=\omega_1/\omega_2=\mathrm{const}$ 的机构称定传动比齿轮机构) +- 平均传动比 $i_{12}=\dfrac{n_1}{n_2}=\dfrac{z_2}{z_1}$。 + +**齿廓啮合基本定律** +一对齿廓在任意点 K 接触,过 K 作法线 n-n 交连心线 $O_1O_2$ 于 P: + +$$i_{12}=\frac{\omega_1}{\omega_2}=\frac{O_2P}{O_1P}$$ + +即:**一对齿轮的瞬时传动比,等于两轮连心线被啮合节点分成的两线段的反比。** +P 点称**啮合节点**。 + +**定传动比条件** +> 无论两齿廓在何处接触,过啮合点所作的公法线必须与两轮连心线始终交于**一定点**。 + +**节圆** +节点 P 在分别与两轮固结的动平面上的轨迹(以 $O_1$、$O_2$ 为圆心的两圆)称**节圆**。两节圆在 P 点相切、速度相等,故定传动比啮合可视为**两节圆作纯滚动**。 +$r_1'$、$r_2'$ 为节圆半径,中心距 $a=r_1'+r_2'$。 +(**强调**:节圆是在两齿轮啮合时才出现的参数。) + +![齿廓啮合基本定律](images/fig04_pitch_law.png) +*图 4 齿廓啮合基本定律:公法线 $N_1N_2$ 与连心线交于定点 $P$,$i_{12}=O_2P/O_1P$* + +--- + +## 三、渐开线齿廓及其啮合特性 + +### 1. 渐开线的形成 +一条直线(**发生线**)在圆(**基圆** $r_b$)上作纯滚动时,直线上任一点的轨迹,称为该圆的**渐开线**。 + +![渐开线的形成](images/fig01_involute_form.png) +*图 1 渐开线的形成:发生线沿基圆纯滚动,其上一点的轨迹即渐开线* + +### 2. 渐开线的性质(口诀:弧长等于发生线,基圆切线是法线,曲线形状随基圆,基圆内无渐开线) + +1. 发生线上线段 = 基圆上被滚过的弧长($AB=BK$); +2. 渐开线上任意点的**法线切于基圆**; +3. B 点为曲率中心,BK 为曲率半径;**起始点 A 处曲率半径为零**,越远离基圆曲率半径越大; +4. 渐开线形状**取决于基圆大小**($r_b\to\infty$ 时变成直线); +5. **基圆内无渐开线**。 + +### 3. 压力角与渐开线方程 +- 压力角定义:啮合时 K 点正压力方向与速度方向所夹锐角 $\alpha_K$。 + +$$\cos\alpha_K=\frac{r_b}{r_K},\qquad r_b=r_K\cos\alpha_K$$ + +渐开线上**离中心越远,压力角越大**(基圆上 $\alpha_b=0$)。 + +![压力角随半径变化](images/fig02_pressure_angle.png) +*图 2 齿廓上各点压力角不同:越远离基圆,压力角越大* + +- 渐开线函数: + +$$\theta_K=\tan\alpha_K-\alpha_K=\mathrm{inv}\,\alpha_K$$ + +### 4. 渐开线齿廓的啮合特性(三条) + +1. **瞬时传动比恒定**——两齿廓法线 $N_1N_2$ 是两轮基圆的公切线(定直线),与连心线交点 P 为定点,故 $i_{12}=\mathrm{const}$。 +2. **啮合线和啮合角恒定不变**——啮合线 $N_1N_2$ 是接触点的法线,正压力方向不变,传动平稳。 + **啮合角** $\alpha'$:啮合线与节圆公切线之间的夹角。 +3. **运动可分性**——实际中心距略有变化时不影响 $i_{12}$: + +$$i_{12}=\frac{\omega_1}{\omega_2}=\frac{O_2P}{O_1P}=\frac{r_{b2}}{r_{b1}}$$ + +(中心距变化不影响传动比,对加工装配很有利。) + +--- + +## 四、渐开线标准直齿圆柱齿轮的基本参数与尺寸 + +### 1. 各部分名称("四圆、三高") + +| 名称 | 符号 | 说明 | +|---|---|---| +| 分度圆 | $d,\ r$ | 人为规定的计算基准圆(设计制造的基准) | +| 基圆 | $d_b,\ r_b$ | 产生渐开线的圆 | +| 齿顶圆 | $d_a,\ r_a$ | 过齿顶作的圆 | +| 齿根圆 | $d_f,\ r_f$ | 过齿槽底作的圆 | +| 齿顶高 | $h_a$ | 分度圆到齿顶圆的径向高度 | +| 齿根高 | $h_f$ | 分度圆到齿根圆的径向高度 | +| 全齿高 | $h=h_a+h_f$ | — | + +- 齿厚 $s_k$、齿槽宽 $e_k$、齿距 $p_k=s_k+e_k$;法向齿距(法节)$p_n=p_b$;齿宽 $B$。 + +![齿轮各部分名称](images/fig03_gear_parts.png) +*图 3 齿轮各部分名称(四圆、三高)* + +### 2. 五个基本参数 + +| 参数 | 符号 | 规定 | +|---|---|---| +| 齿数 | $z$ | — | +| **模数** | $m=p/\pi$ | 人为规定取某些简单值(GB1357-87);$d=mz$ | +| **压力角** | $\alpha$ | 分度圆压力角,标准值 $\alpha=20^\circ$(偶用14.5°、15°、22.5°、25°) | +| 齿顶高系数 | $h_a^*$ | 正常齿 $h_a^*=1$;短齿 $h_a^*=0.8$ | +| 顶隙系数 | $c^*$ | 正常齿 $c^*=0.25$;短齿 $c^*=0.3$;顶隙 $c=c^*m$ | + +> **三个基本参数:$m$、$z$、$\alpha$。** 其中 $d_b=d\cos\alpha$。 +> **标准齿轮特征**:分度圆上 $m$、$\alpha$ 为标准值;分度圆上 $e=s$;具有标准的齿顶高、齿根高。 +> 顶隙作用:储油润滑、避免卡死(齿根高比齿顶高大些)。 + +### 3. 几何尺寸计算公式 + +| 名称 | 公式 | +| ----- | --------------------------------- | +| 分度圆直径 | $d=mz$ | +| 齿顶高 | $h_a=h_a^*m$ | +| 齿根高 | $h_f=(h_a^*+c^*)m$ | +| 全齿高 | $h=(2h_a^*+c^*)m$ | +| 齿顶圆直径 | $d_a=d+2h_a=(z+2h_a^*)m$ | +| 齿根圆直径 | $d_f=d-2h_f=(z-2h_a^*-2c^*)m$ | +| 基圆直径 | $d_b=d\cos\alpha=mz\cos\alpha$ | +| 法向齿距 | $p_n=p_b=\pi m\cos\alpha$ | +| 标准中心距 | $a=r_1+r_2=\dfrac{m(z_1+z_2)}{2}$ | + +### 4. 齿条与内齿轮 + +- **齿条**($z\to\infty$ 的特例,齿廓渐开线变直线):压力角处处相等且等于齿形角;齿距处处相等 $p=\pi m$;$s=e=\pi m/2$;$h_a=h_a^*m$、$h_f=(h_a^*+c^*)m$、$p_n=p\cos\alpha$。 +- **内齿轮**:轮齿分布在空心圆柱体**内表面**;轮齿与齿槽与外齿轮相反;$d_f>d>d_a$;$d_a=d-2h_a$、$d_f=d+2h_f$;为保证齿廓全部为渐开线,要求 $d_a>d_b$。 + +### 5. 任意圆上的齿厚 + +$$s_i=\frac{s\,r_i}{r}-2r_i(\mathrm{inv}\,\alpha_i-\mathrm{inv}\,\alpha)$$ + +(设计时需算齿顶圆齿厚校核齿顶强度、算节圆齿厚确定齿侧间隙。) + +--- + +## 五、渐开线直齿圆柱齿轮的啮合传动 + +### 1. 正确啮合条件 +使进入啮合区的各对轮齿都正确啮合,须满足相邻两齿同侧齿廓间法向距离相等: + +$$p_{b1}=p_{b2}\ \Rightarrow\ m_1\cos\alpha_1=m_2\cos\alpha_2\ \Rightarrow\ \boxed{m_1=m_2,\quad \alpha_1=\alpha_2}$$ + +即**两轮的模数和压力角应分别相等**。 + +### 2. 中心距 a 与啮合角 α′ +对标准齿轮,确定中心距应满足:① 理论上齿侧间隙为零($s_1'-e_2'=0$);② 顶隙为标准值 $c=c^*m$。 +得**标准中心距**:$a=r_1+r_2=\dfrac{m(z_1+z_2)}{2}$(标准安装)。 + +| 安装情况 | 关系 | +|---|---| +| 标准安装 | $a'=a$,$\alpha'=\alpha$,$r'=r$(节圆与分度圆重合) | +| 非标准安装 | $a'>a$,$\alpha'>\alpha$,$r'>r$ | + +**重要结论**:$a'\cos\alpha'=a\cos\alpha$。 +> **特别注意**:分度圆和压力角是单个齿轮就有的;节圆和啮合角是两个齿轮啮合后才出现的。 +> 齿轮齿条传动:标准安装时**节线与分度线重合**,$\alpha'=\alpha$。 + +### 3. 一对轮齿的啮合过程 +- $B_2$:**起始啮合点**(从动轮顶圆与 $N_1N_2$ 的交点,主动轮齿根推从动轮齿顶); +- $B_1$:**终止啮合点**(主动轮顶圆与 $N_1N_2$ 的交点); +- $B_1B_2$:**实际啮合线**;$N_1N_2$:**理论啮合线**;$N_1$、$N_2$:**啮合极限点**。 + +![实际啮合线](images/fig05_mesh_line.png) +*图 5 一对轮齿的啮合过程:实际啮合线 $B_1B_2\subset$ 理论啮合线 $N_1N_2$* + +### 4. 连续传动条件与重合度 +- **连续传动条件**:前一对轮齿脱离啮合之前,后一对必须及时进入啮合,即 $B_1B_2\ge p_b$。 +- **重合度**:$\varepsilon=\dfrac{B_1B_2}{p_b}$,要求 $\varepsilon\ge1$;工程上 $\varepsilon\ge[\varepsilon]$。 + +| 使用场合 | 一般机械制造业 | 汽车拖拉机 | 金属切削机床 | +|---|---|---|---| +| $[\varepsilon]$ | 1.4 | 1.1~1.2 | 1.3 | + +- 外啮合重合度公式: + +$$\varepsilon_\alpha=\frac{z_1(\tan\alpha_{a1}-\tan\alpha')+z_2(\tan\alpha_{a2}-\tan\alpha')}{2\pi}$$ + +> 重合度 $\varepsilon_\alpha$ 与 $z$、$h_a^*$、$\alpha'$、$\alpha$ 有关,**与模数 $m$ 无关**(表示同时参与啮合的轮齿对数平均值)。 +> 影响因素:$z\uparrow$、$h_a^*\uparrow$、$\alpha\uparrow$ → $\varepsilon_\alpha\uparrow$;$\alpha'\uparrow$ → $\varepsilon_\alpha\downarrow$。 + +- 单齿啮合区长度 $L_1=(2-\varepsilon_\alpha)p_b$;双齿啮合区长度 $L_2=2(\varepsilon_\alpha-1)p_b$。 + +![重合度与单双齿啮合区](images/fig06_contact_ratio.png) +*图 6 重合度 $\varepsilon_\alpha$ 与单/双齿啮合区* + +### 5. 齿廓的滑动与磨损 +啮合点离节点越远,相对滑动速度越大、磨损越严重;**小齿轮的齿根部分磨损最严重**。设计时应使实际啮合线的 $B_2$ 点远离极限点 $N_1$。 + +--- + +## 六、渐开线齿轮的加工原理 + +| 方法 | 说明 | 特点 | +|---|---|---| +| **仿形法(成形法)** | 盘状铣刀 / 指状铣刀,刀具截面齿形与齿槽形状相同 | 有齿形误差和分度误差、精度低、加工不连续、效率低,**适于单件生产**(8 把一组按齿数选刀) | +| **展成法(范成法 / 包络法)** | 齿轮插刀、齿条插刀、齿轮滚刀,利用"一对轮齿啮合时齿廓互为包络线" | 一种模数只需一把刀具、连续切削、效率高精度高,**用于批量生产** | + +- 标准齿条型刀具基准齿形由 GB1356-88 规定;加工标准齿轮时刀具分度线与轮坯分度圆作纯滚动,$s=e=\pi m/2$。 +- 滚刀加工时需**倾斜一个螺旋升角**(相当于齿轮齿条啮合)。 + +### 根切现象 +- **定义**:用展成法加工时,齿根已加工好的渐开线齿廓又被切掉一部分。 +- **后果**:削弱轮齿抗弯强度、使重合度 $\varepsilon$ 下降。 +- **根本原因**:刀具齿顶线与啮合线的交点 $B_2$ 落在极限啮合点 $N_1$ 的右上方,即 **$PB_2>PN_1$**。 +- **不发生根切的条件**: + +$$z\ge\frac{2h_a^*}{\sin^2\alpha}\ \Rightarrow\ z_{\min}=\frac{2h_a^*}{\sin^2\alpha}$$ + +当 $\alpha=20^\circ$、$h_a^*=1$ 时,**$z_{\min}=17$**。 + +![根切](images/fig07_undercut.png) +*图 7 根切:$z0$);刀具**趋近**轮坯中心 → **负变位**($x<0$);移动量 $xm$,$x$ 为变位系数。 +- 避免根切的最小变位系数: + +$$x_{\min}=\frac{h_a^*(z_{\min}-z)}{z_{\min}}$$ + +### 3. 变位齿轮的几何尺寸 +- **不变**:$m$、$z$、$\alpha$($d$、$d_b$ 与标准齿轮相同,齿廓取自同一条渐开线的不同段)。 +- **变化**:齿顶高、齿根高、齿顶圆半径、齿厚及齿槽宽。 + +| 项目 | 公式 | +|---|---| +| 齿顶高 | $h_a=(h_a^*+x)m$ | +| 齿根高 | $h_f=(h_a^*+c^*-x)m$ | +| 齿顶圆半径 | $r_a=r+(h_a^*+x)m$ | +| 齿厚 | $s=\pi m/2+2xm\tan\alpha$(正变位齿厚变宽) | +| 齿槽宽 | $e=\pi m/2-2xm\tan\alpha$ | + +![变位齿轮齿形对比](images/fig08_modification.png) +*图 8 变位齿轮齿形对比(同一基圆、同一条渐开线的不同段)* + +### 4. 变位齿轮啮合传动的几何尺寸 +- 一对变位齿轮啮合时分度圆不再相切,中心距改变、啮合角变化。 +- **无侧隙啮合方程**: + +$$\mathrm{inv}\,\alpha'=\frac{2(x_1+x_2)}{z_1+z_2}\tan\alpha+\mathrm{inv}\,\alpha$$ + +(将齿数、变位系数之和、啮合角联系起来,是变位齿轮设计的重要公式。) +- 中心距关系:$a'=a\dfrac{\cos\alpha}{\cos\alpha'}$;**中心距变动系数** $y$:$ym=a'-a$。 +- **齿高变动系数** $\Delta y=x_1+x_2-y$;为保证标准顶隙,齿顶高需再降低一段:$h_a=h_a^*m+xm-\Delta y\,m$。 + +### 5. 三种传动类型(按 $x_1+x_2$ 分) + +| 类型 | 条件 | 中心距/啮合角 | 特点 | +|---|---|---|---| +| **零传动** | $x_\Sigma=0$ | $a'=a,\ \alpha'=\alpha,\ r'=r,\ y=0,\ \Delta y=0$ | 分**标准齿轮传动**($x_1=x_2=0$)与**高度变位(等移距变位)**($x_1=-x_2\ne0$) | +| **正传动** | $x_\Sigma>0$ | $a'>a,\ \alpha'>\alpha,\ y>0,\ \Delta y>0$ | 齿数选择范围宽(可 $z_1+z_2<2z_{\min}$)、可凑非标中心距;缺点:无互换性、$\varepsilon_\alpha\downarrow$ 明显、注意齿顶变尖 | +| **负传动** | $x_\Sigma<0$ | $a'2z_{\min}$;强度与抗磨性都变差,**一般只用来凑中心距** | + +- **高度变位**齿数条件:$z_1+z_2\ge2z_{\min}$,小齿轮取正变位、大齿轮取负变位;优点:可用 $z_1\le z_{\min}$ 的小齿轮、改善小齿轮磨损、使大小齿轮强度趋于接近;缺点:无互换性、须成对使用、$\varepsilon_\alpha$ 略减。 +- 正、负传动均属**角度变位**。 + +### 6. 几何设计步骤(三种目的:避免根切 / 提高强度 / 凑中心距) +① 选择齿数;② 计算最小变位系数、选择两轮变位系数;③ 计算啮合角、中心距和几何尺寸;④ **核验重合度和正变位齿轮的齿顶圆齿厚**,一般要求 $s_a>(0.2\sim0.4)m$。 + +--- + +## 八、斜齿圆柱齿轮机构 + +### 1. 齿廓曲面的形成 +发生面在基圆柱上纯滚动时,发生面内**与轴线倾斜 $\beta_b$(基圆柱螺旋角)的直线 KK** 所展成的曲面,称**渐开螺旋面**。 +- 与发生面相交是斜直线;与圆柱面相交是螺旋线;与端面相交是渐开线。 +- 啮合时接触线为一条斜直线,始终与 KK 平行且位于两基圆公切面内。 + +### 2. 法面参数与端面参数 + +| 参数 | 下标 | 用途 | +|---|---|---| +| 法面参数 | n | **标准值**(刀具沿螺旋线方向切削) | +| 端面参数 | t | 用于**几何尺寸计算**(各圆在端面上) | + +换算关系: + +$$m_n=m_t\cos\beta,\qquad \tan\alpha_n=\tan\alpha_t\cos\beta,\qquad \tan\beta_b=\tan\beta\cos\alpha_t$$ + +- **螺旋角 $\beta$**:分度圆柱上的螺旋角。判别旋向:观察者面向齿轮、轴线铅垂,齿向线偏右为**右旋**,偏左为**左旋**。 + +![斜齿轮螺旋角与法面端面参数](images/fig09_helical.png) +*图 9 斜齿轮:分度圆柱螺旋线 与 法面/端面参数关系($p_n=p_t\cos\beta$)* + +### 3. 几何尺寸 +- 分度圆直径:$d=z m_t=\dfrac{z m_n}{\cos\beta}$ +- 中心距:$a=\dfrac{m_n(z_1+z_2)}{2\cos\beta}$(可**通过改变 $\beta$ 调整中心距**) + +### 4. 平行轴斜齿轮传动 +- **正确啮合条件**:$m_{n1}=m_{n2}=m$、$\alpha_{n1}=\alpha_{n2}=\alpha$,且螺旋角匹配:外啮合 $\beta_1=-\beta_2$;内啮合 $\beta_1=\beta_2$。 +- **啮合特点**:接触线长度"短→长→短"变化,加载卸载逐渐进行 → 传动平稳、冲击振动噪声小,适宜高速重载;端面内相当于直齿圆柱齿轮传动,满足定传动比。 +- **重合度**:$\varepsilon_\gamma=\varepsilon_\alpha+\varepsilon_\beta$,其中 $\varepsilon_\beta=\dfrac{b\sin\beta}{\pi m_n}$ 为**纵向重合度**。 + +### 5. 当量齿数 +以分度圆 C 点法剖面上的曲率半径 $\rho$ 作当量齿轮分度圆半径: + +$$z_v=\frac{z}{\cos^3\beta},\qquad r_v=\rho=\frac{d}{2\cos^2\beta}$$ + +- 斜齿轮不发生根切的最少齿数:$z_{\min}=z_{v\min}\cos^3\beta$($\beta=20^\circ$ 时 $z_{\min}\approx14$)。 + +### 6. 特点 +① 啮合平稳性好(最突出优点);② 承载能力大(重合度大、接触线总长大);③ 结构尺寸可更紧凑($z_{\min}$ 更小);④ 制造成本不增加。 +**缺点**:产生轴向分力 $F_a=F_t\tan\beta$,且随 $\beta$ 增大而增大 → 螺旋角一般取 **8°~15°**;或用**人字齿轮**消除轴向力。 + +### 7. 交错轴斜齿轮传动(螺旋齿轮传动) +- 由一对轴线不平行的斜齿轮组成,实现空间交错轴传动;两轮螺旋角不一定相等、旋向不一定相反。 +- 交错角 $\Sigma=|\beta_1+\beta_2|$($\beta$ 取代数值)。 +- 啮合时两齿廓**点接触**,接触应力大、承载能力低,只用于速度不高、载荷不大的场合。 + +--- + +## 九、蜗杆机构 + +### 1. 形成与类型 +- 可看成由**交错轴斜齿轮机构演变**而来;小齿轮齿数很少($z_1=1\sim4$)、螺旋角很大、轮齿绕圆柱整周 → **蜗杆**;大齿轮称**蜗轮**。通常蜗杆主动、蜗轮从动,**交错角 $\Sigma=90^\circ$**。 + +![蜗杆机构](images/fig11_worm.png) +*图 11 蜗杆机构(交错角 $\Sigma=90^\circ$):蜗杆与蜗轮* +- 为使啮合由点接触改善为**线接触**:① 蜗轮分度圆柱直母线作成与蜗杆轴同心的圆弧,使蜗轮部分包住蜗杆;② 用与蜗杆形状基本相同的滚刀加工蜗轮。 +- 类型:**圆柱蜗杆机构**(应用最广的是**阿基米德蜗杆**——轴面齿形为标准齿条,垂直轴面为阿基米德螺线)和**圆弧面蜗杆机构**(环面蜗杆)。 + +### 2. 基本参数 +- **主平面**:过蜗杆轴线且垂直于蜗轮轴线的平面(蜗轮的端截面、蜗杆的轴截面);此平面内啮合相当于齿轮齿条啮合。 +- 蜗杆**头数** $z_1$(一般取1、2、4、6);单头蜗杆传动比大、反行程自锁,但效率低。 +- 蜗轮齿数 $z_2$:$z_1=1$ 时 $z_2\ge17$;$z_1=2$ 时 $z_2\ge27$;动力传动 $z_2<80$。 +- 蜗杆直径系数 $q$($d_1=mq$,国标规定 $d_1$ 标准值并与模数匹配);**导程角** $\gamma_1$: + +$$\tan\gamma_1=\frac{mz_1}{d_1}$$ + +### 3. 正确啮合条件 +$$m_{x1}=m_{t2}=m,\qquad \alpha_{x1}=\alpha_{t2}=\alpha,\qquad \gamma_1=\beta_2\ (\Sigma=90^\circ)$$ + +### 4. 传动比与转向 +- $i=\dfrac{\omega_1}{\omega_2}=\dfrac{z_2}{z_1}$(注意:$i\ne d_2/d_1$)。 +- 蜗轮转向:**右旋蜗杆用左手、左旋蜗杆用右手**,四指顺蜗杆转向,拇指指向即蜗轮切向速度方向。 +- 蜗杆与螺旋相似分左、右旋(一般用右旋);蜗轮轮齿旋向与蜗杆相同。 + +--- + +## 十、直齿锥齿轮机构 + +- 用于传递**两相交轴**间运动,轴间夹角一般 $90^\circ$;轮齿分布在圆锥上,圆柱齿轮中的分度圆柱在锥齿轮中成为分度圆锥、齿顶圆锥、基圆锥等。 + +### 1. 齿廓的形成 +半径 R 与基圆锥锥距相等的圆平面(发生面)绕基圆锥纯滚动时,其任一半径展出的曲面称**渐开线锥面**;球心在锥顶、半径 R 的球面与渐开线锥面的交线称**球面渐开线**。 + +### 2. 背锥与当量齿轮 +过大端作母线与分度圆锥母线**垂直**的圆锥称**背锥**;将球面渐开线齿廓投影到背锥上、并把展开后的扇形齿轮补齐,称**当量齿轮**。 + +![锥齿轮与当量齿轮](images/fig10_bevel.png) +*图 10 直齿锥齿轮:分度圆锥、背锥与当量齿轮* + +$$z_v=\frac{z}{\cos\delta}\quad(\text{当量齿数}),\qquad r_v=\frac{r}{\cos\delta}=\frac{zm}{2\cos\delta}$$ + +### 3. 几何与啮合 +- **大端参数为标准值**;分不等顶隙收缩齿与**等顶隙收缩齿**(强度较好、应用较多)。 +- **正确啮合条件**:两轮**大端**的模数和压力角分别相等;两轮锥距相等、锥顶重合。 +- 传动比($\Sigma=90^\circ$ 时): + +$$i_{12}=\frac{\omega_1}{\omega_2}=\frac{z_2}{z_1}=\frac{r_2}{r_1}=\frac{\sin\delta_2}{\sin\delta_1}=\cot\delta_1=\tan\delta_2$$ + +- $z_1=90^\circ-\delta_2$ 关系:$\delta_2=\arctan(z_2/z_1)$,$\delta_1=90^\circ-\delta_2$。 + +> **本章重点**:① 渐开线的形成与性质;② 标准齿轮参数计算;③ 正确啮合条件与重合度;④ 根切、最少齿数、变位齿轮齿厚计算;⑤ 斜齿轮法面与端面参数关系。 + +--- + +# 第二部分 齿轮传动(机械设计 · 第18章) + +## 一、概述 + +### 1. 设计中的两个基本问题 +① **传动平稳**——瞬时传动比恒定,尽可能减小冲击、振动和噪声; +② **足够的承载能力**——在尺寸质量较小时,保证所需的强度、耐磨性,在预定使用期限内不发生失效。 + +### 2. 分类 +- **按工作条件**:闭式齿轮传动 / 开式齿轮传动。 +- **按齿面硬度**:**软齿面**(一对啮合齿轮齿面硬度 ≤350HBS)/ **硬齿面**(均 >350HBS)。 + +### 3. 主要参数 +| 参数 | 说明 | +|---|---| +| 模数 $m$ | 按标准模数系列(GB1357-87)选取 | +| 传动比 $i$、齿数比 $u$ | $u=z_2/z_1>1$ | +| 中心距 $a$ | 圆柱齿轮传动的特征尺寸,应取整齐简单值 | +| 齿宽 $b$、齿宽系数 $\psi_d$ | $\psi_d=b/d_1$;一般 $b_2=b$、$b_1=b_2+(5\sim10)$ mm | +| 精度等级 | 渐开线圆柱齿轮和锥齿轮精度标准规定有 **12 个精度等级**(级别越高精度越低) | + +--- + +## 二、轮齿的失效形式与设计准则 + +### 1. 五种失效形式 + +| 失效形式 | 机理与位置 | 措施 | +|---|---|---| +| **轮齿折断** | 一般发生在齿根处;严重过载突然断裂或疲劳折断 | 增大齿根过渡圆角、消除加工刀痕;增大轴及支承刚度使受载均匀;合适热处理保证芯部韧性;喷丸、滚压强化齿根表层 | +| **齿面点蚀** | 齿面接触应力按脉动循环变化,超过疲劳极限时产生微裂纹→微粒剥落;**首先出现在节线处**;齿面越硬抗点蚀越强;软齿面闭式传动常因点蚀失效 | 提高材料硬度、降低表面粗糙度、合理加高黏度油、减小动载荷 | +| **齿面胶合** | **高速重载**时啮合区温度升高、润滑失效,金属直接接触粘连,较软齿面被撕下成沟纹 | 提高齿面硬度、减小粗糙度、低速用高黏度油、高速加抗胶合添加剂 | +| **齿面磨损** | 跑合磨损、磨粒磨损;磨粒磨损是**开式传动**主要失效形式 | 减小齿面粗糙度、改善润滑、保持清洁、提高齿面硬度 | +| **齿面塑性变形** | 轮齿材料过软、应力超屈服极限 | 提高齿面硬度、采用高黏度或含极压添加剂润滑油 | + +> 塑性变形方向:**主动轮**节线处**下凹**,**从动轮**节线处**凸起**。 + +### 2. 设计准则(由工程实践得知) + +| 传动类型 | 主要失效 | 设计/校核方法 | +|---|---|---| +| **闭式软齿面** | 齿面点蚀 | **按齿面接触疲劳强度设计**(先定 $d_1$、$a$、$b$),再校核齿根弯曲疲劳强度 | +| **闭式硬齿面** | 轮齿折断 | **按齿根弯曲疲劳强度设计**(先定 $m$),再校核齿面接触疲劳强度 | +| **开式传动** | 磨粒磨损、弯曲疲劳折断 | 通常只按**弯曲疲劳强度**计算,并适当加大模数考虑磨损影响 | +| 高速重载 | 齿面胶合 | 除上述两条外,还需按**抗胶合能力**准则设计 | + +### 3. 提高轮齿抗折断能力的措施 +① 增大齿根过渡圆角半径、消除加工刀痕、减小应力集中;② 增大轴及支承刚度;③ 合适热处理使芯部有足够韧性;④ 喷丸、滚压等强化齿根表层。 + +--- + +## 三、齿轮材料及其选择 + +- **要求**:齿面硬、芯部韧(齿体有较高抗折断能力,齿面有较强抗点蚀、抗磨损和抗胶合能力)。 +- **常用材料**: + - **锻钢**(含碳量 0.15%~0.6% 的碳素钢或合金钢)——最适于制造齿轮;一般齿轮用碳素钢、重要齿轮用合金钢; + - **铸钢**——耐磨性及强度较好,用于**大尺寸**齿轮; + - **铸铁**——用于低速、轻载、不太重要的场合; + - **非金属材料**——高速、轻载、要求降低噪声的场合。 +- **热处理 / 化学处理**:表面淬火(高频、火焰)、渗碳淬火、调质、正火、渗氮。 + +--- + +## 四、圆柱齿轮传动的载荷计算 + +### 1. 轮齿受力分析 + +**直齿圆柱齿轮**: +$$F_t=\frac{2T_1}{d_1},\qquad F_r=F_t\tan\alpha,\qquad F_n=\frac{F_t}{\cos\alpha}$$ +$$T_1=9.55\times10^6\frac{P}{n_1}\ (\mathrm{N\cdot mm})$$ + +**斜齿圆柱齿轮**(总法向力 $F_n$ 分解为三个分力): +$$F_t=\frac{2T_1}{d_1},\quad F_a=F_t\tan\beta,\quad F_r=\frac{F_t\tan\alpha_n}{\cos\beta},\quad F_n=\frac{F_t}{\cos\alpha_n\cos\beta}$$ + +> 圆周力方向:主动轮上与运动方向相反,从动轮上与运动方向相同;径向力各自指向轴心;轴向力按左右手定则判断。 + +![轮齿受力分析](images/fig12_force.png) +*图 12 轮齿受力分析:直齿($F_t,F_r,F_n$)与斜齿($F_t,F_a,F_r$)* + +### 2. 计算载荷 +标称载荷经修正得到**计算载荷** $F_{nc}=K F_n$: + +$$K=\begin{cases}K_A K_V K_{H\beta} K_{H\alpha} & \text{接触应力计算}\\ K_A K_V K_{F\beta} K_{F\alpha} & \text{弯曲应力计算}\end{cases}$$ + +| 系数 | 名称 | 含义 / 影响因素 | +|---|---|---| +| $K_A$ | **使用系数** | 齿轮啮合**外部**因素引起的附加动载荷(原动机、工作机特性、系统质量、运行状态) | +| $K_V$ | **动载系数** | 齿轮啮合误差、运转速度等**内部**因素引起的附加动载荷(基节和齿形偏差、节圆速度、转动惯量刚度、啮合刚度变化);**齿轮修缘(修缘齿)**可减小动载荷与噪声 | +| $K_\beta$ | **齿向载荷分布系数** | 沿齿宽方向载荷分布不均(齿轮在轴上的布置方式、支承刚度、齿面硬度、齿宽、制造安装误差);对称/非对称/悬臂支承;**鼓形齿**或齿轮修形可改善 | +| $K_{\alpha}$ | **齿间载荷分配系数** | 同时啮合各对轮齿之间载荷分配不均(轮齿变形、制造误差、齿廓修形、磨合效果);分 $K_{H\alpha}$、$K_{F\alpha}$ | + +> 结论:齿轮位于**远离**转矩输入端时,载荷分布不均趋于缓和;齿轮轮齿修缘或制成鼓形齿的工艺统称**齿轮(齿廓)修形**。 + +--- + +## 五、直齿圆柱齿轮传动的齿面接触疲劳强度 + +- 以赫兹公式为基础,节点处曲率半径 $\rho_1=\dfrac{d_1}{2}\sin\alpha$、$\rho_2=\dfrac{d_2}{2}\sin\alpha$;齿数比 $u=z_2/z_1\ge1$。 +- 引入:**弹性影响系数 $Z_E$**、**节点区域系数 $Z_H$**、**重合度系数 $Z_\varepsilon$**。 + +**验算式**: +$$\sigma_H=\sqrt{\frac{2K_HT_1}{bd_1^2}\cdot\frac{u\pm1}{u}}\ Z_EZ_HZ_\varepsilon\le[\sigma_H]$$ + +**设计式**(引入齿宽系数 $\psi_d=b/d_1$): +$$d_1\ge\sqrt[3]{\frac{2K_HT_1}{\psi_d}\cdot\frac{u\pm1}{u}\left(\frac{Z_EZ_HZ_\varepsilon}{[\sigma_H]}\right)^2}$$ + +> "$\pm$":正号用于**外啮合**,负号用于**内啮合**。 +> **注意**:一对齿轮中只要一个出现点蚀传动即失效,故设计时应代入 $[\sigma_H]_1$、$[\sigma_H]_2$ 中**较小者**;**模数 $m$ 不能作为衡量接触强度的依据**。 +> 结论:齿面接触疲劳强度实质上取决于齿轮传动的**外廓尺寸**($d_1$、$a$、$b$)。 + +**许用接触应力**:$[\sigma_H]=\dfrac{\sigma_{H\lim}Z_N}{S_H}$($\sigma_{H\lim}$ 试验齿轮接触疲劳极限;$Z_N$ 寿命系数;$S_H$ 安全因数)。 +- 工作应力循环次数 $N=60\gamma n h_t$(稳定载荷),不稳定载荷时按当量循环次数 $N_v$。 +- **主要参数选择**:齿宽系数 $\psi_d$(查表18-12);小齿轮齿数 $z_1$——**软齿面闭式**取 $z_1=20\sim40$(增大齿数有利于平稳、减小模数、降低成本、提高抗磨损抗胶合能力),**硬齿面闭式**取 $z_1=17\sim25$(避免尺寸过大)。 + +--- + +## 六、直齿圆柱齿轮传动的齿根弯曲疲劳强度 + +- **计算假定**:载荷仅由一对轮齿承担,按**悬臂梁**计算;齿顶啮合时弯矩最大;危险截面为**齿根圆角 30° 切线两切点连线**处。 +- 引入**齿形系数 $Y_{Fa}$**(仅取决于齿数 $z$,与模数无关)、**应力修正系数 $Y_{Sa}$**(考虑齿根过渡曲线应力集中)、**重合度系数 $Y_\varepsilon$**。 + +$$Y_\varepsilon=0.25+\frac{0.75}{\varepsilon_\alpha}$$ + +**验算式**: +$$\sigma_F=\frac{2K_FT_1}{bd_1m}Y_{Fa}Y_{Sa}Y_\varepsilon\le[\sigma_F]$$ + +**设计式**: +$$m\ge\sqrt[3]{\frac{2K_FT_1}{\psi_dz_1^2}\cdot\frac{Y_{Fa}Y_{Sa}Y_\varepsilon}{[\sigma_F]}}$$ + +> **应用注意**:① 设计时应比较两齿轮的 $\dfrac{Y_{Fa}Y_{Sa}}{[\sigma_F]}$,取其中**较大者**代入;② 求得的模数需按标准圆整;③ 动力传动齿轮模数一般不应小于 $1.5\sim2$ mm;④ 其他条件确定后,**轮齿抗弯曲疲劳强度主要取决于模数大小**。 + +**许用弯曲应力**:$[\sigma_F]=\dfrac{\sigma_{F\lim}Y_N Y_X}{S_F}$($\sigma_{F\lim}$ 试验齿轮齿根弯曲疲劳极限;$Y_N$ 寿命系数;$Y_X$ 尺寸系数;$S_F$ 安全因数,因断齿后果更严重,安全裕量应更大)。 + +--- + +## 七、直齿圆柱齿轮传动的静强度计算 + +- 针对循环次数 $N\le N_j$ 的**过载应力**;过载应力即使一次也可能引起齿面塑性破碎甚至整体折断。 +- 分两类:**低循环次数**($10^2\le N\le N_j$)与**瞬间过载**($N<10^2$)。 +- 计算要点:① 一般在疲劳强度计算基础上作**校核计算**;② 通常取 $K_A=K_V=1$,转矩代以过载时最大转矩 $T_{1\max}$;③ 在 $N<10^2$ 的短时大过载时只需校核抗屈服能力。 + +--- + +## 八、斜齿圆柱齿轮传动的强度计算 + +方法与直齿大致相同,主要区别: +1. 计算接触应力时,代入**齿廓啮合点的法向曲率半径**(受接触线倾斜影响),并引入**螺旋角系数 $Z_\beta=\sqrt{\cos\beta}$** 修正; +2. 齿根抗弯计算中也引入**螺旋角系数 $Y_\beta$** 考虑接触线倾斜对强度的有利影响; +3. 弯曲强度的 $Y_{Fa}$、$Y_{Sa}$ 按**当量齿数 $z_v=z/\cos^3\beta$** 查取;$m_n$ 为法面模数。 +- 斜齿轮齿面上的接触线为一斜线,轮齿失效形式为**局部折断**。 + +--- + +## 九、直齿锥齿轮传动 + +- 两轴交角 $\Sigma=90^\circ$;制造精度普遍较低,用于圆周速度 $v<5$ m/s 的场合。 +- **设计参数**:以**大端**参数为标准值;强度计算以**齿宽中点处的当量齿轮**为依据。 + +$$d_m=d(1-0.5\psi_R),\quad R_m=R-0.5b,\quad z_v=\frac{z}{\cos\delta},\quad m_m=m(1-0.5\psi_R)$$ + +齿宽系数 $\psi_R=b/R=0.25\sim0.3$;为保证不根切应有 $z_v\ge17$。 + +- **受力分析**($\Sigma=90^\circ$): + +$$F_t=\frac{2T_1}{d_{m1}},\quad F_{r1}=F_t\tan\alpha\cos\delta_1,\quad F_{a1}=F_t\tan\alpha\sin\delta_1$$ + +> 轴向力方向对两个齿轮都**背着锥顶**;径向力指向各自轴心;且 $F_{r1}=F_{a2}$、$F_{a1}=F_{r2}$。 + +- 简化处理:按齿宽中点当量直齿圆柱齿轮计算;假定载荷始终由一对齿承担(略去重合度系数与载荷分配系数);有效齿宽 $b_e=0.85b$。 +- **齿面接触**(验算式):$\sigma_H=\dfrac{4.71Z_EZ_H}{\psi_R(1-0.5\psi_R)^2d_1^3u}\sqrt{KT_1}\le[\sigma_H]$ +- **齿根弯曲**(验算式):$\sigma_F=\dfrac{4.71KT_1Y_{Fa}Y_{Sa}}{\psi_R(1-0.5\psi_R)^2m^3z_1^2\sqrt{u^2+1}}\le[\sigma_F]$ + +--- + +## 十、齿轮传动的效率与润滑 + +- 闭式齿轮传动效率:$\eta=\eta_1\eta_2\eta_3$($\eta_1$ 啮合损失,$\eta_2$ 搅油损失,$\eta_3$ 轴承效率)。 +- **油浴(浸油)润滑**:$v\le15$ m/s 时,将大齿轮轮齿浸入油池。 +- **喷油润滑**:$v>15$ m/s 时,润滑油以一定压力由喷嘴直接喷到啮合处。 + +--- + +## 十一、齿轮的结构 + +由强度计算只能确定主要参数($z$、$m$、$b$、$\beta$、$d$ 等),其余尺寸由结构设计确定(轮缘、轮辐、轮毂等)。 + +| 形式 | 适用 | +|---|---| +| **齿轮轴** | 直径较小的钢齿轮,齿根圆直径与轴径接近时与轴做一体(否则易致轮缘断裂) | +| **实心齿轮** | 小尺寸齿轮 | +| **腹板式齿轮** | 中型尺寸齿轮 | +| **轮辐式齿轮** | 大型尺寸齿轮 | + +--- + +# 附:易混点 / 考点速查 + +| 易混点 | 辨析 | +|---|---| +| 节圆 vs 分度圆 | 分度圆是**单个齿轮**就有的几何基准圆;节圆是**两齿轮啮合后**才出现的概念;标准安装时二者重合 | +| 啮合角 $\alpha'$ vs 压力角 $\alpha$ | 啮合角是啮合线与节圆公切线夹角;标准安装 $\alpha'=\alpha=20^\circ$;$a'\cos\alpha'=a\cos\alpha$ | +| 平均传动比 vs 瞬时传动比 | $i_{12}=n_1/n_2=z_2/z_1$(平均);$i_{12}=\omega_1/\omega_2=O_2P/O_1P=r_{b2}/r_{b1}$(瞬时) | +| $z_{\min}=17$ | 仅当 $\alpha=20^\circ$、$h_a^*=1$ 时成立;公式 $z_{\min}=2h_a^*/\sin^2\alpha$ | +| 仿形法 vs 展成法 | 仿形法精度低、单件生产;展成法(范成/包络)一种模数一把刀、批量生产 | +| 根切判据 | 刀具顶点 $B_2$ 落在 $N_1$ 右上方、$PB_2>PN_1$ 时发生根切 | +| 零/正/负传动 | 零传动 $x_\Sigma=0$(标准/高度变位);正传动 $x_\Sigma>0$($a'>a,\alpha'>\alpha$,尺寸紧凑但 $\varepsilon_\alpha\downarrow$);负传动 $x_\Sigma<0$(仅凑中心距) | +| 高度变位 vs 角度变位 | 高度变位 $x_1=-x_2$、$\alpha'=\alpha$、$a'=a$;正/负传动均属角度变位($x_\Sigma\ne0$) | +| 斜齿轮法面 vs 端面 | **法面参数为标准值**($m_n,\alpha_n$),**端面参数用于几何尺寸计算**;$m_n=m_t\cos\beta$ | +| 斜齿轮当量齿数 | $z_v=z/\cos^3\beta$(斜齿);$z_v=z/\cos\delta$(锥齿轮) | +| 锥齿轮取哪端 | **大端**参数为标准值;强度计算用**齿宽中点当量齿轮**,$b_e=0.85b$ | +| 蜗杆传动比 | $i=z_2/z_1$(**不是** $d_2/d_1$);$\Sigma=90^\circ$ 时 $\gamma_1=\beta_2$ | +| 软/硬齿面 | 一对齿轮齿面硬度**均 >350HBS** 才是硬齿面 | +| 设计准则选择 | 闭式软齿面→按**接触**设计;闭式硬齿面→按**弯曲**设计;开式→按**弯曲**设计 | +| 谁代谁算 | 接触强度:取 $[\sigma_H]$ **较小者**;弯曲强度:取 $\dfrac{Y_{Fa}Y_{Sa}}{[\sigma_F]}$ **较大者** | +| 塑性变形方向 | 主动轮节线处**下凹**,从动轮节线处**凸起** | +| $\varepsilon_\alpha$ 与 $m$ | 重合度与 $z$、$h_a^*$、$\alpha$、$\alpha'$ 有关,**与模数 $m$ 无关**;弯曲强度主要取决于 $m$,接触强度主要取决于外廓尺寸 | diff --git a/笔记/练习-齿轮-答案卷.md b/笔记/练习-齿轮-答案卷.md new file mode 100644 index 0000000..35f6275 --- /dev/null +++ b/笔记/练习-齿轮-答案卷.md @@ -0,0 +1,276 @@ +# 齿轮章节练习 · 答案卷 + +> 与同目录 `练习-齿轮-题目卷.md` 配套。**做题请先看题目卷**,做完再对照本卷。 +> 计算取 $\cos20^\circ=0.93969$、$\tan20^\circ=0.36397$、$\mathrm{inv}\,20^\circ=0.014904$、$\pi=3.1416$。 + +--- + +# 一、判断题答案 + +| 题号 | 答案 | 解析 | +|---|---|---| +| 1 | **√** | 基圆越大渐开线越平直;$r_b\to\infty$ 时渐开线变成直线 | +| 2 | **×** | 离中心越远压力角越大;基圆上 $\alpha_b=0$,仅分度圆上为 $\alpha$ | +| 3 | **√** | 运动可分性:$i_{12}=r_{b2}/r_{b1}$,只与基圆有关 | +| 4 | **√** | 分度圆是单个齿轮的几何基准;节圆是啮合后才出现的 | +| 5 | **√** | 标准齿轮 $s=e=\pi m/2$ | +| 6 | **×** | 还须压力角相等:$m_1=m_2$ 且 $\alpha_1=\alpha_2$ | +| 7 | **×** | 重合度与 $z,h_a^*,\alpha,\alpha'$ 有关,与模数无关 | +| 8 | **√** | 仿形法无根切问题,范成法(展成法)可能根切 | +| 9 | **√** | 刀具远离轮坯中心,$x>0$ 为正变位 | +| 10 | **√** | $m$、$z$、$\alpha$ 不变,$d$、$d_b$ 与标准齿轮相同 | +| 11 | **×** | 正变位才可避免根切;负变位使齿根更薄、更易根切 | +| 12 | **√** | 正传动 $\alpha'>\alpha$、$a'>a$ | +| 13 | **×** | 斜齿轮以**法面**模数 $m_n$ 为标准值 | +| 14 | **√** | $F_a=F_t\tan\beta$,随 $\beta$ 增大而增大 | +| 15 | **√** | $z_{\min}=z_{v\min}\cos^3\beta$,$\beta=20^\circ$ 时约 14 | +| 16 | **×** | $i=z_2/z_1$,不是 $d_2/d_1$ | +| 17 | **√** | 蜗杆取轴面模数,等于蜗轮端面模数,且为标准值 | +| 18 | **√** | 直齿锥齿轮以大端参数为标准值 | +| 19 | **√** | 锥齿轮 $z_v=z/\cos\delta$;斜齿轮才是 $z/\cos^3\beta$ | +| 20 | **√** | 软齿面闭式传动常因点蚀失效 | +| 21 | **×** | 开式传动主要失效是**磨粒磨损** | +| 22 | **×** | 硬齿面先按**弯曲**设计,再校核接触 | +| 23 | **√** | 弯曲强度主要取决于模数 | +| 24 | **×** | 应代入**较小者** | +| 25 | **×** | 那是 $K_\alpha$;$K_\beta$ 是沿齿宽方向分布不均 | + +--- + +# 二、简答题答案 + +**1. 叙述齿廓啮合基本定律。定传动比的条件是什么?** +> 一对齿廓在任意点 K 接触,过 K 作法线 n-n 与连心线 $O_1O_2$ 交于 P 点,则瞬时传动比 $i_{12}=\omega_1/\omega_2=O_2P/O_1P$,即**瞬时传动比等于连心线被啮合节点分成的两线段的反比**。 +> 定传动比条件:无论两齿廓在何处接触,过接触点所作的公法线必须与两轮连心线**始终交于一定点**。 + +**2. 渐开线是怎样形成的?它有哪些性质?** +> **形成**:一条直线(发生线)在圆(基圆)上作纯滚动时,直线上任一点的轨迹称为该圆的渐开线。 +> **性质**(口诀:弧长等于发生线,基圆切线是法线,曲线形状随基圆,基圆内无渐开线): +> ① 发生线上线段长 = 基圆上被滚过的弧长; +> ② 渐开线上任意点的法线切于基圆; +> ③ 起始点处曲率半径为零,越远离基圆曲率半径越大; +> ④ 渐开线形状取决于基圆大小($r_b\to\infty$ 时变直线); +> ⑤ 基圆内无渐开线。 + +**3. 标准直齿圆柱齿轮有哪几个基本参数?模数的物理意义是什么?** +> 三个基本参数:**模数 $m$、齿数 $z$、压力角 $\alpha$**(另有两个系数 $h_a^*$、$c^*$)。 +> 模数 $m=p/\pi$,即分度圆上齿距与 $\pi$ 之比,是决定齿轮尺寸大小和轮齿强度的重要参数,已标准化(GB1357-87),$d=mz$。 + +**4. 直齿圆柱齿轮的正确啮合条件是什么?** +> 相邻两齿同侧齿廓间的法向距离必须相等,即基圆齿距相等:$p_{b1}=p_{b2}\Rightarrow m_1\cos\alpha_1=m_2\cos\alpha_2$。 +> 由于模数和压力角都已标准化,故条件为:**两轮的模数相等、压力角相等**($m_1=m_2$,$\alpha_1=\alpha_2$)。 + +**5. 什么是标准中心距?非标准安装时中心距、啮合角、节圆如何变化?** +> **标准中心距**:$a=r_1+r_2=m(z_1+z_2)/2$,此时齿侧间隙为零、顶隙为标准值,节圆与分度圆重合,$\alpha'=\alpha$。 +> **非标准安装**($a'>a$):$\alpha'>\alpha$、$r'>r$,节圆大于分度圆,但传动比不变。三者满足 $a'\cos\alpha'=a\cos\alpha$。 + +**6. 什么是重合度?连续传动的条件是什么?重合度与哪些因素有关?** +> **重合度** $\varepsilon=B_1B_2/p_b$,表示同时参与啮合的轮齿对数的平均值。 +> **连续传动条件**:前一对轮齿脱离啮合前,后一对必须及时进入啮合,即 $B_1B_2\ge p_b$($\varepsilon\ge1$)。 +> $\varepsilon_\alpha$ 与 $z$、$h_a^*$、$\alpha$、$\alpha'$ 有关:$z\uparrow$、$h_a^*\uparrow$、$\alpha\uparrow\Rightarrow\varepsilon_\alpha\uparrow$;$\alpha'\uparrow\Rightarrow\varepsilon_\alpha\downarrow$;**与模数 $m$ 无关**。 + +**7. 什么是根切现象?产生根切的根本原因是什么?如何避免?** +> **定义**:用展成法加工齿轮时,齿根已加工好的渐开线齿廓又被切去一部分。 +> **后果**:削弱轮齿抗弯强度、使重合度下降。 +> **根本原因**:刀具齿顶线与啮合线的交点 $B_2$ 落在极限啮合点 $N_1$ 的右上方,即 $PB_2>PN_1$。 +> **避免方法**:保证 $z\ge z_{\min}=2h_a^*/\sin^2\alpha$($\alpha=20^\circ$、$h_a^*=1$ 时 $z_{\min}=17$);或采用正变位。 + +**8. 变位齿轮的变位原理是什么?正、负变位对齿轮有何影响?** +> **原理**:根切的根本原因是刀具离轮坯中心太近,故用改变刀具与轮坯相对位置来修正。刀具**远离**轮坯中心为**正变位**($x>0$),**趋近**轮坯中心为**负变位**($x<0$),移动量为 $xm$。 +> **影响**:正变位使分度圆齿厚增大、齿顶高增大、可避免根切、提高强度;负变位使齿厚减薄、齿根强度降低、易根切,一般只用于配凑中心距。 + +**9. 变位齿轮哪些参数不变?哪些参数改变?** +> **不变**:模数 $m$、齿数 $z$、压力角 $\alpha$、分度圆直径 $d$、基圆直径 $d_b$(齿廓取自同一条渐开线的不同段)。 +> **改变**:齿顶高、齿根高、齿顶圆半径、齿厚及齿槽宽;一对变位齿轮啮合时,中心距与啮合角也改变。 + +**10. 按变位系数之和,齿轮传动分为哪几类?各有什么特点?** +> ① **零传动**($x_\Sigma=0$):$a'=a$、$\alpha'=\alpha$,分标准齿轮传动($x_1=x_2=0$)与高度变位($x_1=-x_2\ne0$)。 +> ② **正传动**($x_\Sigma>0$):$a'>a$、$\alpha'>\alpha$,齿数选择范围宽、可凑非标中心距;缺点是 $\varepsilon_\alpha$ 下降明显、注意齿顶变尖。 +> ③ **负传动**($x_\Sigma<0$):$a'2z_{\min}$,强度与抗磨性都变差,一般只用于凑中心距。 + +**11. 斜齿轮的法面参数与端面参数有何关系?为什么要引入当量齿数?** +> **关系**:$m_n=m_t\cos\beta$,$\tan\alpha_n=\tan\alpha_t\cos\beta$,$\tan\beta_b=\tan\beta\cos\alpha_t$。 +> **当量齿数**:斜齿轮的法面齿形与一个直齿轮相近,该直齿轮的齿数(按法面曲率半径 $\rho$ 作当量分度圆)即当量齿数 $z_v=z/\cos^3\beta$。用它可查取齿形系数、判断是否根切(斜齿轮不根切最少齿数 $z_{\min}=z_{v\min}\cos^3\beta$)。 + +**12. 蜗杆传动的正确啮合条件是什么?主平面有何意义?** +> **正确啮合条件**($\Sigma=90^\circ$):$m_{x1}=m_{t2}=m$、$\alpha_{x1}=\alpha_{t2}=\alpha$、$\gamma_1=\beta_2$。 +> **主平面**:过蜗杆轴线且垂直于蜗轮轴线的平面(蜗轮的端截面、蜗杆的轴截面)。在主平面内,蜗杆与蜗轮的啮合相当于**齿轮与齿条啮合**,是分析蜗杆传动的基础。 + +**13. 齿轮有哪些主要失效形式?各出现在什么场合?** +> ① **轮齿折断**(齿根)——严重过载或疲劳;② **齿面点蚀**(节线附近)——闭式软齿面传动常见;③ **齿面胶合**——高速重载;④ **齿面磨损**——开式传动(磨粒磨损);⑤ **齿面塑性变形**——材料过软、应力超屈服极限。 + +**14. 闭式软齿面、闭式硬齿面、开式齿轮传动分别按什么准则设计?为什么?** +> ① **闭式软齿面**:主要失效是点蚀 → **按齿面接触疲劳强度设计**(先定 $d_1$、$a$、$b$),再校核齿根弯曲强度; +> ② **闭式硬齿面**:主要失效是轮齿折断 → **按齿根弯曲疲劳强度设计**(先定 $m$),再校核齿面接触强度; +> ③ **开式传动**:主要失效是磨粒磨损 → 通常只按**弯曲疲劳强度**计算,并适当加大模数考虑磨损影响。 +> 此外高速重载还需按**抗胶合能力**准则设计。 + +**15. 计算载荷 $K$ 由哪几个系数组成?各考虑什么因素?** +> 接触应力计算用 $K=K_AK_VK_{H\beta}K_{H\alpha}$,弯曲应力计算用 $K=K_AK_VK_{F\beta}K_{F\alpha}$。 +> ① $K_A$ 使用系数——齿轮啮合**外部**因素(原动机、工作机特性等)引起的附加动载荷; +> ② $K_V$ 动载系数——啮合误差、运转速度等**内部**因素引起的附加动载荷; +> ③ $K_\beta$ 齿向载荷分布系数——载荷沿**齿宽**方向分布不均; +> ④ $K_\alpha$ 齿间载荷分配系数——同时啮合**各对轮齿之间**载荷分配不均。 + +--- + +# 三、计算题解答 + +## 计算题 1 + +公式:$d=mz$;$h_a=h_a^*m=m$;$h_f=(h_a^*+c^*)m=1.25m$;$d_a=d+2h_a$;$d_f=d-2h_f$;$d_b=d\cos\alpha$;$a=m(z_1+z_2)/2$;$p_b=\pi m\cos\alpha$。 + +| 项目 | 小齿轮 $z_1=22$ | 大齿轮 $z_2=44$ | +|---|---|---| +| 分度圆直径 $d=mz$ | $4\times22=88$ mm | $4\times44=176$ mm | +| 齿顶圆直径 $d_a=d+2m$ | $88+8=96$ mm | $176+8=184$ mm | +| 齿根圆直径 $d_f=d-2.5m$ | $88-10=78$ mm | $176-10=166$ mm | +| 基圆直径 $d_b=d\cos20^\circ$ | $82.69$ mm | $165.39$ mm | + +**标准中心距**:$a=\dfrac{m(z_1+z_2)}{2}=\dfrac{4\times(22+44)}{2}=132$ mm + +**基圆齿距**:$p_b=\pi m\cos\alpha=3.1416\times4\times0.93969=11.81$ mm + +--- + +## 计算题 2 + +标准中心距:$a=\dfrac{m(z_1+z_2)}{2}=\dfrac{3\times80}{2}=120$ mm + +由 $a'\cos\alpha'=a\cos\alpha$ 得: + +$$\cos\alpha'=\frac{a\cos\alpha}{a'}=\frac{120\times0.93969}{122}=0.92429$$ + +$$\alpha'=\arccos 0.92429\approx 22.42^\circ$$ + +即中心距增大后,啮合角由 20° 增大到约 22.4°,节圆也相应增大,但传动比不变。 + +--- + +## 计算题 3 + +$\alpha'=\alpha=20^\circ$,$\tan\alpha'=0.36397$。 + +$$d_{b1}=mz_1\cos20^\circ=4\times20\times0.93969=75.18\ \mathrm{mm},\quad d_{a1}=m(z_1+2)=88\ \mathrm{mm}$$ + +$$d_{b2}=mz_2\cos20^\circ=4\times40\times0.93969=150.35\ \mathrm{mm},\quad d_{a2}=m(z_2+2)=168\ \mathrm{mm}$$ + +$$\alpha_{a1}=\arccos\frac{d_{b1}}{d_{a1}}=\arccos0.85426=31.31^\circ,\quad \tan\alpha_{a1}=0.6083$$ + +$$\alpha_{a2}=\arccos\frac{d_{b2}}{d_{a2}}=\arccos0.89495=26.50^\circ,\quad \tan\alpha_{a2}=0.4985$$ + +$$\varepsilon_\alpha=\frac{z_1(\tan\alpha_{a1}-\tan\alpha')+z_2(\tan\alpha_{a2}-\tan\alpha')}{2\pi}=\frac{20\times(0.6083-0.36397)+40\times(0.4985-0.36397)}{2\pi}=\frac{4.887+5.381}{6.2832}=1.63$$ + +**结论**:$\varepsilon_\alpha=1.63>[\varepsilon]=1.4$,**能连续传动且满足一般机械的要求**。 + +--- + +## 计算题 4 + +最小不根切齿数:$z_{\min}=\dfrac{2h_a^*}{\sin^2\alpha}=\dfrac{2\times1}{\sin^2 20^\circ}=17$ + +因 $z=120.01463$,**取大齿轮的 $Y_{Fa}Y_{Sa}/[\sigma_F]$ 代入**(大齿轮为危险轮)。 diff --git a/笔记/练习-齿轮-题目卷.md b/笔记/练习-齿轮-题目卷.md new file mode 100644 index 0000000..56ac928 --- /dev/null +++ b/笔记/练习-齿轮-题目卷.md @@ -0,0 +1,224 @@ +# 齿轮章节练习 · 题目卷(批改版) + +> **范围**:机械原理·第八章 齿轮机构 + 机械设计·第18章 齿轮传动。 +> **题量**:判断题 25、简答题 15、计算题 10。 +> **使用**:本卷为**已批改版**。每题后标对错,错题/不确定题在文末「批改说明」中给出理由,并附 **Obsidian 双链**(点击可跳转到知识笔记对应小节复习)。 +> 计算时取 $\cos20^\circ=0.93969$、$\tan20^\circ=0.36397$、$\mathrm{inv}\,20^\circ=0.014904$、$\pi=3.1416$。 + +--- + +# 一、判断题 + +> 判断下列说法是否正确,正确的打"√",错误的打"×"。 +> **批改标记**:`✅`=答对且确定;`❌`=答错;`⚠️`=不确定(按"不会"处理)。`==…==` 为你的高亮标记。 + +1. 渐开线的形状取决于基圆的大小,基圆越大,渐开线越平直。True ✅ +2. ==渐开线上各点的压力角都相等,且等于分度圆压力角 20°。==False ⚠️ +3. 实际中心距略有变化时,渐开线齿轮的瞬时传动比保持不变。True ✅ +4. 分度圆是单个齿轮就有的,而节圆是两齿轮啮合后才出现的。True ✅ +5. 标准齿轮在分度圆上齿厚等于齿槽宽($s=e=\pi m/2$)。True ✅ +6. 一对齿轮只要模数相等就能正确啮合。False ✅ +7. 重合度与模数 $m$ 有关。False ✅ +8. ==用仿形法加工齿轮时不会发生根切,用范成法加工时可能发生根切。==True ⚠️ +9. 加工齿轮时,刀具远离轮坯中心称为正变位。True ✅ +10. ==变位齿轮的分度圆直径和基圆直径与同参数标准齿轮相同。==True ⚠️ +11. 采用负变位可以避免根切。False ✅ +12. ==正传动($x_1+x_2>0$)的啮合角大于分度圆压力角。==False ❌ **应为 √** +13. ==斜齿轮以端面模数为标准值==。False ⚠️ +14. 斜齿轮传动会产生轴向力,且螺旋角越大轴向力越大。True ✅ +15. 斜齿轮不产生根切的最少齿数比直齿轮少。False ❌ **应为 √** +16. 蜗杆传动的传动比等于蜗轮分度圆直径与蜗杆分度圆直径之比。False ✅ +17. ==蜗杆传动的标准模数取蜗杆的轴面模数(与蜗轮端面模数相等)。== True ⚠️ +18. 直齿锥齿轮以大端参数为标准值。 +19. 直齿锥齿轮的当量齿数 $z_v=z/\cos\delta$。 +20. 齿面点蚀是闭式软齿面齿轮传动的主要失效形式。 +21. 开式齿轮传动的主要失效形式是齿面点蚀。 +22. 闭式硬齿面齿轮传动通常先按齿面接触疲劳强度设计,再校核齿根弯曲强度。 +23. 齿根弯曲疲劳强度主要取决于模数的大小。 +24. 进行齿面接触强度计算时,应代入两轮许用接触应力中较大的一个。 +25. 齿向载荷分布系数 $K_\beta$ 用于考虑同时啮合各对轮齿之间载荷分配不均。 + +> **第 18–25 题未作答**(你标注为"还没学到"),本次不计入批改;学到锥齿轮与机械设计第 18 章后再补做。 + +--- + +## 判断题批改说明(第 1–17 题) + +**成绩**:17 题中——**答对且确定 10 题**;**答错 2 题**(第 12、15 题);**不确定 5 题**(第 2、8、10、13、17 题,虽写对答案,但按你的要求以"不会"处理)。 + +> 🔗 说明中的链接均为 Obsidian 双链,点击可直接跳到 `[[知识点-齿轮(知识库整合)]]` 的对应小节。 + +### 一、错题(答错,2 题) + +**第 12 题** "正传动($x_1+x_2>0$)的啮合角大于分度圆压力角" —— 你答 ×(已高亮),**应为 √**。 +**说明**:变位后两轮分度圆齿厚之和增大,要保证无侧隙啮合,必须把中心距拉开、啮合角加大。由无侧隙啮合方程 $\mathrm{inv}\,\alpha'=\dfrac{2(x_1+x_2)}{z_1+z_2}\tan\alpha+\mathrm{inv}\,\alpha$,当 $x_1+x_2>0$ 时 $\mathrm{inv}\,\alpha'$ 变大 ⇒ $\alpha'>\alpha$。三者同向记牢:**$x_\Sigma>0\Rightarrow\alpha'>\alpha$、$a'>a$、节圆>分度圆**。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#七、变位齿轮传动|变位齿轮传动 · 三种传动类型]] + +**第 15 题** "斜齿轮不产生根切的最少齿数比直齿轮少" —— 你答 ×(未高亮,属盲区),**应为 √**。 +**说明**:斜齿轮的根切要按**法面当量齿数**判断,$z_v=z/\cos^3\beta>z$。直齿 $z_{\min}=17$,斜齿 $z_{\min}=17\cos^3\beta<17$($\beta=20^\circ$ 时约 14)。当量齿数大于实际齿数 ⇒ 实际齿数可更少而不根切,这正是斜齿轮结构更紧凑的原因。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#5. 当量齿数|斜齿 · 当量齿数]] + +### 二、不确定题(高亮标记,按"不会"处理,5 题) + +**第 2 题** "渐开线上各点压力角都相等,且等于分度圆压力角 20°" —— 你答 ×(正确),但标注不确定。 +**说明**:压力角沿齿廓**变化**,$\alpha_k=\arccos(r_b/r_k)$——基圆上 $\alpha_b=0$,离基圆越远越大,到分度圆上恰好等于 $20^\circ$。故"各点压力角都相等"错误。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#3. 压力角与渐开线方程|渐开线 · 压力角与渐开线方程]] + +**第 8 题** "仿形法不根切、范成法可能根切" —— 你答 √(正确),但标注不确定。 +**说明**:**仿形法**用成形刀,刀齿形状即齿槽形状,直接切出、无包络运动,不会根切;**范成法**(滚刀/插齿刀)按包络原理加工,齿数少时刀具齿顶越过啮合极限点 $N_1$,把齿根多切一块 ⇒ 根切。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#根切现象|齿轮加工 · 根切现象]] + +**第 10 题** "变位齿轮的分度圆和基圆直径与标准齿轮相同" —— 你答 √(正确),但标注不确定。 +**说明**:变位只是把刀具**径向移动** $xm$,切出的齿廓仍是**同一条渐开线的不同段**,因此 $d=mz$、$d_b=d\cos\alpha$ 都不变;变的是分度圆齿厚、齿顶高/齿根高、齿顶圆直径等。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#3. 变位齿轮的几何尺寸|变位齿轮 · 几何尺寸]] + +**第 13 题** "斜齿轮以端面模数为标准值" —— 你答 ×(正确),但标注不确定。 +**说明**:斜齿轮用**法面**参数作为标准值(加工时沿法面进刀),即法面模数 $m_n$、法面压力角 $\alpha_n$ 是标准量;端面模数 $m_t=m_n/\cos\beta$ 是导出量。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#2. 法面参数与端面参数|斜齿 · 法面与端面参数]] + +**第 17 题** "蜗杆传动的标准模数取蜗杆轴面模数(等于蜗轮端面模数)" —— 你答 √(正确),但标注不确定。 +**说明**:蜗杆传动以**中间平面(主平面)**内的参数为标准——蜗杆的**轴面**模数 $= $ 蜗轮的**端面**模数 $=$ 标准模数 $m$,压力角同理。故说法正确。 + +> 🔗 复习跳转:[[知识点-齿轮(知识库整合)#九、蜗杆机构|蜗杆机构 · 正确啮合条件与主平面]] + +> **小结**:你真心不确定的 5 题其实全答对了(第 2、8、10、13、17 题),说明**直觉准、只是缺底气**;但未高亮的第 15 题反而答错——盲区在**"不确定就标出来"的覆盖面**。错/不确定点集中在 **变位传动(正传动 α′)** 与 **斜齿(当量齿数、根切、法面标准)** 两处,建议优先回看。 + +--- + +# 二、简答题 + +> 简明扼要作答,注意关键词。每题后 `🔗` 为 **Obsidian 双链**,点击可跳到知识笔记对应小节复习。 + +1. 叙述齿廓啮合基本定律。定传动比的条件是什么? + +🔗 [[知识点-齿轮(知识库整合)#二、齿廓啮合基本定律与齿廓曲线|齿廓啮合基本定律与齿廓曲线]] + +答: +(1)两齿轮啮合时的传动比等于它们分别的回转中心到节点的反比。 +(2)定传动条件:无论两齿廓在何处接触,过啮合点所作的公法线一定与两齿轮连心线交于固定一点。 +2. 渐开线是怎样形成的?它有哪些性质? +答: +(1) +🔗 [[知识点-齿轮(知识库整合)#三、渐开线齿廓及其啮合特性|渐开线的形成与性质]] +3. 标准直齿圆柱齿轮有哪几个基本参数?模数的物理意义是什么? +🔗 [[知识点-齿轮(知识库整合)#2. 五个基本参数|五个基本参数与模数]] +4. 直齿圆柱齿轮的正确啮合条件是什么? +🔗 [[知识点-齿轮(知识库整合)#1. 正确啮合条件|正确啮合条件]] +5. 什么是标准中心距?非标准安装时中心距、啮合角、节圆如何变化? +🔗 [[知识点-齿轮(知识库整合)#2. 中心距 a 与啮合角 α′|中心距与啮合角 α′]] +6. 什么是重合度?连续传动的条件是什么?重合度与哪些因素有关? +🔗 [[知识点-齿轮(知识库整合)#4. 连续传动条件与重合度|连续传动条件与重合度]] +7. 什么是根切现象?产生根切的根本原因是什么?如何避免? +🔗 [[知识点-齿轮(知识库整合)#根切现象|根切现象]] +8. 变位齿轮的变位原理是什么?正、负变位对齿轮有何影响? +🔗 [[知识点-齿轮(知识库整合)#2. 变位原理与最小变位系数|变位原理与最小变位系数]] +9. 变位齿轮哪些参数不变?哪些参数改变? +🔗 [[知识点-齿轮(知识库整合)#3. 变位齿轮的几何尺寸|变位齿轮的几何尺寸]] +10. 按变位系数之和,齿轮传动分为哪几类?各有什么特点? +🔗 [[知识点-齿轮(知识库整合)#七、变位齿轮传动|三种传动类型(零/正/负传动)]] +11. 斜齿轮的法面参数与端面参数有何关系?为什么要引入当量齿数? +🔗 [[知识点-齿轮(知识库整合)#2. 法面参数与端面参数|法面参数与端面参数]] · [[知识点-齿轮(知识库整合)#5. 当量齿数|当量齿数]] +12. 蜗杆传动的正确啮合条件是什么?主平面有何意义? +🔗 [[知识点-齿轮(知识库整合)#九、蜗杆机构|蜗杆机构(正确啮合条件与主平面)]] +13. 齿轮有哪些主要失效形式?各出现在什么场合? +🔗 [[知识点-齿轮(知识库整合)#1. 五种失效形式|五种失效形式]] +14. 闭式软齿面、闭式硬齿面、开式齿轮传动分别按什么准则设计?为什么? +🔗 [[知识点-齿轮(知识库整合)#2. 设计准则(由工程实践得知)|设计准则]] +15. 计算载荷 $K$ 由哪几个系数组成?各考虑什么因素? +🔗 [[知识点-齿轮(知识库整合)#2. 计算载荷|计算载荷 K]] + +--- + +# 三、计算题 + +> 写出主要步骤、公式与结果。每题后 `🔗` 为 **Obsidian 双链**,点击可跳到知识笔记对应小节。 + +--- + +**计算题 1** 一对标准直齿圆柱齿轮,$m=4$ mm,$z_1=22$,$z_2=44$,$\alpha=20^\circ$,$h_a^*=1$,$c^*=0.25$。求两轮的分度圆直径、齿顶圆直径、齿根圆直径、基圆直径、标准中心距及基圆齿距。 +🔗 [[知识点-齿轮(知识库整合)#3. 几何尺寸计算公式|几何尺寸计算公式]] + +--- + +**计算题 2** 一对标准直齿圆柱齿轮,$m=3$ mm,$z_1=20$,$z_2=60$,$\alpha=20^\circ$。若实际安装中心距 $a'=122$ mm,求此时啮合角 $\alpha'$。 +🔗 [[知识点-齿轮(知识库整合)#2. 中心距 a 与啮合角 α′|中心距与啮合角 α′]] + +--- + +**计算题 3** 一对标准直齿圆柱齿轮,$m=4$ mm,$z_1=20$,$z_2=40$,$\alpha=20^\circ$,$h_a^*=1$,标准安装。求端面重合度 $\varepsilon_\alpha$,并判断能否连续传动(一般机械 $[\varepsilon]=1.4$)。 +🔗 [[知识点-齿轮(知识库整合)#4. 连续传动条件与重合度|连续传动条件与重合度]] + +--- + +**计算题 4** 一标准直齿圆柱齿轮,$z=12$,$\alpha=20^\circ$,$h_a^*=1$。判断是否会发生根切,如需修正,求避免根切所需的最小变位系数 $x_{\min}$。 +🔗 [[知识点-齿轮(知识库整合)#2. 变位原理与最小变位系数|变位原理与最小变位系数]] + +--- + +**计算题 5** 一对外啮合变位齿轮,$m=4$ mm,$z_1=z_2=20$,$x_1=x_2=+0.6$,$\alpha=20^\circ$。求啮合角 $\alpha'$、中心距 $a'$、中心距变动系数 $y$ 及齿高变动系数 $\Delta y$。 +🔗 [[知识点-齿轮(知识库整合)#4. 变位齿轮啮合传动的几何尺寸|变位齿轮啮合传动的几何尺寸]] + +--- + +**计算题 6** 一标准斜齿圆柱齿轮传动,$m_n=3$ mm,$z_1=21$,$z_2=63$,$\beta=15^\circ$,$\alpha_n=20^\circ$。求端面模数 $m_t$、两轮分度圆直径、中心距、端面压力角 $\alpha_t$ 及当量齿数 $z_{v1}$、$z_{v2}$。 +🔗 [[知识点-齿轮(知识库整合)#2. 法面参数与端面参数|法面参数与端面参数]] · [[知识点-齿轮(知识库整合)#5. 当量齿数|当量齿数]] + +--- + +**计算题 7** 一对标准直齿锥齿轮,$\Sigma=90^\circ$,$z_1=20$,$z_2=40$,$m=5$ mm(大端)。求传动比、分锥角、大端分度圆直径、锥距及当量齿数。 +🔗 [[知识点-齿轮(知识库整合)#3. 几何与啮合|锥齿轮 · 几何与啮合]] + +--- + +**计算题 8** 一直齿圆柱齿轮传动,传递功率 $P=7.5$ kW,小齿轮转速 $n_1=1450$ r/min,分度圆直径 $d_1=100$ mm,$\alpha=20^\circ$。求小齿轮所受的转矩 $T_1$、圆周力 $F_t$、径向力 $F_r$ 和法向力 $F_n$。 +🔗 [[知识点-齿轮(知识库整合)#1. 轮齿受力分析|轮齿受力分析]] + +--- + +**计算题 9** 一普通圆柱蜗杆传动,$\Sigma=90^\circ$,蜗杆头数 $z_1=2$,蜗轮齿数 $z_2=40$,模数 $m=5$ mm,蜗杆分度圆直径 $d_1=50$ mm($q=10$)。求传动比 $i$、蜗轮分度圆直径 $d_2$、蜗杆导程角 $\gamma_1$ 及中心距 $a$。 +🔗 [[知识点-齿轮(知识库整合)#2. 基本参数|蜗杆 · 基本参数(γ₁ 公式)]] · [[知识点-齿轮(知识库整合)#4. 传动比与转向|蜗杆 · 传动比]] + +--- + +**计算题 10** 某齿轮传动的两轮参数如下: + +| 参数 | 小齿轮 | 大齿轮 | +|---|---|---| +| 许用接触应力 $[\sigma_H]$(MPa) | 550 | 500 | +| 齿形系数 $Y_{Fa}$ | 2.85 | 2.35 | +| 应力修正系数 $Y_{Sa}$ | 1.54 | 1.72 | +| 许用弯曲应力 $[\sigma_F]$(MPa) | 300 | 250 | + +(1)进行齿面接触强度计算时,应代入哪个 $[\sigma_H]$? +(2)进行齿根弯曲强度计算时,应代入哪个 $Y_{Fa}Y_{Sa}/[\sigma_F]$? +🔗 [[知识点-齿轮(知识库整合)#五、直齿圆柱齿轮传动的齿面接触疲劳强度|齿面接触强度(取较小者)]] · [[知识点-齿轮(知识库整合)#六、直齿圆柱齿轮传动的齿根弯曲疲劳强度|齿根弯曲强度(取较大者)]] + +--- + +# 附:计算题公式速查 + +| 项目 | 公式 | +|---|---| +| 分度圆 / 齿顶圆 / 齿根圆 / 基圆 | $d=mz$;$d_a=m(z+2h_a^*)$;$d_f=m(z-2h_a^*-2c^*)$;$d_b=d\cos\alpha$ | +| 基圆齿距 | $p_b=\pi m\cos\alpha$ | +| 标准中心距 | $a=m(z_1+z_2)/2$ | +| 中心距与啮合角 | $a'\cos\alpha'=a\cos\alpha$ | +| 重合度 | $\varepsilon_\alpha=\dfrac{z_1(\tan\alpha_{a1}-\tan\alpha')+z_2(\tan\alpha_{a2}-\tan\alpha')}{2\pi}$ | +| 不根切最少齿数 | $z_{\min}=\dfrac{2h_a^*}{\sin^2\alpha}\ (=17)$ | +| 最小变位系数 | $x_{\min}=\dfrac{h_a^*(z_{\min}-z)}{z_{\min}}$ | +| 变位齿轮齿厚 | $s=\pi m/2+2xm\tan\alpha$ | +| 无侧隙啮合方程 | $\mathrm{inv}\,\alpha'=\dfrac{2(x_1+x_2)}{z_1+z_2}\tan\alpha+\mathrm{inv}\,\alpha$ | +| 中心距 / 齿高变动系数 | $y=(a'-a)/m$;$\Delta y=x_1+x_2-y$ | +| 斜齿参数换算 | $m_t=m_n/\cos\beta$;$\tan\alpha_t=\tan\alpha_n/\cos\beta$;$d=m_nz/\cos\beta$ | +| 当量齿数 | 斜齿 $z_v=z/\cos^3\beta$;锥齿 $z_v=z/\cos\delta$ | +| 锥齿轮锥距 | $R=\dfrac{m}{2}\sqrt{z_1^2+z_2^2}$ | +| 转矩 | $T_1=9.55\times10^6\,P/n_1\ (\mathrm{N\cdot mm})$ | +| 直齿受力 | $F_t=2T_1/d_1$;$F_r=F_t\tan\alpha$;$F_n=F_t/\cos\alpha$ | +| 斜齿受力 | $F_a=F_t\tan\beta$;$F_r=F_t\tan\alpha_n/\cos\beta$ | +| 蜗杆 | $i=z_2/z_1$;$\tan\gamma_1=mz_1/d_1$;$a=(d_1+d_2)/2$ | diff --git a/笔记/考纲-课件覆盖对照.md b/笔记/考纲-课件覆盖对照.md new file mode 100644 index 0000000..eb0f4f3 --- /dev/null +++ b/笔记/考纲-课件覆盖对照.md @@ -0,0 +1,89 @@ +# 考纲 ↔ 课件覆盖对照(缺口清单) + +> **状态:仅登记,暂不处理。** +> 生成日期:2026-10-13 +> 方法:将 803《机械原理与机械设计》考试大纲逐条拆解,对 `知识库/补充资源/机械原理PPT/`(机械原理全套 PPT 00~11,用 olefile 解析 `.ppt` OLE 记录流提文本)与 `知识库/{3}--资源/`(机械设计各章 PDF)逐关键词比对。 + +--- + +## 一、总体结论 + +| 部分 | 覆盖情况 | +|---|---| +| **机械设计(考纲第二部分)** | ✅ 8 项**全部有对应课件,无缺口** | +| **机械原理(考纲第一部分)** | ⚠️ 10 项中 **7 项全覆盖**,**3 项存在子缺口** | + +**真正缺的只有机械原理的 3 处**(均为进阶解析内容): +1. 多自由度机械系统的动力学分析 +2. 平面连杆机构的解析综合(刚体位移矩阵 / 函数生成 / 轨迹生成) +3. 平面机构的整体运动分析法 + +--- + +## 二、机械原理逐条对照 + +| # | 考纲条目 | 课件 | 覆盖 | +|---|---|---|---| +| ① | 机构的结构分析 | `01 机构的结构分析.ppt` | ✅ 全 | +| ② | 平面机构的运动分析 | `02 平面机构的运动分析.ppt` | ⚠️ **部分(缺项 3)** | +| ③ | 平面机构的力分析 | `03 平面机构的力分析.ppt` | ✅ 全 | +| ④ | 平面连杆机构及其设计 | `05 平面连杆机构及其设计.ppt` | ⚠️ **部分(缺项 2)** | +| ⑤ | 凸轮机构及其设计 | `06 凸轮机构及其设计.ppt` | ✅ 全 | +| ⑥ | 齿轮机构及其设计 | `07 齿轮机构及其设计.ppt` | ✅ 全(含变位/斜齿/蜗杆/锥齿) | +| ⑦ | 轮系及其设计 | `08 齿轮系及其设计.pptx` | ✅ 全 | +| ⑧ | 其他常用机构 | `09 其它常用机构和组合机构.ppt` | ✅ 全 | +| ⑨ | 机器的运转和调速 | `10 机械的运转与速度波动的调速.ppt` | ⚠️ **部分(缺项 1)** | +| ⑩ | 机械的平衡 | `04 机械的平衡.ppt` | ✅ 全 | + +--- + +## 三、真正缺的 3 处(待补) + +### 缺项 1:⑨ 机器的运转和调速 →「多自由度机械系统的动力学分析」 +- **课件现状**:PPT 10 只讲 **单自由度** 等效动力学模型(等效构件 / 等效转动惯量)+ 周期性速度波动调节 + 飞轮设计。 +- **缺口**:考纲点名的「多自由度机械系统的动力学分析」**没有**。 +- **补法建议**:张策《机械原理与机械设计》相应章节,或补充讲义。 + +### 缺项 2:④ 平面连杆机构 → 解析综合三块 +- **课件现状**:PPT 05 只有**图解法**——「按给定连杆位置(二组/三组)设计」+「按行程速比系数设计」。 +- **缺口**:考纲点名的 + - 「**刚体位移矩阵**」 + - 「**平面函数生成机构的综合**」 + - 「**平面轨迹生成机构的综合**」 + PPT 05 **全无**(无"矩阵/位移矩阵/函数生成/轨迹生成"字样)。 +- **注**:考纲的"刚体导引机构综合",PPT 以"按连杆位置设计"形式**部分覆盖**(图解法),但**解析法/矩阵法缺**。 +- **补法建议**:张策教材"连杆机构综合"章的解析法部分。 + +### 缺项 3:② 平面机构运动分析 →「平面机构的整体运动分析法」 +- **课件现状**:PPT 02 只有 **速度瞬心法**、**矢量方程图解法**、**解析法**(章节名"用解析法作机构的运动分析")。 +- **缺口**:没有「**整体运动分析法**」这一块。 +- **补法建议**:张策教材运动分析章的相应小节。 + +--- + +## 四、两处"假缺口"(其实已覆盖,勿误判) + +| 考纲表述 | 课件实际表述 | 判定 | +|---|---|---| +| 刚性转子的**平衡试验** | PPT 04「刚性转子的**平衡实验**」+「许用不平衡量及平衡精度」 | ✅ **已覆盖**(同一内容) | +| 平面矢量的**复数极坐标表示法** | PPT 02「解析法 / 复数矢量法」 | ✅ **实质覆盖**(PPT 未出现"极坐标"三字) | + +--- + +## 五、另外两个提示(非考纲缺口) + +1. **`{3}--资源` 机械设计独缺"第25章"**(其余 13~24、26 章齐全)。考纲未点名第 25 章内容,**暂不影响**。 +2. **`{3}--资源` 里的 `第二章第一/二/三节.pdf` 实为《机械工程发展简史》**(第一次/第二次工业革命),**不是机构分析**。 + - ⚠️ README 中曾把它误标为"结构分析",后续修正时注意。 + +--- + +## 六、待办(用户确认后再动) + +- [ ] 补齐缺项 1:多自由度动力学分析 +- [ ] 补齐缺项 2:连杆解析综合(位移矩阵 / 函数生成 / 轨迹生成) +- [ ] 补齐缺项 3:整体运动分析法 +- [ ] 修正 README 中"第二章 PDF = 结构分析"的误标 +- [ ] (可选)核对第 25 章是否落在考纲范围外 + +> **本文件只作登记,内容来自 2026-10-13 的核对,未经用户指示不要据此修改笔记或课件。** diff --git a/考试大纲/803_机械原理与机械设计_考试大纲.pdf b/考试大纲/803_机械原理与机械设计_考试大纲.pdf new file mode 100644 index 0000000..a9506f8 Binary files /dev/null and b/考试大纲/803_机械原理与机械设计_考试大纲.pdf differ