If statement for simple dynamic block

If statement for simple dynamic block

Anonymous
Not applicable
5,905 Views
6 Replies
Message 1 of 7

If statement for simple dynamic block

Anonymous
Not applicable

Block 1Block 1Block 2Block 2

In the dynamic block, is it possible to use an “IF statement”? For example, if a had a square where I had the following user parameters (Block 1):

Length: 5

Width: 10

 

And I wanted width to increase to 15, IF length was greater than greater or equal to 6 and less than 20.

Is there a way to input this “IF statement” in as an expression (Block 2)?

 

Thanks,

rapps

0 Likes
Accepted solutions (1)
5,906 Views
6 Replies
Replies (6)
Message 2 of 7

Libbya
Mentor
Mentor

Can you give a more specific example of what you are trying to accomplish?  You can make conditional effects within a block where one parameter is altered in a specific way dependent on the value of another parameter.  There are various ways to do that more easily than if/then statements and generally, using constraints is the hard way about it.  Post what you actually want to accomplish.  An example block as a starting point with examples of how it should behave under specific situations would be helpful.  

0 Likes
Message 3 of 7

Anonymous
Not applicable

I would like the following to happen in attached model (parameters in quotes):

 

When "LineSpeed" is between 1 to 9, "NozzleSpacing" should be 9.

When "LineSpeed" is between 10 and 16, "NozzleSpacing" should be 12.

When "LineSpeed" is  17 or higher, "NozzleSpacing" should be 18.

0 Likes
Message 4 of 7

Libbya
Mentor
Mentor

I just posted a screencast to your array thread.  That is still the approach I would take to this block although if your end result is much more complicated it might get a bit dicey.  To do the variable array column offsets, I would use a double lookup to switch between the 12 possible visibility states (assuming all 4 of the arrayed areas needed the same 3 variable array column offset values).  It's both advanced and not hard to do.  I would certainly ditch all of the constraints as that is a more difficult way to accomplish what you are asking for.  I'll work up a screencast to demonstrate how to get the double-lookup and varied column offsets working.  Implementing that approach where there are multiple arrays similarly controlled is another level of advanced block making but also fairly easily doable once the concepts are understood. 

0 Likes
Message 5 of 7

Libbya
Mentor
Mentor
Accepted solution

The following screencast shows how I would do it.  I will mention that it is also possible to do similar using an actual array item (formed using the autocad ARRAY command rather than dynamic parameters and actions) and to control it via formulas based on your constraints and user parameters.  You can also accomplish your conditional controls using a block properties table similar to how I used the double lookup and avoid needing the visibility states.  If you choose to go that route, I will opt out of the discussion.  The details are posted in the archives in various threads, though.  Here's the screencast on how I would do it:

 

 

0 Likes
Message 6 of 7

Anonymous
Not applicable

@Libbya I appreciate this screencast, and you showing this method of accomplishing that task. Is there a particular thread you would recommend for: conditional controls using a block properties table method?

 

thanks,

rapps

0 Likes
Message 7 of 7

Libbya
Mentor
Mentor

I don't know of a particular thread off hand but quite a few have popped up.  I'd recommend doing a search for block properties table.  When you edit the table, if you check the little box at the bottom that states it must match a row, then when one parameter is changed to a specific value then another parameter that is controlled by the table must change its value to match the new row.  More complicated is getting the autocad arrays to be controlled by the constraints.  Again, search is your friend.  

0 Likes