Scripting Dynamic Components

I haven’t done a lot with dynamic components but I’ve recently been thinking it would be nice to have a dynamic component with certain parameters or variables that one could signal from within a plugin.

I guess my question is, is there a way to script a dynamic component or interact with one. For instance I have a specific component that I would like to control the height dimension (ie. push-pull). Could I pass it a length and it then automatically adjust?

1 Like

Generally, yes. DCs are really just normal components that have a particular attribute dictionary with a certain name ("dynamic_attributes".)

But, the DC classes are not documented and actually make up a proprietary Trimble owned extension distributed along with SketchUp. So, in a way it’s a “native extension”.
So you’d need to use Ruby introspection to examine these classes.

Being that it’s an unpublished thing, their implementation could change at anytime. (It could be translated into C. It could be deprecated and replaced with something different.)

Yes, but I think it scales… ie, does not do pushpull.

We’ve covered this many times. It might be here, in the parent cat, or in the DC category.

a. You’ll basically need a very good understanding of building DCs manually. Ie, the functions and variables.
Use the Dynamic Components User’s Guide

… and b. an attribute editor / inspector to understand and watch what happens “under the hood”. (Several available in the EWH.)
Ie, what you see in the GUI re an attribute, is really a set of attributes (many of them hidden.)

c. know that for components, default values of DC attributes are attached to a component definition and those that have changed are attached to the component instance, …

d. for nested groups the DC attributes are always attached to the group instance. (You use groups inside DCs when you do not want to clutter the Component browser “In Model” listing.)

2 Likes

Looks like I need to do a little homework on dynamic components.

Yea, the advanced Search form will help here.

I’ve responded to a lot with regard to coding and attributes, so if you add "@DanRathbun" to any search terms you’ll see only my posts.

Example search on attributes of the DC category:
"#sketchup:dynamic-components @DanRathbun attributes"

1 Like
1 Like

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