I've tried to understand the help file and examples and I must be dense. Anyone got a good reference on equation syntax?
Here's the basic concept for reference:
I have 4 beams, two are set by other parts and two are equally spaced between the two set beams. So, I set a global variable equal to the space between the two beams and want to use that to set the equal spacing.
But every time I try to create my equation it errors on syntax.
= 'InnerSpacing' / 3
I must be missing something supremely basic, but, there it is.
How to Discern Equations Syntax
How to Discern Equations Syntax
Designated Pot-Stirrer
Re: How to Discern Equations Syntax
I believe it is supposed to be double quote?
Eg: ="LoremIpsum"/3
Eg: ="LoremIpsum"/3
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
Re: How to Discern Equations Syntax
How are you creating your equations? Can you share picture of equation manager or the model file itself?
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
Re: How to Discern Equations Syntax
Well, maybe I don't need syntax after all but a program that isn't schizophrenic!
So, I went to create a screen pic per the last post request and opened the equation manager. I decided to also check on Zhen-Wei Tee's suggestion about the double quote vs single quote.
I am looking at the equation and mentally checking off that it's a double quote when I notice that the "Evaluates to" column has the correct value in it. Strange...I click on the "Value / Equation" field to see if I get an error after selecting the green check mark and voila! No error now. Nothing changed, I didn't type anything new I just saved when it asked me if I wanted to despite the "rebuild error" from the "bad" equation. The save happened roughly twenty minutes ago before I took a phone call and came back to this thread.
Any thoughts on what is going on? I am 99.9% sure that I had closed and reopened the equation editor many times in trying to sort this out. For the sake of finality the following syntax worked fine in the end.
= "InnerSpacing" / 3
I'd still like to have some idea, even if hypothetical, about why it wouldn't work and now it does.
So, I went to create a screen pic per the last post request and opened the equation manager. I decided to also check on Zhen-Wei Tee's suggestion about the double quote vs single quote.
I am looking at the equation and mentally checking off that it's a double quote when I notice that the "Evaluates to" column has the correct value in it. Strange...I click on the "Value / Equation" field to see if I get an error after selecting the green check mark and voila! No error now. Nothing changed, I didn't type anything new I just saved when it asked me if I wanted to despite the "rebuild error" from the "bad" equation. The save happened roughly twenty minutes ago before I took a phone call and came back to this thread.
Any thoughts on what is going on? I am 99.9% sure that I had closed and reopened the equation editor many times in trying to sort this out. For the sake of finality the following syntax worked fine in the end.
= "InnerSpacing" / 3
I'd still like to have some idea, even if hypothetical, about why it wouldn't work and now it does.
Designated Pot-Stirrer
Re: How to Discern Equations Syntax
If you can pick a dimension or equation right by mouse, do that.
- the_h4mmer
- Posts: 136
- Joined: Mon Jan 31, 2022 6:49 am
- x 106
- x 80
Re: How to Discern Equations Syntax
What version of Solidworks are you running?
On 2018, 2020, and 2021, when I type ` = ` then start typing the name of a Global Variable, there is usually a dropout menu option to click on the variable, and I double click that which auto-fills the rest of the text, including the quotes. As @Zhen-Wei Tee mentioned, the error may have been due to the single vs double quotes.
As far as the rebuild error, perhaps the software corrected the syntax error when saving? Not sure how or what could have cleared that, but an interesting series of events. ¯\_(ツ)_/¯
On 2018, 2020, and 2021, when I type ` = ` then start typing the name of a Global Variable, there is usually a dropout menu option to click on the variable, and I double click that which auto-fills the rest of the text, including the quotes. As @Zhen-Wei Tee mentioned, the error may have been due to the single vs double quotes.
As far as the rebuild error, perhaps the software corrected the syntax error when saving? Not sure how or what could have cleared that, but an interesting series of events. ¯\_(ツ)_/¯
Re: How to Discern Equations Syntax
Wait! Hold on! Uhm...jmongi wrote: ↑Fri Mar 18, 2022 11:24 am I've tried to understand the help file and examples and I must be dense. Anyone got a good reference on equation syntax?
Here's the basic concept for reference:
I have 4 beams, two are set by other parts and two are equally spaced between the two set beams. So, I set a global variable equal to the space between the two beams and want to use that to set the equal spacing.
But every time I try to create my equation it errors on syntax.
= 'InnerSpacing' / 3
I must be missing something supremely basic, but, there it is.
My co-worker had exactly the same problems couple of days ago.
Do you use other programs that use VBA? Issue seems to relate VBA version somehow, since after completely uninstalling and installing SW (2020 SP5.0 btw) equation manager threw him the same syntax error. Then he tried installing all the different versions of VBA that were delivered with our SW installation package. He uses VBA with MS Office and some other applications also implement it.
Sincerely,
JuTu
__________________
Lentäjä on ulkona ja lukossa.
JuTu
__________________
Lentäjä on ulkona ja lukossa.
Re: How to Discern Equations Syntax
1. Yes I do use various versions of VBA with Office.
2. I don't think the rebuild/save corrected anything from what was being displayed to me.
3. I only got the drop down selection after = functionality when doing very specific order of tasks. Just using = in the dimensioning portion of the initial mate creation did not work.
4. Version specific bugs aside, I suspect it was a data update issue of some type. Meaning, the sync between the window popup fields holding the text string of the equation and the backend equation solver database may have been broken in some way that was fixed when SW "rebuilt" after the error. After the "fix" it realized that the text in my popup window field had been changed, synced the change and then realized the change could be resolved by the solver.
That's all speculation on my part, but that's what it appears to be. I've run into similar type of error where SW decides a fully constrained component in an assembly is not fully constrained due to an unrelated edit and the only way to re "solve" the mate is to close the assembly and reopen it.
2. I don't think the rebuild/save corrected anything from what was being displayed to me.
3. I only got the drop down selection after = functionality when doing very specific order of tasks. Just using = in the dimensioning portion of the initial mate creation did not work.
4. Version specific bugs aside, I suspect it was a data update issue of some type. Meaning, the sync between the window popup fields holding the text string of the equation and the backend equation solver database may have been broken in some way that was fixed when SW "rebuilt" after the error. After the "fix" it realized that the text in my popup window field had been changed, synced the change and then realized the change could be resolved by the solver.
That's all speculation on my part, but that's what it appears to be. I've run into similar type of error where SW decides a fully constrained component in an assembly is not fully constrained due to an unrelated edit and the only way to re "solve" the mate is to close the assembly and reopen it.
Designated Pot-Stirrer