Tricky Dynamic Component question

Hi there,

I’m dealing with a rather difficult challenge: I’d like to make a dynamic component that contains cabinets. I’d like to make the component scalable in one direction, in this way, that the more I stretch it, the more cabinets doors will appear.
Now I can make a ‘fence-like’ component that adds copies of the cabinet doors and positions them according to the total length of the component. However, I’d like to add something extra:

I want my doors always equally divided over the total length. So let’s say, at a total length of 1,5 meter, I’d like to see 3 doors, equally divided. When I stretch my component until 2 meter, I’d like to see 4 doors. When I make my component 1,75 meter, I like to see either 3 or 4 door, depending on the following: When my door width exceeds a certain number (let’s say 55cm), I’d like my component to add a 4th door automatically.

I figured I have to use the ‘IF’ functionally somehow, but I can’t get my head around it. Hopefully there’s someone out there with lots of experience and a well working brain!

Thanks in advance.

1 Like

Hey, so you don’t need an IF Statement, just math.
So the logic I used was the total length divided by the door width to get the amount of doors you need. To get the remainder, I did total length minus the total sum of the copies. With the reminder space, I divided it by the amount of copies minus 1.
So 3 doors of 30" is 90"
Total length of 100
Reminder space is 10"
10 divided by (3 doors-1), and thats the gap between doors.

This was trickier than I imagined, so I’m pretty sure my method can be cleaned up to a cleaner formula. but this seems to work.
Good Luck.

Dynamic_Door_Copy.skp (87.7 KB)

1 Like

Thanks for you quick response Quantj, this is getting really close to what I’m looking for!
(I’d like to increase the number of doors only when the door width would exceed a certain value, instead of a preset width, plus I don’t need the gaps).
I’m gonna try to get my head around it and see if I can understand the way you made your block. It’s already very interesting since I just started building dynamics since a few days

I realized I misread your first post.

Try this one:
So it’ll change the door width up to a Max of 50" before adding another copy and re-adjusting all sizes.

I feel like this was mentioned before in this forum somewhere, maybe there’s more info about this somewhere. I couldn’t find it when i searched, but I swear I’ve made something like this before for another post.

Dynamic_Door_Copy-2.skp (95.9 KB)

Quantj you have no idea how grateful I am! Thank you so much :slight_smile: 'm gonna spend some time figuring out how you made this component. This is exáctly what I was looking for.

So, I’m slowly understanding how the component works, and I’m ready for the next challenge. Since the cabinets doors are gonna have handles to open them, I’d like to position every other door mirrored (so the opening handles will be adjacent to one another.
I figured I don’t necessarily need coding for that, since I can manually flip every other door.
However since the axes of the door are not positioned in the middle, I thought I should change the axes to the middle, and then change the code at Door, Position X (=IF(Copy=0,0,((CopyLenX)-LenX))), to =IF(Copy=0,(0.5LenX,((Copy*(0.5LenX))-)(0.5LenX)))

However, I unfortunately found out that doesn’t work. Probably because of the order in which the attributes are followed. How would I build a cabinets component with flipping doors?

you could wrap the component within another with opposite axis

Hey Pcmoor, that doesn’t work unfortunately, since it’s always the mother component (of the door itself) that needs to be mirrored.

Haven’t tried to see is this would work, but what about having the knob in the component and have a formula to make it flip if the COPY is an even number or not?

Also, you might want to clean up what i did previously if you’re reusing my old model, i was sloppy with how I treated COPY0, sorry :stuck_out_tongue:

Hmm… That doesn’t work since I have to change the door’s axes to the middle in order to flip it around it’s middle. Doing that destroys the model, and I’m not sure why

What about creating 2 knobs? 1 is hidden on EVEN copy and other it hidden on ODD copy?

and you don’t necessarily have to flip the knob once, you can have it rotate and move position on Copy number, it’s more complicated, but I think it could work, definitely not a clean solution though.
FLIP=ISODD(Copy)
KNOB!LENX=IF(FLIP=1, x-350,x)
KNOBROTY=IF(FLIP=1, RotY+180,RotY)
…something like that

That’s definitely an option! Thank you for that. I’m still very curious though, if it would be possible to actually flip a subcomponent. With the position, length and rotation values, I can’t (as far as I know), flip a subcomponent. Entering negative values for position or length don’t seem to work (which I understand).

So If somebody knows how to actually flip anything?

What about the following approach:

Door axis in the middle
Width custom variable created as described above, based on length of component/remainder, etc
LenX of door equal to = IF(ISEVEN(COPY),Width,Width*(-1))

Does that work?

I know this post is old, but I’m hoping that it will help with answering my question…

I am trying to make wall panels that are a max of 48" wide and is scalable, similar to these cabinet doors. However, I would like the first panel to stretch up to a max of 48" before creating a copy that will also stretch up to a max of 48" before another copy is made… this would keep repeating until the entire line of panels is done. When complete, every panel would be 48" wide with the last panel being whatever the measurement is to fill the entire string.

Example:
I have a space that is 18’ wide and I need to add a string of these panels to close off the space. Since the max width would be 48", while stretching, each panel would stretch one at a time up to the max before creating a copy. When complete you would end up with (4) 48" panels totaling 16’ with the last panel only stretching to make up the last 2’ needed for the 18’ wide panel wall.

I know I could copy array, but would like more of a dynamic component that would be quicker and easier for my team to use.

Hopefully this is possible…

Thanks in advance!

A lot has happened in 4 years. While this could be done with a DC, I think I would invest some time in Profile builder, and have the whole assembly drawn in one go:

PB is fine but it entails its own “learning curve”. Not saying that DC’s are any simpler, just that it might be of value contacting a DC-Specialist once in a while to have these more specific things done. You have better things to do than DC’s.

Here’s a possible solution.

Remember that the Component in this SKP should be “Saved As” its own independent DC-Component so it can later be Imported onto other SKP projects.

Enjoy.
Nino

48in Panels.skp (44.1 KB)

1 Like

Thank you for your feedback. I have previously tried PB, but it’s a hard to sell to get the office to buy an extension for the entire team and then need to train them. It is a nice extension though!

1 Like

ninoalva- that is EXACTLY what I was looking for! You have saved me a ton of time trying different things to make it work the way I wanted… Thank you for the help!

My Pleasure. Here to Serve

Nino

1 Like