Repository navigation
save_body_as_part leaves no extra assembly open - #247
Merged
Merged
Conversation
make typecheck runs mypy over the package (checked as on Windows), and CI runs it before the tests. The fixes change no behaviour, apart from one fault mypy found: dimension layout raised TypeError for a leader with no lines when asked to place it inside its view; it now goes outside. Every type: ignore names its error code, checked by a test. Queue item 17, #157.
…stants library The API index now also reads swconst.tlb (983 enums on SolidWorks 2026; index format 2.1, so a saved index is rebuilt once). get_api_enum takes an enum's name or a member's and returns the enum's members and integer values. Checked live: swUnitSystem_IPS is 3. Named under the tool-naming rule (get_, reads one thing). Queue item 23, #95. 140 tools.
They were written as a literal \n, so the shell saw an unfinished if.
CI's environment has no PIL, faiss or sentence_transformers, and its pydantic doesn't need the ignore on the annotated-union TypeAdapter.
tests/integration/test_tool_catalog.py fails when a registered tool has no entry on its family's page, an entry's parameter table doesn't list exactly the tool's inputs, or its sample call isn't one the tool's input model accepts. Entries for the 20 tools that had none, about 30 stale tables and samples fixed, a Server Admin page. The generator that overwrote the hand-written pages is removed, with the harness tests that read its JSON (always skipped in CI). Queue item 24, #156.
While execute_macro runs, a watchdog thread (Win32 window calls only, no COM) looks for a dialog the SolidWorks process opened. One still open after dialog_timeout seconds (30) is answered with Cancel, or its only button, or closed when it has none; the run then fails as macro_waited_for_user, naming the dialog and its answer. A Yes/No prompt is left for the user and logged. Unit-tested; the live check is written for the user's run. Queue item 25, #97.
A macro that waits for the user no longer hangs the server
With SOLIDWORKS_MCP_ALLOW_VBA_SOURCE=1, execute_macro takes vba_source: the text is written to a .swb under the temp folder and run like a macro file, with the dialog watchdog; the reply names the file and repeats the source. Off by default (the user's choice): VBA can do anything the user can, so the call is refused as vba_source_off and nothing is written. Queue item 26, #96.
SolidWorks' Save Bodies can leave a new, unsaved assembly open, and it becomes the active document. The adapter now notes the open documents before the call, closes any new unsaved assembly afterwards, reactivates the part, and lists what it closed in closed_documents. Nothing open before, or with a file, is touched. Queue item 27, #101.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #101 once the live check passes. Merge #245 and #246 first; until then this PR shows their commits too.
save_body_as_partleaves no extra assembly open (queue item 27)After a successful Save Bodies, SolidWorks could leave a new, unsaved
Assem<N>open. It became the active document, so the next tool acted on it.CreateSaveBodyFeaturehas no argument that turns this off (checked in the type library), so the adapter cleans up after the call:closed_documentsnames whatever was closed.Checks
A unit test: the new assembly is closed and the part reactivated, while an assembly that was already open and saved is left alone.
4,295 unit tests pass; ruff and mypy are clean.
Live: not run yet. The existing live test now also checks that no unsaved assembly is open afterwards: