Repository navigation
Equations and global variables drive a part's dimensions - #250
Open
andrewbartels1 wants to merge 1 commit into
Open
andrewbartels1 wants to merge 1 commit into
andrewbartels1 wants to merge 1 commit into
Conversation
list_equations, set_equation and delete_equation (queue item 29). One
value ("Width" = 60mm) can drive several dimensions ("D1@Sketch1" =
"Width" / 2). set_equation adds or changes one, in every configuration
by default, solves and rebuilds, and gives the new value; an expression
SolidWorks can't use fails as equation_refused and changes nothing.
143 tools.
This branch has not been deployed
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.
Equations and global variables (queue item 29)
Equations and global variables are how a SolidWorks part becomes parametric: one value drives several dimensions, so changing it resizes the part consistently. The server had nothing for them. This adds three tools (143 in all):
list_equationsname,expression,kind(global_variable,dimension,other) and its solvedvalueset_equationname, or changes the one there is; solves and rebuilds; replies with the value and whether it wasaddedorchangeddelete_equationname(Width, or a dimension such asD1@Sketch1) andexpression(60mm,"Width" / 2); the server writes"Width" = 60mm, so the quoting is always right.allby default, as SolidWorks' Equations dialog does;thisor a list of names, checked likeset_dimension's.invalid_input). An expression SolidWorks can't use fails as the newequation_refused: an added equation is deleted again, and a changed one gets its old text back. Refusal is detected fromAdd3's -1, the manager'sStatus, and reading the stored text back.Checks
Unit tests for the real adapter (fake equation manager), the mock, both wrappers and the tools: 4,383 pass at 100% coverage; ruff and mypy are clean; the docs build in strict mode.
Docs: a catalog page, the agent skill's workflow for driving dimensions from one value, the CHANGELOG, the tool counts.
Live: not run yet.
tests/live/test_live_sw_equations.pyhas two cases:Depth= 30mm drives a block's extrusion depth;Depth= 45mm makes it 45 mm deep (72,000 mm³); a bad expression is refused and the list is unchanged; deleting the depth equation keeps 45 mm. The evidence also shows what unitsValuereports.Depth= 50mm inLongonly:Longis 50 mm deep,Defaultstays 30 mm.