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.
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.
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.
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.