Custom Grips or "Handles" on Dynamic Components

I have a door dynamic component with an attribute called “Finished Width”. Rather than opening the Component Options panel to type in a new Finished Width value, I would like to be able to drag handles on the component like so:

Any idea how I would do this?

This is not done with Ruby. (You should re-assign this to the DC forum category.)

Basically you control which scale handles are accessible in a DC.
Then you control how the subcomponents react to scale changes.

Look at some of the examples in the “Components Sampler” folder (collection).

The Bench is probably the best example there. Insert one. Select it. Then activate the ScaleTool.
You’ll see that only the horizontal scale handles are active. After scaling, the DC will modify the number of “BackStiles”, and stretch only the horizontal members that need stretching.

For more complex examples, check out some of the professional DCs for the Marvin Windows and Doors (available in the 3D Warehouse.)

Also, bookmark this page in the DC User Guide …

Thanks Dan. That’s a little different than what I am asking about however. I understand how to hide/show different Scale Tool handles and how to create complex DC components whose derive their geometry from attributes.

The problem is (and the Bench example you mentioned also suffers from this) limitation:

using the Scale Tool only scales objects relative to the bounding box.

What I would like to be able to do is to scale, or more appropriately Resize a given DC attribute visually by clicking on grips. These attributes might be anything in the DC that is re-sizable. In the door example I started with, the trim width, the door handle height, or as I mentioned, the finished width might be available to drag grips or handles to resize. These are all attribute values that are inside the DC and therefore will be independent of the Bounding Box as you can see in the Finished Width image I posted where the length indicated is 34.75".

This would be a helpful feature for many Dynamic Components because you often need to “Snap” to other model elements. Additionally, having to change focus from the modeling environment to a dialog box with many drop-downs and input boxes is a clunky and disruptive part of DC workflow in my honest opinion.

I have this in the Ruby Category because I think the best hope for something like this is to use the Interact Tool to activate a script that would communicate the interaction in the modeling environment to the value in attribute library programmatically.

So to me it seems like the first step to figuring that out is how to create a custom grip in the modeling environment?

  1. Not likely to happen as this would make component files a possible attack vector for malware. (This has been requested in the past several times. NOTE that because component files need to be transportable, the “script” would need to be embedded. This means SketchUp would need to implement or hook into some kind of anti-malware scanning system.)

  2. Not likely to happen as any new DC features have gone unimplemented. (Ie, Don’t waste time waiting. It takes 2 years on average now just to get any DC bugs fixed.)

Perhaps, but this is the nature of parametric components.
There usually is some input UI to change parameters.

Currently you can step through a set of hard set widths with each click of the Interact Tool.


The bottom line is that the DC extension is closed source and copyright by the owner of SketchUp (Trimble.) It is not acceptable to change it. An extension that does would be rejected by the EW submission review.

Not at all the case. I have used several programs from Revit to Vectorworks and even AutoCAD’s
Dynamic Blocks allow for visual control of modeling elements without relying on dialogs. It is certainly a shortcoming of DCs if that workflow is cast in stone.

OK well let’s just say I’m not looking to sell or profit from any script that might supplement the DC model and I’m not interested in making an extension to publish. This is just for my use.

And OK, let’s say its not a DC component but a custom component I develop from scratch that will be “DC like.” If I am not mistaken, its not illegal to to attach our own attribute libraries to objects, which is basically what DCs are.

Yes, that depends on the way you have set it up.

Example: simple frame with four sides.
In a nutshell, you would have to copy the left side, place it on the right and flip it over the axe on which you moved it, thus the components axis pointing ‘inwards’ the Parent Frame component.

Now the bounding box is not scaled relative anymore.

Also see this topic:

https://sketchucation.com/forums/viewtopic.php?f=289&t=14449&p=134583#p134583

Thanks Mike but I think you are also schooling me in DCs and how they work. Respectfully, I already know how to make decent DCs. I am talking about a way to give users control of DC attributes visually in the modeling environment.

Take a look at this GIF of a similar functionality in AutoCAD…

In the GIF, you see that you can click on grips to re-size various aspects of the block/component without having to switch over to a dialog box. This is what I am talking about.

As far as I can tell, the only tool you currently have at your disposal with DCs that will allow you to modify a component visually is the scale tool, which is hard-coded to the bounding box. I am hoping there is a way to create more granular control of a components attributes without filling out a form, which a I think is just a Web 1.0 way of doing things and should not be considered acceptable by anyone with any respect for UI design.

2 Likes

OK, I am going to ask this question another way because I ran up against this issue again today and it seems so basic that I am hoping there really is a basic answer.

Lets say the object shown below is a component that I can scale along the green (Y) axis. I would like to be able to drag the scale handle to the nearby line BUT…

I would like the grey rectangle to end up BEYOND the line like so…

I tried a few things like setting the Y position of the grey rectangle to PARENT!LENY+4

but that doesn’t work because PARENT!LENY just includes the 4 inch dimension the second you stretch it.

Basically, the objective is to use the scale tool to define a desired target length rather than having to type it in and then the component adjusts itself relative to that distance, placing some elements outside it etc as appropriate.

Any thoughts?

You have to work within the scale boundary box, so move the shape after the scale, so add an attribute condition statement option, no addon before scale, then change after. Otherwise the scaling will effect the outcome.
move after scale.skp (82.0 KB)

So for, say a door jamb, switch off the architrave, which would resize within the boundary of the jamb, scale and then turn on the architrave linings.

Thanks @pcmoor but that’s not quite it. This is a simplified example so it would seem to be easy to scale and then adjust certain components afterwards. In an actual production-level component, there may be 10 or 20 sub components that would need to be adjusted and it is just not feasible to adjust things manually or in 2 steps.

The sub components (in this simplified example, the grey square) would have to “understand” where they need to be after the stretch programmatically. I think this needs a Ruby solution.

You can set the position parameters of the subcomponents to calculate their values based on the dimensions of the main/parent component

Right, and that is how my components work currently. The problem is being able to make the scale handles register something other than the bounding box.

Consider something like this…

  • component selected
  • scale tool activated
  • all subcomponents that are to be positioned outside the desired dimension are hidden, set to a zero dimension, or moved to the center of the component
  • NOW you will get handles at the desired length/dimension we want to adjust by grabbing it
  • adjust the component with the scale handles
  • deactivate the scale tool
  • NOW the subcomponents can unhide, re-position, etc. some of them ending up outside the “during adjustment” bounding box.

Does that make sense?

Hello Hank,

Did you find anything about it? I want to move objects by the grip points i created myself.

Thank you.

In which case you would have to create a custom Ruby tools that knows how to deal with your custom grip points.

1 Like

Hi Tom, anywhere you’s suggest on how to get started with a custom Tool. Very basic, just that grips aren’t on the bounding box but a little unsure how to start.

There are Examples in the EW.
One named “Example Scripts” the other named “Utilities Tools”. Both by the SketchUp Team.

There is also an example in the SketchUp GitHub Examples repository …

Thanks Dan.

1 Like