Page 1 of 1
Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 7:13 am
by pdesigns
Hi!
I'm trying to use the functions to dimension a skecth, but it always gives me the wrong result. In this case i'm using a smart dimension of 629mm dived by 17.813mm. the result should be 35.311mm, but it gives me 34mm every single time...
I'm trying to do a parametric guitar fretboard and need accurate results for each fret.
What I'm I doing wrong?
Re: Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 9:21 am
by XHawkeye
Need to use the / for divide.
Don't know what the \ is doing.
Re: Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 9:35 am
by pdesigns
yep, that does it!!
Thank you very much!!
Don't know how what I was thinking...
Re: Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 10:09 am
by josh
The backslash operator is actually VBA and is used for integer division. I'm a little surprised the equation editor accepts it...
https://learn.microsoft.com/en-us/offic ... h-operator
Re: Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 10:48 am
by bnemec
That's interesting. Going a bit off thread but seeing how the \ operator is interpreted got me thinking.
does % work?
- image.png (9.23 KiB) Viewed 1139 times
ok how about this?
- image.png (11.1 KiB) Viewed 1139 times
ok, this maybe?
That's interesting...
Re: Smart dimension gives wrong result
Posted: Wed Jun 28, 2023 12:10 pm
by josh
SolidWorks actually uses VBA to evaluate equations. I notice you are trying to use MOD…. You’re using Excel syntax, which won’t work. Any VBA works. However, for some reason (probably trying to protect users from themselves), the syntax checker that watches what you’re typing will only accept certain VBA. If you can manage to bypass the syntax checker, you can get Equations to execute whatever VBA you want. One way to do this is to hide your VBA in a custom property.
If you try to make a global variable equal to =8 mod 3, the equation syntax checker won’t let you. However, if you create a custom property, say, “test” and make its value “8 mod 3” (note the “=” sign is not there), you can then go to the equation interface and make your global variable equation =”test”. The syntax checker will recognize that “test” is linked to a custom property, but it will not check the property text for syntax. After syntax check, it will replace the custom property name with its value and then hand that to VBA for evaluation and you’ll get a result of 2.