2010-01-20 05:28 PM
for i = 1 to o_nmr step 1got tips?
block o_la , o_lu , h
if i * o_la < ed_la then
addx o_la
else
! for e = 1 to int( ( o_la * i ) / ed_la ) step 1
!
! if o_lu * e < ed_lu then
!
! addx o_la * int ( ( ed_la - (o_la *i) ) / i )
!
! addy o_lu
!
! endif
!
!
! next e
endif
next i
2010-01-20 09:20 PM
2010-01-22 02:23 PM
for e = 1 to int ( obj_nbr*obj_lenght/length_max) step 1
for i = 1 to obj_nbr step 1
block obj_lenght , obj_width , heigth
if int (i * obj_lenght / length_max ) < 1 then
addx obj_lenght
else
del top
addy obj_width*e
addx obj_lenght
endif
next i
next e
del top
mulz -1
block length_max,width_max,0.1
2010-01-22 04:36 PM
matsgherri wrote:This will only execute more than once if the combined length of the objects is twice or more times the maximum length. This may be what you intend but I don't quite understand the logic. Is your intention to only model complete rows and leave off the last partial one?
for e = 1 to int ( obj_nbr*obj_lenght/length_max)
if int (i * obj_lenght / length_max ) < 1 thenThe only integers less than one are zero and negative. This is a curious way to do this. It also means that on the second row it will only execute for (approximately) half of the blocks that fit in the max length, on the third row for only a third and so on. I doubt this is your intention.
block_lg = 1.0 block_wd = 0.5 block_ht = 0.25 max_lg = 10 total_blocks = 36 number_X = INT(max_lg/block_lg) number_Y = INT(total_blocks/number_X) FOR i = 1 TO number_Y FOR j = 1 TO number_X Block block_lg, block_wd, block_ht addx block_lg NEXT j del j-1 addy block_wd NEXT iThis code skips the last partial row (as yours appears intended to do). To model the partial row you can change line 12 above to read:
2010-01-22 05:45 PM
2010-01-25 04:24 PM
2010-01-25 05:05 PM
obj_width = 3i still got to think how to stop the script when it has got to 8 instead to make 9 boxes!
obj_lenght = 2
obj_height = 0.5
obj_total_number = 8
area_width = 10
area_length = 15
area_thickness = 0.1
x_objcts_on_area = int (area_width/obj_width)
y_objects_rows_on_area = int (obj_total_number/x_objcts_on_area)
for k = 0 to y_objects_rows_on_area step 1
for j = 1 to x_objcts_on_area step 1
block obj_width,obj_lenght,obj_height
addx obj_width
next j
del j-1
addy obj_lenght
next k
del top
mulz -1
block area_width,area_length,area_thickness
2010-01-27 10:31 AM
obj_width = 3 obj_lenght = 2 obj_height = 0.5 obj_total_number = 2 area_width = 10 area_length = 15 area_thickness = 0.1 x_objcts_on_area = int (area_width/obj_width) y_objects_rows_on_area = int (obj_total_number/x_objcts_on_area) FOR k=1 TO obj_total_number BLOCK obj_width, obj_lenght, obj_height ADDx obj_width IF k MOD x_objcts_on_area <.001 THEN DEL x_objcts_on_area ADDy obj_width ENDIF NEXT k del top mulz -1 block area_width,area_length,area_thickness