A way to calculate the N° of Series needed to fill a certain distance.

A way to calculate the N° of Series needed to fill a certain distance.

JonnyPot
Advocate Advocate
641 Views
4 Replies
Message 1 of 5

A way to calculate the N° of Series needed to fill a certain distance.

JonnyPot
Advocate
Advocate

Hello everyone 

I have this wall that varies in Height and i would like to have the N° of series to adapt with the height.

The way i have it set it up now is by dividing the high by the distance in between series, but this thasant work very well because some times the number is decimal, if any one knows how to change the decimal precision to always infirio it will also resolve my problem.

Any suggestions are welcome.

JonnyPot_0-1608027460562.png

 

0 Likes
Accepted solutions (3)
642 Views
4 Replies
Replies (4)
Message 2 of 5

Daan_M
Collaborator
Collaborator
Accepted solution

Something like this?

 

Sub main
Dim Answer As Double
Answer = 15 / 4 'your calculation

inc = 1 ' rounding increment ( .125, .25, .5, etc)
rAnswer = Floor(Round(Answer, 4) / inc) * inc

MsgBox(rAnswer)
End Sub
Message 3 of 5

dutt.thakar
Collaborator
Collaborator
Accepted solution

@JonnyPot 

 

The solution @Daan_M has provided is perfect and will work best.

Another thing, what you can do is rather than writing the code, you can directly round up or round down the number inside the pattern dialogue box or in the parameters. Inventor parameters support "ceiling", "floor" and "round" functions directly inside parameters.

 

If you want to round up you can write =ceil

If you want to round down you can write =floor 

If you want to round to nearest number =round (this will either round up or round down based on the decimal precision)

 

See the snapshot also how you can use this.

 

Pattern.PNG

 

If this has answered your question. please accept this as a solution.

 

Regards,

Dutt Thakar

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 4 of 5

lmc.engineering
Advocate
Advocate
Accepted solution

Hi @JonnyPot 

 

In addition to the above, these two rules will calculate spacing based on either an optimal value (Closest to), or a maximum allowable series spacing, respectively.

 

'Work to optimal spacing. Returns closest value
Height = 1205 ' Some arbitrary number
OptimalSpacing = 200
TestQty = Floor(Height/OptimalSpacing)
SeriesSpacing = Height / TestQty 
SeriesQty = Height / SeriesSpacing
MessageBox.Show("Series Spacing = " & SeriesSpacing & vbLf & "Series Qty = " & SeriesQty, "iLogic")
'Work to maximum spacing, returns no greater than max value
Height = 1282 ' Some arbitrary number
MaxSeriesHeight = 200 TestQty = Round(Height / MaxSeriesHeight, 0) 'Find Actual spacing TestSpacing = Height / TestQty 'Loop and retest spacing until condition is met Do While TestSpacing > MaxSeriesHeight TestQty += 1 TestSpacing = Height / TestQty Loop 'Set values to driving parameters SeriesQty = TestQty SeriesSpacing = TestSpacing MessageBox.Show("Series Spacing = " & SeriesSpacing & vbLf & "Series Qty = " & SeriesQty, "iLogic")

 Your values for the height may need to take in to account any top and bottom frame thickness etc, however these rules should get you on the right track.

 

Regards 

Message 5 of 5

JonnyPot
Advocate
Advocate

thank you to everyone, the solutions are all great