Message 1 of 7

Not applicable
09-07-2017
03:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello again,
I'm trying to do some splits, but I can't get it. Maybe you have an idea.
Here is the case:
I have a box called "base" and another one called "box_1" that follow the base, but with some free spaces called "space" with value 10 mm.
I want that if I change the value of the "splits", the left boxes of the "base" to be split it according to the "splits" spinner values and keep those free spaces.
I have a pice of code, too, but it works only with the "Splits" values 0 and 1. After 1 it's a disaster.
Here it is:
( b=200.0 -- The base space= 10.0 -- space between boxes s=1.0 -- Splits rollout Split "Split" ( label lbl1 "Base height:" pos:[10,9] width:86 height:13 spinner Base "" pos:[96,8] width:56 height:16 range:[0,10000,b] type:#worldUnits label lbl2 "Splits:" pos:[8,33] width:86 height:13 spinner splitCount "" pos:[94,32] width:56 height:16 range:[0,10000,s] type:#worldUnits button Create "Create" pos:[8,64] width:144 height:48 on Base changed val do (b = val) on Base entered do (b = Base.value) on splitCount changed val do (s = val) on splitCount entered do (s = splitCount.value) on Create pressed do ( function SPlit eMH:0 = ( if eMH == 0 then ( print "0" ) else if eMH > 0 then ( print "More than 0" theBase=box length:50 width:50 height:b pos: [0,0,0] theBase.name="theBase" box_1=box length:50 width:100 height:((b/s)-(space*2)) pos: [-75,0,(space)*(s)] box_1.name="Boxes" for i = 2 to eMH do ( nextBox= copy box_1 pos: [-75,0,(i-i) ) ) ) ----------------------------------------- SPlit eMH:(splitCount.value) ----------------------------------------- )--end create ) theNewFloater = newRolloutFloater "Sp" 170 150 addRollout Split theNewFloater )
Something is wrong. I have no idea how to do this. I tried so many ways, but I'm stuck.
I would appreciate if you could help me.
Thanks !
Solved! Go to Solution.