Thanks for your help, and to Anna as well.
I will post a model on Monday.
We are using SW2012 SP5, just got the newest upgrade installed.
Looking forward to SW2013 SP1.
A wonderful weekend to you both...
Hi Anna and Alin,
here is the part attached in the post about which i was talking about,I have set up a global variable "length" assigned to the Length of the shaft and I have inserted all the holes into place and confined those holes to the equations. Now
Condition 1: I want to show the "RH/LH end holes" at all times no matter what is the length of the shaft.(simple one no need to do any thing about it)
Condition 2: I want to show the "Center holes" only when the length of the shaft is more than 50 inches and less than, equals to 70 inches( I tried if statement and when i put the equations.......... If ("length">50,"unsuppress", "suppress") and if (length<=70,"unsupress","suppress").....it only considers the later condition and not the first condition.
Condition3: I want to show the "4 Hinge mid holes" only when the length of the shaft is more than 70 inches and less than, equals to 90 inches.(I tried if statement again and getting thge same problem as above)
Condition4: I want to show the "5 Hinge mid holes" only when the length of the shaft is more than 90 inches and less than, equals to 110 inches(I get this to working because i dont care about the holes if they show up when the length is above 110 inches because we only have shafts below 110 inches". I used one if statement (if("length">90,"unsuppress","suppress"))).
Thanks for your help guys and please help me further to get me out of this problem
Shaft with holes.SLDPRT.zip 109.0 KB
Thank you so much paul
You are a life saver, it worked exactly how i wanted it to work.
Also, your syntax while looking valid, will not even evaluate in Excel. For example try this in excel:
Low Value High 50 80 100 Is Value in between? NO =IF(A2<B2<C2,"YES", "NO")
the formula is in the last cell so you can see what I did... it doesn't work. The IF logical test can only be ONE test, but the AND is testing multiple conditions for ALL to be true. So the only way to do it is with nested IF statements... then you have to go down the path I said for finding that nested if's are broken and so on and so forth.
Happy logical testing.
I am a starter in VBA and I only knew about the "if" statement and not about the "iif" but now i know. thanks to you.
also Solidworks does not take in the AND/OR equations and Neither it Works with nested "if" (It works with nested "iif"), that is why i was having hard time. But finally the thing matters that you got me out of it. Thanks for all the explanation and your time.
BTW i could not find this "iif" statement anywhere in the documentation or any tutorials or not even in the classes. Can you tell me where have you found this, i mean i am asking this so that in future i can add that to my search area.
Well, to be honest it shouldn't have to be iif, it should just be if... but SPR 620043 says that nested if's are broken... so knowing that VBA is available you can use iif (based on prior knowledge of stuff like this as well as this thread: https://forum.solidworks.com/message/301290#301290, and the one it references here: https://forum.solidworks.com/message/301201#301201)
also S-055893 asks about being able to use VBA logical operators in the equation editor and lays it out like this:
Assume the value of a dimension is "D1@Sketch1" = 110
1. Logical Operator: NOT
If a condition is true, NOT makes it false. If a condition is false, NOT makes it true.
2. Logical Operator: AND
All conditions must be true before an action can be taken.
"B" = IIF("D1@Sketch1">50 AND "D1@Sketch1"<150,100,80)
3. Logical Operator: OR
At least one of the conditions must be true before an action can be taken.
"C"= IIF("D1@Sketch1">60 OR "D1@Sketch1"<80,100,80)
Result: C = 100
so, basically I always use a forum search and a KB search on the customer portal and be very vague with what I search for so I make sure I don't remove what I would really like to see. A little bit of work, but I usually learn something that I can use later even if it isn't what I'm searching for anyway.
Hello to all
I have same question. would be happy to get answer. a bit more complicated situation.
if I have two global variable: WIDTH and HEIGHT. how can I write an equation for the 2 conditions to suppress or unsuppress feature in assembly file? how I write the condition AND in the statement?
to make it clear: the conditions are: "WIDTH">500 AND "HEIGHT">1000 , if the both are true "unsuppress" , if the both false "suppress"
You will be using the exact same logic as paul described above. I have attached a simple part to this reply for you. it is just an example of what you have asked and i have added the same equations to it as paul gave me.
test file for yosi.SLDPRT.zip 42.6 KB
It helped me very much. thank you.