Door dynamic open left or right side?

Hello, everybody,

I’m doing my first steps with Sketchup and now I have a problem where I found no way.

I have a cabinet where the door can be opened by clicking.
But how can I now dynamically set whether the door should open to the left or right?


I thought about this a bit - and it’s a tough one!

For a door such as you have pictured, I would give it dynamic open/close capabilities by setting its axis on one of the corners on the hinged side, then using an “OnClick” action such as “animate(RotZ,90,0)” (you might need -90,0"), but that won’t work if you also have a “Hinged: Left/Right” option.

I’d approach it with two doors! Used the “Hinged: Left/Right” option to determine which door is visible (using the “Hidden” attribute and some logic. Give them axis on their hinged side, then use the “OnClick” action to animate a custom variable of the enclosing component - call it something like “Open_Angle” - animate it 0,90, then derive the RotZ for each actual door from the “Open_Angle” attribute. You might have to go through some trial and error to get both doors to swing correctly.

Hope this helps.

Hello sjdorst,

I would just like to move the axes position, but that won’t work with Sketchup.
But the idea of hiding the 2 door was very helpful.

Unterschrank_Tueranschlag.skp (126,1 KB)


just to show that it is possible to do it without hidden elements, door is reversed using a wrapped door within a swing movement by changing leny to a negative value and moving position and rotation sign

reverse swing.skp (55.1 KB)


Great job, thx.

That solution came to me as well as I was falling asleep last night! I thought to add it this morning. But - Lo and Behold! - you beat me to it! :smiley_cat:

Caixa de armario aerio.skp (1.1 MB)
Hello, I’m new here, I need to make a door that can open both to the left and to the right. watch this example, Profile - pcmoor - SketchUp Community still, it is not possible to reproduce. could you do it step by step?

Thank you very much in advance

Hi Gerson,

I fixed your component, you need to have two components, one nested in the other, so best to use a “swing” container and then place door, handle, hinges… within this,
I hope to post a video soon (day or two) with possible better method and some sketches

Caixa de armario aerio 2.skp (182.1 KB)



It was a great help
thank you

Hello, Philip
A video explaining this would be of great help.

Enjoying! would there be any way to block the component, to prevent the user from exploding?

Important to note SIZE-Reduction also!


Hi Philip,
I tried to recreate a component with a selectable right or left swing similar to your very helpful ‘reverse swing.skp’ example. I couldn’t get the door to flip using the negative value in LenY. Looking deeper I could see the door was inside the swing component. You say ‘door is reversed using a wrapped door with a swing movement’, what do you mean by wrapped door and swing movement?
Many thanks

you need to place a DC within the object you are wanting to flip, so a simple attribute on a line group will trigger the behavior.
consider the rectangle with a nested line group with a set length, change the sign of lenX of the component

element flip.skp (21.0 KB)

The idea of the “door swing” DC, is to use its contents as the trigger rather than a line, That is the door, hinges, handle and any other attached objects, provide at least one is a DC. The contents of the “door swing” can then be swapped if need, like a flush panel for a colonial door and all the other mechanism remains.

Not having the benefit of the SKP in question; what happens if you R-Click the Compo and “Flip” alongthe X or the Y axes?


The DC will be flipped, however the data remains the same unless a redraw is done, so you might put
hand = if(rotz = 0, “left”,“right”) ,depending on the DC axis
It will not update unless a redraw is done

I am trying to apply the same technique as @pcmoor described on a door with a handle but first problem is the handle seem to be the handle goes to far then i need to rotate so the handle stays on the right side, could anybody try to see what am i missing ?

Also two more questions, is there way to make a option to either open door inside or outside and do i need to change the options if i resize the door ?

door_with_handle.skp (74.9 KB)

It doesn’t help that you have your axes upside down in the model you uploaded - blue pointing downwards when I open the file.

That confused me, and makes it harder for you to understand which way a given rotation will go.

I turned things right side up first.

Keep your axes consistent, and usually if you want to rotate a component, it’s easiest to do this around an axis - the blue axis pointing upwards, in the case of the door and handles.

You’ve set the two-handle component at position X = 4cm which is to the right of the origin of its parent component. That brings it in from the left hand edge of the door when the handles are on the left, but moves it out from the right hand side when you select Right, and Apply. And the door at 85cm wide is (I think) 5cm too wide for the opening, which puts the handle further right.

Is there any reason to have the extra level of component Usa (Threshold) in your model? It contains the door and the pair of handles, but not the sides and top of the frame which its name would suggest it could (but isn’t needed there either).

Why not make the handle pair a subcomponent of the door itself (Blat - though Google translates this as Countertop from Romanian, if that is the language of your DC).

And give Component#1 its a proper name (Door, or better, Doorway in English), and all the parameters that the subcomponent formulae refer to which aren’t present.

All the formulae in the subcomponents are showing in red, which indicates some referencing error. For example:

I thought that using parent instead of door might fix things, but it doesn’t - you don’t seem to have a component name door so an attempt to reference its properties like height, width, can’t work. And although Component#1 is the ‘parent’ of the Usa component, it doesn’t have height or width properties defined.

The door itself is too wide for the frame - you can see it poking through to the outside of the frame here.

Either the right hand upright in the frame is in the wrong place, or the door is too wide for the designed opening.

I’m not an expert on Dynamic Components, so I can see some of the problems, but not how to fix them. But maybe you can use what I’ve commented on to see how to fix it yourself?

@john_mcclenahan thank you very much, i am a beginner and i found the component online and i didn’t make it, i only tried to take the component and apply the trick from this post. Do you have a file that i can look at ?