DC Exploration #3 - Scaling and Copying
-
I am trying to create a dynamic row of books.
When you scale the row (longer), you need to insert books to fill the space. For the row of books to be believable, the books can't simply repeat - they need to be different widths, heights, and have different materials.
The problem is where to position the "next" book. It needs to be placed at (or past) the end of the previous book, but there isn't a way to access the position of the previous book.
Ideas?
-
jim, a not very elegant solution could be to have a list of 'random' values that you can use for the width. That way you would know what the width would be each time and so youd be able to work out where to put each new book.
I imagine its going to be a little bit more complicated than that, but it might work.
-
Yea, as Remus said, I was going to suggest the same. You either have a set with seemingly random numbers that would repeat after a while which you can use to predict the sizes of the books.
Or if you can create an algorithm that will give the same row of numbers. However, to prevent that all book shelves end up the same you can use a seed number which is randomized. Maybe even use the interact tool to make the bookshelf generate a new seed number so you can click your way to a pleasing result. -
If your brain isnt too scrambled jim, you could try getting some books leaning at an angle, or some books stacked on top of the others
-
@remus said:
If your brain isnt too scrambled jim, you could try getting some books leaning at an angle, or some books stacked on top of the others
I just got back form a short vacation and hopefully I'll post something on this tonight. But you comment Remus reminded me that what I wanted to make was siding for a wall or roof of wood shingles. And you could input the a worn-out amount. So for a new roof, all shingles would line up nicely, but the older you make the roof the more shingles are mising, or cracked in half, or rotated, etc.
Well, hopefully later I'll get teat started.
And yeah, the DC explorations sort of died a little after we put so much sincere interest into the first few, just to lose all that to the server crash. I'll try to post another topic later tonigh, unless someone else beats me to it!
Chris
-
@remus said:
jim, a not very elegant solution could be to have a list of 'random' values that you can use for the width. That way you would know what the width would be each time and so youd be able to work out where to put each new book.
I imagine its going to be a little bit more complicated than that, but it might work.
I just had a thought that if I made some number of components each consisting of a "bundle" of 3 books of differing width:
book 1 = |1|
book 2 = |2|
book 3 = |3|bundle 1 = |1|2|3|
bundle 2 = |2|3|1|
bundle 3 = |3|1|2|
bundle 4 = |2|1|3|Each book 1, 2, and 3 are different widths from each other, but the bundle of 3 are always the same width. So I just need to randomize which bundle to insert.
|bundle 1_______|bundle 2_______|bundle x_______|
|1|2|3|2|3|1|3|1|2|I'm still not sure if this would work, or look right, but I think it will. (If that makes sense.)
-
And to extend the idea... a stack of books could be the same width, as well as a leaning bundle.
-
Ahh, yes I was thinking about this Jim, and I thought it was simple. But I started playing with it and in about 5 minutes I saw just how not simple it really is. The random width means that the amount of copies will vary depending on the width of the books. That is tricky!
I had a thought on placing them though. Each X should be the X of the previous (called "LastX") + the LenX of the previous (called LastLenX"). So what about each component passes its X and LenX out to a custom attribute in the parent component. So the next copy created would look to "parent!lastX" and "parent!LastLenX" to figure out its new X. Then after it sets its X and LenX, it writes its current state to the parent, overwriting the previous states and the cycle continues. So it runs like this
Copy0
X=parent!LastX + Parent!LastLenX (These values will be zero since they have not been filled yet)
LenX=3 (randomly chosen)
<<<Sends X to parent!LastX>>> (which is 0)
<<<Sends LenX to Parent!LastLenX>>> (which is 3)
Copy1
X=parent!LastX + Parent!LastLenX (Now this reduces to 0 + 3)
LenX=2
<<<Sends X to parent!LastX>>> (which is now 3)
<<<Sends LenX to Parent!LastLenX>>> (which is now 2)
Copy2
X=parent!LastX + Parent!LastLenX (Now this reduces to 3 + 2)
LenX=4
<<<Sends X to parent!LastX>>> (which is now 5)
<<<Sends LenX to Parent!LastLenX>>> (which is 4)Anyhow, its all theoretical since I am not on an SU7 enlightened computer at the moment. I hope that makes sense. In my mind it does, but I'm sure it will probably fall apart due to something I've forgotten. Anyhow, think about it
Chris
-
Hmm, it was well thought out, but its not working. Its not updating the custom attributes in the parent component as I was hoping it would. Bummer. I'll keep playing,
Chris
-
Chris, I think your idea was nice, but it might require more regression calculations back and forth from parent to child component in a way that DCs aren't designed to do right now.
I think Jim is on the right track with groups.
I went a different direction with this one, making a couple of useless shapes that copy when scaled. One is a spiral ramp or slide, the other is just playing with shapes. For the second one, Stretch, make it pretty wide, like 30-50 feet in order to see how the shapes play out.
EDIT: the SpiralSlide is an odd one. You need to Import it, but I get weird behavior. when you open it you will see that it in the Component Attributes it says Copies at the parent level. Delete this attribute, then use the scale tool on the component. What is weird is that every time I save the component (through the Component In Model context menu Save As) and re-open it, I always have this extra copies command. If you scale it with this copy at the parent level it takes a long time, and you see the number of copies explode if you have Outliner open. Any ideas why? Maybe I just need to clean things up and reinstall...
-
@wmanning said:
the SpiralSlide is an odd one. You need to Import it, but I get weird behavior.
It appears to behave normally for me. I dragged the file into SU7, deleted the Copies for the top-level DC, then scaled the DC.
Now the first time I tried, I got a lot of extra copies because I didn't delete the Copies attribute first - and only deleted it after the copies were already made. But this does not delete all the copies that had already been created.
When things get messed up like that, you can set the Copies attribute to '=0' before deleting it (based on my experience.)
-
Thanks Jim, I'll try that.
The really odd thing though, is that after deleting the copies at the parent level, if I then save the component, I still get components at the parent level the next time I import it...
Either way it is fun to simply play with the formulas and later I can figure out what I want to build.
-
Hi there Chris,
I find dynamic components facinating.
I manufacture wood furniture in South Africa and I love using Sketchup.
Ver 7 Pro is great and would love to get involved in making dynamic models which can both re-scale and react as in doors of cupboards open and close, drawers open and close.
I am still trying to get the basics of how to make for example a cupboard that can scale and the doors can open and close etc...
I love the Idea of the cutlist and edgebanding calc's.Very excited,
Nic -
I'm currently digging into DC a bit more -- I previously only used it for really simple things like setting textures and opening doors... this isn't a terribly useful model but it does showcase some of the problems I'm working on solving right now.
Best,
Jason. -
Hey, thats cool. I like that!
-
While nothing nearly as cool as the other spiral stairs here I have created my own -- just use the scale tool to pull up more.
Best,
Jason. -
Here's a scale-tool based fence that randomizes the board positions to create a more natural effect.
Best,
Jason. -
Here are some Kitchen cabinets that I've been working on. Most proud of the Floor Drawer Unit with it's drawer boxes that scale along with the cabinet on the X axis.
Please note. This is a work in progress.
-
Has anyone figured this out, by chance? I know it's been a while, but I have an application for it, and I'm racking my brain trying to figure out how to make it work. For mine, it's more of a "snake" component, where the user begins with one part, then selects 1 of 3 interactable "buttons" that creates a copy in one of the directions, turning the copy to fit. The link below should make sense of what I'm saying. Thanks in advance!
BT
http://forums.sketchup.com/t/help-making-copied-arrays-with-distinct-attributes-for-each-copy/31487a
@chris fullmer said:
Ahh, yes I was thinking about this Jim, and I thought it was simple. But I started playing with it and in about 5 minutes I saw just how not simple it really is. The random width means that the amount of copies will vary depending on the width of the books. That is tricky!
I had a thought on placing them though. Each X should be the X of the previous (called "LastX") + the LenX of the previous (called LastLenX"). So what about each component passes its X and LenX out to a custom attribute in the parent component. So the next copy created would look to "parent!lastX" and "parent!LastLenX" to figure out its new X. Then after it sets its X and LenX, it writes its current state to the parent, overwriting the previous states and the cycle continues. So it runs like this
Copy0
X=parent!LastX + Parent!LastLenX (These values will be zero since they have not been filled yet)
LenX=3 (randomly chosen)
<<<Sends X to parent!LastX>>> (which is 0)
<<<Sends LenX to Parent!LastLenX>>> (which is 3)
Copy1
X=parent!LastX + Parent!LastLenX (Now this reduces to 0 + 3)
LenX=2
<<<Sends X to parent!LastX>>> (which is now 3)
<<<Sends LenX to Parent!LastLenX>>> (which is now 2)
Copy2
X=parent!LastX + Parent!LastLenX (Now this reduces to 3 + 2)
LenX=4
<<<Sends X to parent!LastX>>> (which is now 5)
<<<Sends LenX to Parent!LastLenX>>> (which is 4)Anyhow, its all theoretical since I am not on an SU7 enlightened computer at the moment. I hope that makes sense. In my mind it does, but I'm sure it will probably fall apart due to something I've forgotten. Anyhow, think about it
Chris
Advertisement