Please help with spacing of copies in dynamic component

shelves - test.skp (30.8 KB)
Hello everyone, :grin:
I need a little help with dynamic components. I recently started using dynamic components in my work. I’ve created a component that consists of multiple subcomponents - in my case, the parent component is a group of shelves. Using formulas I was able to get equal spacing between all visible shelves (=(LenZ-A_thickness)/shelve!Copies) but when I add an attribute that hides the first and last shelves, I can’t seem to get a formula that will distribute the remaining shelves to the space I entered via “height” option. I also don’t know if I wrote the formula for hiding the first (original) and the last copy correctly. I wonder if this has any effect on the behavior of the components. Every help is welcome. Thank you in advance. Greeting

P.S. The model is attached for download.

1 Like

maybe describe how this works. if you hide the top or bottom or both shelves, do you expect the other shelves to retain the same positions? or expand their positions to fill the space? if the former, then keeping the same number of shelves and simply hiding the top/bottom/both should work. if the latter, you’d need to re-compute the space to accommodate the new number of shelves with whatever offset(s) you want on the bottom or top.

1 Like

I would like when I hide the first and last shelve to have the remaining visible shelves fill the empty space created by hiding these two. So, I would like them to behave in a way that they expand their positions to fill the empty space (which is determined by the thickness of the shelf * 2 in my case) no matter how many shelves I added or what value I set for the height of the model in which the shelves will be arranged.

Can you post the model? Happy to help if you do…

shelves - test.skp (30.8 KB)
Here is the model, I hope you can find a solution. :slightly_smiling_face:

1 Like

Maybe this will solve your problem:
for shelve position Z formula should be =copy*(Shelves!LenZ/(Shelves!E_visible_shelves+1))
But I don’t understand why you need to hide first and last shelve, there is another way to do this.

2 Likes

Hey here is what I think you are looking for:

shelves - test-edit.skp (26.8 KB)

I adjusted the spacing and number of copies instead of hiding the first and last shelf.

Couple things:

DCs cannot see down, a parent component cannot see its children (or their attributes), the children can only see up to the parent and read its attributes. So, move all of the required calculations up to the parent level and then reference the parent attribute in the child.

You could use the Parent! reference instead of the name of the parent component, keeps things simpler and avoids errors if you change the parent name.

I agree with @pemitic there is likely a simpler/cleaner way to do this, can you explain your desired end result in a bit more detail?

Cheers!

2 Likes

The problem I’m trying to solve is that when I place dynamic components (shelves) within a specific space - for example a closet, I want there to be equal spacing between each shelf. I managed to do that (model on the right), but in furniture making (I make custom-made furniture) the lowest and uppermost shelves are unnecessary (model on the left). Since I don’t want to add one shelf at a time to the model using the tape measure tool because it takes too much time, I would like to hide the first and last shelves, and have the remaining shelves fill the gap created by hiding these two. In this case, the thickness of the shelves is 25 mm (which can be changed via options), so hiding them creates a gap of 50 mm, which the other visible ones should fill.
Maybe there is a different solution from the one I imagined. Thanks for the answers so far, I hope that with your help I will solve the problem.

The formula unfortunately did not work. Below I have explained in more detail what I want to do.

Thanks for the tip on using the parent reference. I will change it in my components. I have uploaded an image below to explain in more detail what I want.

@rwamoore @pemitic this picture best shows what I want to achieve.

you need to account for the offset of the bottom layer - kick plate + bottom plate. then calculate the space to the top plate and divide that. include the bottom offset to start the copy placement. for the bottom and top plates, just create as separate from the shelves so you can easily have options for their placement etc.

1 Like

so something like this:

model:
example cabinet.skp (134.8 KB)

2 Likes

I tried to apply the recommended formulas, but I still get the same result. A half-solved solution would be to extend the shelves to the top of the wardrobe (end) and to the bottom of the floor (beginn), in order to fill the space, but then the shelves overlap the sides of the wardrobe, and I don’t want that. I want the shelves to be independent of any other model/component. For example, when I enter a height of 1000 mm and hide the first and last, the visible shelves are reorganized and fill the empty space.

This would work great if I had a fixed number of shelves inside the closet that depended on the closet as a parent component. My plan is to have e independent shelf components that I would put anywhere (for example in an equally independent closet, between walls etc.).

3dshouse - shelves.skp (763.9 KB)
Searching for a solution, I found on the Internet an example of a component that I want to make myself. It was created by the authors (or the author) of the “3dshouse” plugin, which I found on the following page: https://3dshouse.com/
I tried to see what formula the author made for his component and apply it to my model, but I couldn’t figure out where I was making mistakes.
The plugin has really cool things, maybe it can be useful to someone in their work. Really good work by the author.
Someone might think “Why don’t you just use this component?”, but since I want to do some modifications afterwards and present it to my colleagues, I don’t want to take someone else’s component and work and present it as my own.

the simplest thing would be a square acting as the “base” (in my example the top of the bottom plate) for the shelves. then simply using those lines (only lines) to position it within aome cabinet box wall alcove etc etc.

1 Like

Does this work for you? I eliminated and changed a few things to try and simplify.

shelves - test2.skp (28.1 KB)

1 Like

Unfortunately it was not applicable in my case, but I found a solution. Thank you for your help.

I managed to find a solution. In the end, I didn’t hide the shelves at all, but I determined the position across Z axis of the initial (original) shelf according to the spacing formula (picture and model attached). Thank you all for your help, you are wonderful! With the help of all of you and your ideas, I applied a different approach and simplified things, which resulted in the solution I wanted from the beginning.
Cheers


Solution.skp (752.5 KB)

1 Like