Array in family acting weird with formula

Array in family acting weird with formula

Shaiki_
Advocate Advocate
2,446 Views
22 Replies
Message 1 of 23

Array in family acting weird with formula

Shaiki_
Advocate
Advocate

I have a very simple detail component family that arrays lines on one axis and stretches them on another. There is a parameter for the spacing, array length, and line length. 

 

My issue is that the family only works when the spacing is set to 1'-6". Any other spacing and the last line will place outside the array length. The formula that works for 1'-6" also doesn't really make sense...overall I am confused and hoping one of you can help. I have attached the family for your testing. 

 

The end goal is: Have first strand start 3" from the right side, array at the spacing defined in the parameter with the last strand stopping less or equal to the "Panel Width" length. 

 

Thanks 

0 Likes
Accepted solutions (1)
2,447 Views
22 Replies
Replies (22)
Message 2 of 23

ToanDN
Consultant
Consultant

Try this.

0 Likes
Message 3 of 23

Shaiki_
Advocate
Advocate

Still the same issue. If you nudge the left ref. plane to the right, it will pass the last detail line without affecting the qty of the array. If you change the spacing to 18" the last line in the array gets deleted as soon as the reference plane crosses it which is what I want for all spacings.

0 Likes
Message 4 of 23

ToanDN
Consultant
Consultant

Because you add 6" to your formula:

(Panel Width + 0' 6") / (Spacing)

 

Try: (Panel Width) / (Spacing) see if it works.

0 Likes
Message 5 of 23

barthbradley
Consultant
Consultant

@Shaiki_ wrote:

 

The end goal is: Have first strand start 3" from the right side, array at the spacing defined in the parameter with the last strand stopping less or equal to the "Panel Width" length. 

 

 


 

(Panel Width-0'-3") / (Spacing)

0 Likes
Message 6 of 23

Shaiki_
Advocate
Advocate

That logically what it should be but it isn't working. The +6" in the original formula made no sense but it worked exactly how I wanted it to, but it only works for the 18" o/c spacing. 

 

Different spacings change how far past the last detail line the Panel Width is when it adds or subtracts the next line in the array. Sometimes its +9", sometimes +3", sometimes -3". I can't figure out the logic. 

 

 

 

 

0 Likes
Message 7 of 23

barthbradley
Consultant
Consultant

Give me a situation where (Panel Width - 0' 3") / (Spacing) doesn't work so I can see for myself.  

0 Likes
Message 8 of 23

FAIR59
Advisor
Advisor
Accepted solution

It's a question of rounding. 

try: rounddown((Panel Width - 0' 3") / (Spacing)) + 1

0 Likes
Message 9 of 23

Shaiki_
Advocate
Advocate

That's it! Thank you!

0 Likes
Message 10 of 23

barthbradley
Consultant
Consultant

@Shaiki_: would it be possible for you to post the parameter values that caused (Panel Width - 0' 3") / (Spacing) to fail for you.  Just curious. I couldn't find any numbers that would result in the arrayed element over-shooting the Panel Width.  

 

….I did find a way it could fail though. If the Number of Strands is less than 2, it'll error out.  So, regardless of what formula you use to drive Number of Strands, I would make it conditional.   

 

if(((Panel Width - 0' 3") / Spacing) < 2, 2, (Panel Width - 0' 3") / Spacing)

 

or...

 

if((rounddown((Panel Width - 0' 3") / (Spacing)) + 1) < 2, 2, (rounddown((Panel Width - 0' 3") / (Spacing)) + 1))

0 Likes
Message 11 of 23

RDAOU
Mentor
Mentor

@Shaiki_ 

 

That's not it 🙂

 

First off welcome back  @barthbradley 🙂 haven't seen you around for a week!

 

With regard to the 3" formula

Adding 3" works fine until the spacing value results in a gap which is greater than 1x Spacing (testing it will show that it fails at very specific values pretty much hard to catch and one has to try it out some 20 times to catch that variance...example below

 

Barth Solution.png

 

With regard to the rounding

Rounding is similar to adding +6" and +3", what it does is that it narrows down the odds BUT will also fails at certain instances when the rounding is required to be ROUNDUP instead of ROUNDDOWN and vise versa...additionally, should the  3" offset from start also be variable, the variance will be easily spotted

 

To have it precisely meeting the condition you require, you need to set a conditional formula for the array based on the following:

 

  1. If the last segment falls beyond panel width
  2. If the last segment falls within the panel width but gap to the Panel End  is greater than 1 spacing
  3. If the last segment falls within the panel width and the gap is less than or equal to 1 spacing

But since you are happy with the rounding and till it fails and you are back here, no need to spend more time on this discussion :

 

 

 

 

 

 

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


Message 12 of 23

Anonymous
Not applicable

@Shaiki_ a couple of weeks ago I had the same problem while I was working on the reinforcement mesh. I almost tried everything and nothing worked which got me curious when I saw this post and download it to try

 

Can you or the solution guy explain how that is a solution when the array throws elements outside the panel width! 

 

I am not sure how that solved your problem and how  @FAIR59 came up with the idea that it is a problem of rounding and if he actually tried it before postin it

 

1.png

 

2.png

 

.

 

 

0 Likes
Message 13 of 23

RDAOU
Mentor
Mentor

@Anonymous 

 

You won't get an answer 😂

  • 1st because you have already noticed that the rounding doesn't solve it
  • and 2nd because that is how things are staged on this forum...many of the accepted solutions are not solutions  for anyone but the OP and the Author.

 

That being said...if you have an issue, start your own thread, describe the issue you are having and when you get replies pick the one which addresses the issue and solves it

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes
Message 14 of 23

ToanDN
Consultant
Consultant
No thinking about, why don't you use a filled region with model pattern to draw the it to spare the headaches?
0 Likes
Message 15 of 23

FAIR59
Advisor
Advisor

You have a typo in my formula, change the + sign to a - sign.

 

rounddown((Panel Width - 0' 3") / (Spacing)) + 1

0 Likes
Message 16 of 23

Anonymous
Not applicable

@FAIR59 Are you kidding me?

 

No I didnt I tried both and tried -/+6 , -/+4, -/+3, -/+2  and -/+1   and guess what... all failed. Changing the number only pushes the error to 1 step further, like denominating fractions. This shouldn't be a trial and error thing

 

One of the repitions I have repetitions is at 3 19/32" test it urself! I think I have tested your formula more than you did. This is hopeless

0 Likes
Message 17 of 23

RDAOU
Mentor
Mentor

@Anonymous 

 

To get to the result which you are after, you need a conditional statement that either kills the last arrayed segment or adds one where applicable. I didn't test it, but maybe something similar to what @barthbradley  was proposing in reply 10 above...

 

Again the OP seems to be happy with that so you should be happy for him too . Best is to start your post and describe your case and I'm sure it can be figured out OR use a masking region as  @ToanDN suggested lol it's just an array and shouldnt cause too much headache even if it is not 100% accurate

 

 

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes
Message 18 of 23

Shaiki_
Advocate
Advocate

Replying to last comment because too much has happened since I last was at my computer! 

 

I didn't fully test the formula that I accepted as the solution, I just tested it for the cases I needed at this time, namely 12" spacing, 10" spacing, and 18" spacing, and it seemed to work fine for those cases. The rounddown function made sense at first glance for all situations, but apparently that is not the case! I would like to fix this family so it always works, so I may test it further to see when it breaks.

 

In response to @ToanDN , I want to use a family because I feel its easier to adjust boundaries and schedule data, and also, wouldn't I have the same issue with spacing them in a FR? 

0 Likes
Message 19 of 23

FAIR59
Advisor
Advisor

@Anonymous 

no I'm not kidding, if you test the formula you'd have to use the right formula. This is part of your picture

WrongFormula.PNG

@RDAOU 

roundingdown is in fact a giant if statement:

if value is 0 up to but not including 1, result =0

if value is 1 up to but not including 2, result =1

if value is 2 up to but not including 3, result =2

etc.

I agree there should be a check to prevent the array breaking with less then 2 members, but that isn't the question. The question is how to ensure that the array stays within the PanelWidth mark.

0 Likes
Message 20 of 23

RDAOU
Mentor
Mentor

@FAIR59 

 

Reading the trail of replies above, it seems that it is breaking … I personally do not need to test it in order to know that it does not satisfy the given condition. (and not just when it is less than 2 members) 

 

One thing that guy said right...it shouldn't be a trial and error solution, hence when one proposes something one should  state that it just might not work for every condition, otherwise when someone points out that something is wrong with it, one should try to fix it 🙂 like @barthbradley tried to do  with the formula he gave initially (respect) 

 

"Rounddown is a Giant IF statement",.... No it isn't … Rounddown is a rule (always true) while IF is a conditional statement that performs a function if true and performs another when statement is wrong (infinitely)...in short 

 

  • a Rounddown might work for 1 certain condition but as the variables increase (example: length of panel, spacing and start offset change) the chances of rounding solving the issue tend to increase as well (101 arithmetic/probability)

 

  • An IF Statement is meant to be a conditional statement for variable conditions  

 

YOUTUBE | BIM | COMPUTATIONAL DESIGN | PARAMETRIC DESIGN | GENERATIVE DESIGN | VISUAL PROGRAMMING
If you find this reply helpful kindly hit the LIKE BUTTON and if applicable please ACCEPT AS SOLUTION


0 Likes