Change total length of rectangle frame without change its thickness?

Greeting , in sketchup pro I want to be able to make dynamic component of rectangular frame that will change its total length without changing its thickness in terms of width thickness and height thickness. I need explanation or tutorial for this.

Take one of the supplied examples in the Component Warehouse ( a window, for instance) and ā€œtake it apartā€ to see how it is made.

Basically you need four subcomponents for the edge parts and another four for the corners, with the connecting edges hidden, and then to regulate their respective sizes and positions in the DC attributes with formulas relating to the overall size of the component.

Even simpler:

Go ahead and make the subcomponents and hide the lines you donā€™t want to be visible, then constrain the SCALE tool (in DC Attributes). For the corners, allow NO scaling, for the other pieces, allow scaling only along their length.

No need for formulas!

Flash update! Iā€™m wrong! Either that or something strange is going on!

I followed my own advice and constrained the scaling on the subcomponents, then tried to scale the main (enclosing) component. It scaled in any direction - and did introduce the (in this case) unwanted distortions.

Darn!

1 Like

you got me all kinds of excited, thinking Iā€™d missed something this whole time haha

Why do you need separate corner pieces - at least if you donā€™t want mitred corners or moulding profiles?

Two sides that keep their width and depth, but can ā€˜stretchā€™ along their height, and two horizontals that stretch along their lengths, should surely suffice for a plain rectangular frame, shouldnā€™t they?

Unless, perhaps, you want the width of the frame pieces to be variable and different for side and top/bottom?

For me, itā€™s been to hide the seam between each corner and itā€™s adjoining sides. We use SU as a sales tool, and our clients are very distracted by any detail that stands out to them. Of course, itā€™s not for everyone. Hereā€™s where weā€™ve needed to use it:

Do I understand that you want to hide the join lines between upright and cross member, not show them?

The grain transitions will look a bit odd if thereā€™s no visible boundary line, wonā€™t they?

If you do indeed want to do that, then yes, you do need the corner pieces, with hidden edges where they join the uprights and crosspieces.

And do you want to use the Scale handles to adjust the overall size of the frame, but a Component Options dialogue to set the width and thickness of the framing pieces?

If thatā€™s the case, set up a Frame component (or name it what you will), with left, right, top and bottom pieces, and four corner pieces with appropriately hidden edges on all of them. And you can probably Erase the end faces at the joins too.

Set up DC Attributes for the Frame for overall Width = LenX, Height = LenZ, Thickness = LenY, Upright_width, and Crosspiece_width. Make the Upright_width and Crosspiece_width settable in DC Options (if you donā€™t need to be able to specify a different width for upright and crosspiece, omit one of these and call it perhaps Frame_width).

Itā€™s easiest if you mirror the sides, uprights and corners (so their origins are on the outside corners or edges of the frame). Remember to make each of the eight pieces Unique, and give them meaningful names - e.g., Side1, Side2, Upright1, Upright2, CornerBL (bottom left), CornerBR, CornerTL, cornerTR.

Then set the positions of each side, upright and corner piece so it will be the right size and placement, using Attributes for each pieceā€™s X, Y, Z and LenX, LenY, LenZ attributes based on the Parent value Atrributes and the geometry of what youā€™ve drawn.

Havenā€™t time just now to set one up but will try later today, as it would be a useful component to have for my own use (though I donā€™t usually want or need to hide the joins).

And one other thought of a different kind altogether. Another way to draw the frame without joins, provided the width is the same all round, would be to use FollowMe round a rectangle, with a rectangular cross section.

PS. Just tried it on a simpler version with visible joins, just vertical and horizontal pieces. Unfortunately, I find, the frame width varies with the scale of the overall frame and doesnā€™t stay constant as I thought it should.

Hmmm. Perhaps use the DC Options to specify the overall height, width and thickness directly?

Exactly what I found when I tried my suggestion above! And why I edited it to strikeout the suggestion.

Iā€™m wondering if I should report this as a bug? i.e. That DCs with children donā€™t honor the scaling restrictions of the child.

I see now what you meant - sorry, I didnā€™t really take it in fully when I first read the strikeout paras, until I tried it myself.

And I agree, it seems like (another) bug in DCs - they need some TLC and donā€™t seem to have had much since they were first introduced.

On further thought, I wonder if thereā€™s a difference between LenX (or LenY, or LenZ) in which I set Height = LenX, if one were to use the CURRENT value instead? Not that I quite remember how toā€¦!

On a related issue, I was trying to make a DC for a frame, with an optional number of middle crosspieces. I can easily work out where to put them if there are one or more. But - other than hiding one if you really want none - can you completely suppress drawing an optional subcomponent in a DC? Can you? Or is hiding it the best one can do?

Was just about to use Google, to see if I can find out, but maybe you know?

If LenX is the length of the rail, LenY, the thickness, and LenZ the width (height), then for LenY use =t where t is the thickness of the rail and for LenY use =w where w is the width of the rail. This will lock those dimensions to the desired size even when the entire door frame is scaled. Thereā€™s no bug. You just have to be explicit about those dimensions.

@DaveR. that works when you specify the height or width by input to the Component options.

When I allow the Frame Behaviour to scale on Z. say, the stile width scales with the overall height, even though the stile has explicit values set for LenX, LenY and LenZ, set either directly from the Component Options (stile width and thickness), or by calculation from them (Length as overall width less twice the uprightsā€™ width.

In your example, you havenā€™t enabled the Scale behaviour on the Frame, if Iā€™m reading the screenshot correctly.

See what happens when you do. It didnā€™t work for me.

1 Like

Well, clearly it CAN work - thanks for showing that so graphically.

Iā€™ll have to try again.

Hereā€™s where Iā€™m starting from.
Frame - vertical plane DC.skp (150.4 KB)

How could I let it scale on at least width and height?

ā€¦ a few minutes later.

Well, it now DOES work, with just red green and blue scaling allowed. Previously, when I enabled all scale handles, it didnā€™t.
Frame - vertical plane DC.skp (165.0 KB)

I know one can enter a dimension with units for the scale tool. Can one combine that with allowing explicit entry in a text box?

Set Scale handle visibility for only the parent component.


Yes. I would use inferencing to get the size of the frame to match the size of the case it goes on.

I did that earlier with all scale handles enabled. That did not seem to work. When I limited it to red, green and blue, it appeared to work on Z with my modifications to set LenZ = Current("LenZ"), and Height = LenZ.

Will extend to Y and Z too.

And when I try to, it breaks again - even on Z which I havenā€™t changed.
Frame - scaling broken.skp (58.6 KB)

Temperamental things, DCs.

I havenā€™t had time to look at your component very closely but from what I can see, youā€™ve made it more complex than it needs to be. Will have to look later.

Thanks - not urgent at all. I was mainly just playing around, as Iā€™m still not very familiar with DCs. Iā€™ve made a few, but not many, and all with some quirks that puzzle me still, though I got them to work in the end.

AHA! It works after scaling, sometimes on its own, but often only after an explicit Dynamic Component/Redraw. Thatā€™ll do, I think.

What you really need is the ā€œStretchā€ function. See ā€œStretch by Areaā€ by TAK2HATA

I draw cabinets and am able to stretch a cabinet, including itā€™s doors, drawers and interior parts, all at once without distorting itā€™s parts (like stiles and rails on the doors).
I canā€™t imagine using Sketchup without this plugin.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.