×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SolidWorks BOM & equations with 3 or more variables.
2

SolidWorks BOM & equations with 3 or more variables.

SolidWorks BOM & equations with 3 or more variables.

(OP)
The following equation works in SolidWorks to set QTY to FT or just plain QTY.
={2}IF('UoM'="FT";(`Total_Length`/12)" FT";'QTY')

The following also works to put in a quantity of 0 for a property of UoM =’s “NA” or just plain QTY.
={2}IF('UoM'="NA";"0";'QTY')

Does anyone know how to combine the 2 equations to give answers to 3 properties for UoM which are FT, EA and NA.

I have searched here and the web with no luck. I could not find it in the SolidWorks help manual.

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

IF statements can be nested.  Test for one value with the first (outermost) IF, then have another IF statement that tests for the other two values as part of the "FALSE" result for the first IF.

RE: SolidWorks BOM & equations with 3 or more variables.

(OP)
TheTick,
      Thanks for the reply. I have been trying all kinds of syntax for nesting, with no luck at all. This is the last formula I have tried. Do you have any suggestions?

={2}IF('UoM'="EA";('UoM'="FT";(`Total_Length`/12)" FT";('UoM'="NA";'0')'QTY')  

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

Try this;

={2}IF('UoM'="EA";'QTY';IF('UoM'="FT";('Total_Length'/12)" FT";IF('UoM'="NA";"0";"?")

The "?" will be returned if the input is anything other than "EA", "FT" or "NA". It can be substituted by any character or left blank as "".

cheers

RE: SolidWorks BOM & equations with 3 or more variables.

What CBL said!

RE: SolidWorks BOM & equations with 3 or more variables.

I am trying to learn that "IF THEN ELSE" in the equations - obviously the above is a non-starter for me.

I tried to follow

Quote:

"D1@Sketch1" = (IIf("D1@Sketch4">15, 20, 10)) + 8
explanation from SW2006 Help, but I am getting syntax errors - I suspect the sample is wrong.

I must add some years ago I was doing some programming in Basic (NOT VisualBasic), also in Assembler and in C and I do understand the following:

IF

THEN

ELSE

ENDIF

Could anybody vrite some simple IF that could be used in the SW equation - that would get me started.

Thanks in advance.

RE: SolidWorks BOM & equations with 3 or more variables.

(OP)
CorBlimeyLimey and TheTick

      I wish I could give you both more than one star. You helped me a great deal with this problem. Once I knew where to go (with your help) I came up with the following:

={2}IF('UoM'="EA";'QTY';IF('UoM'="FT";('Length'/12)" FT";IF('UoM'="NA";"0";'QTY')))

I changed the ? to QTY because lots of our models never got a UoM property. Also added a couple of ).

Thanks again for the help.

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

Bradley ... just noticed (because of Jacek0841's post) that the IF function should be IIF and the semi-colons should be commas.

jacek0814 ... that equation works OK for me. Are you using a model with suitable sketches and dimensions.
i.e. one with at least 4 sketches and a D1 dimension in at least Sketch1 and Sketch4?

cheers

RE: SolidWorks BOM & equations with 3 or more variables.

(OP)
CorBlimeyLimey,

I tried changing IF to IIF and the semi-colons to commas.

={2}IIF('UoM'="EA",'QTY',IIF('UoM'="FT",('Length'/12)" FT",IIF('UoM'="NA","0",'QTY')))

That did not work for me. SolidWorks just put the formula in QTY box. The following is working so I think I will leave it at that.

={2}IF('UoM'="EA";'QTY';IF('UoM'="FT";('Length'/12)" FT";IF('UoM'="NA";"0";'QTY')))

Thanks so much for your help.

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

Which version of SW are you using? SW06 and SW07 reported syntax errors for me if I used IF or semi-colons.

cheers

RE: SolidWorks BOM & equations with 3 or more variables.

(OP)
I am using SolidWorks 2007 Sp 2.0 XP 64 bit.
I really like this SolidWorks BOM better than Excel.

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

SW2006 SP 5.0

Finally got it working - thanks for the help.

BTW, my confusion was also that IIF - I thought that's a typo, I thought it should be IF.

Second thing - I have to use , if I use ; it reports syntax error ...

RE: SolidWorks BOM & equations with 3 or more variables.

Oops sorry ... I was referring to an equation in a part. I missed that you were in a BOM. The SW table based BOM uses the IF and semi-colon. Nice consistency SolidWorks! Go figure!

cheers

RE: SolidWorks BOM & equations with 3 or more variables.

(OP)
CorBlimeyLimey,
I tried to find this information in the SolidWorks 2007 Online User’s Guide – SP0.0.

How do you learn these things? All I found in User’s Guide is the following:

Quote:

IF(logical_test; value_if_true; value_if_false).

Bradley

RE: SolidWorks BOM & equations with 3 or more variables.

You just have to keep poking around and follow all the Related Topics links and the hyperlinks within them.

cheers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources