Donate Now Goal amount for this year: 3000 USD, Received: 2477 USD (83%)

Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By jmk

Thread: SOS! -> IF statements

  1. #1
    Junior Member
    Join Date
    October 18, 2016
    Posts
    26
    Current Local Time
    10:15 AM

    SOS! -> IF statements

    Hi all,

    Is someone here with a good vieuw on IF-THEN statements?

    In this case I need revit to select BLACK if THE BLACK_WHITE checkbox is marked, and WHITE if the checkbox is clear.
    I tought it would be something like this:

    IF(BLACK_WHITE=1,500mA_BLACK=1,500mA_WHITE=0)

    Getting the error" Improper use of boolean expressions."



    Can some1 help me out please ?
    Attached Thumbnails Attached Thumbnails SOS! -> IF statements-statements.png   SOS! -> IF statements-statements.png  

  2. #2
    Member chris.macko's Avatar
    Join Date
    April 12, 2011
    Location
    Chicago, IL
    Posts
    490
    Current Local Time
    04:15 AM
    Since yes/no parameters only have 2 possible conditions, there's no need for the if/then statement. The parameter itself is the test.
    It looks like you have a lot more going on in that family that may need some and/or statements, but the basic syntax would be this:
    1,500mA_BLACK=BLACK_WHITE
    1,500mA_WHITE= not(BLACK_WHITE)

  3. #3
    Junior Member
    Join Date
    October 18, 2016
    Posts
    26
    Current Local Time
    10:15 AM
    Thx

    and is there also a statement to select a color in a material database ? or isn't this possible ?

    Quote Originally Posted by chris.macko View Post
    Since yes/no parameters only have 2 possible conditions, there's no need for the if/then statement. The parameter itself is the test.
    It looks like you have a lot more going on in that family that may need some and/or statements, but the basic syntax would be this:
    1,500mA_BLACK=BLACK_WHITE
    1,500mA_WHITE= not(BLACK_WHITE)

  4. #4
    jmk
    jmk is offline
    Forum Addict jmk's Avatar
    Join Date
    December 31, 2012
    Location
    NM, USA
    Posts
    1,340
    Current Local Time
    03:15 AM
    Quote Originally Posted by Allu View Post
    Thx

    and is there also a statement to select a color in a material database ? or isn't this possible ?
    Try Dynamo? Materials don't do formulas, let alone dynamic material selection on their own.

  5. #5
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Posts
    1,289
    Current Local Time
    11:15 AM
    Why not just use a Material parameter instead of a tick box? Link an instance parameter to the 'Material' parameter of the geometry you want to change and the user can select black, or white (Or red/glass/grass/disco ball, whatever...)
    Or do it at Type level without formulas. So yes you have to set everything correctly for the Black and White Types, but then the user only has to select which they want.

    Personally I find controlling materials with a parameter and selecting them in the project with Edit Type is good practice anyway. Then the family itself doesnt have to contain all the materials, it will use the materials that are managed in one place in the project file.

  6. #6
    jmk
    jmk is offline
    Forum Addict jmk's Avatar
    Join Date
    December 31, 2012
    Location
    NM, USA
    Posts
    1,340
    Current Local Time
    03:15 AM
    Quote Originally Posted by josephpeel View Post
    Why not just use a Material parameter instead of a tick box? Link an instance parameter to the 'Material' parameter of the geometry you want to change and the user can select black, or white (Or red/glass/grass/disco ball, whatever...)
    Or do it at Type level without formulas. So yes you have to set everything correctly for the Black and White Types, but then the user only has to select which they want.

    Personally I find controlling materials with a parameter and selecting them in the project with Edit Type is good practice anyway. Then the family itself doesnt have to contain all the materials, it will use the materials that are managed in one place in the project file.
    I agree that materials should live in the project, and the family should have material parameters. I do wish they could be controlled by formulas though, so I could do such things as defining a typical and emergency color and then having the element be assigned a material with a formula like "if(Emergency, Emergency_Finish, Standard Finish). The same would be handy for formulas in families where a part may or may not be an accent color. I'd like to be able to only define the standard color once, and have it assigned elsewhere by formula.
    josephpeel likes this.

Similar Threads

  1. How to Use IF Statements in DynamoBIM
    By Simply Complex in forum Blog Feeds
    Replies: 0
    Last Post: April 1st, 2015, 05:45 AM
  2. Electronic Disclosure Statements
    By DGoffron in forum Architecture and General Revit Questions
    Replies: 4
    Last Post: October 10th, 2013, 04:45 PM
  3. Conditional statements, anyone?
    By Jaime in forum Architecture - Family Creation
    Replies: 3
    Last Post: July 30th, 2013, 01:37 PM
  4. Nesting Not Statements
    By cellophane in forum Architecture - Family Creation
    Replies: 8
    Last Post: May 2nd, 2013, 05:11 PM
  5. Formula Help - If statements
    By cellophane in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: May 16th, 2012, 06:01 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •