How to Create Custom DC Function?

Hi all,

Several year ago a do a function that was call inside DC like ( animate, …).
After hours to explorer past project, search on the web. I do not find any information about that.

In my mind, I have to put my function inside a class (DC…) and puts the file inside a specific folder, but im not sure.

If someone can give me even the correct word to find something on the internet.


Does the DC already have a onClick function that has an animation value ?

Please verify that what you want is to cause a click action, for a given DC instance in the model, via a Ruby method call.

Thanks DanRathbun. Sorry again to not be clear due to my poor level of english. Let me clarify:

I’m looking to create my own DC function. like “myPersonnelFunction” on the image below. This function will be call each time the DC is compute.

Oh I understand now. We had a recent discussion somewhere about this (adding functions) and how the DC extension classes are not setup to do this easily and safely.

Unfortunately, creating your own function would modify the global DCFunctionsV1 class. This class is part of the proprietary and closed source Dynamic Components extension. Modifying Ruby Base classes or SketchUp API classes is not allowed.

So I do not feel comfortable publicly posting modifications to the DC extension or it’s classes. (And I may not be allowed to per the Trimble API agreement.)

If your extension were to modify the DC extension it would not be accepted into the Extension Warehouse.

If you published component files that used non-native dynamic functions, these files could be rejected by the 3D Warehouse.

If you are doing it for your own “in house” use, that might be okay, but it also could release Trimble from any warranty regarding the use of the Dynamic Components extension.

There are some old posts at SketchUcation where others have posted hacks to add custom functions.

So at this time you need to decide your course based upon your end goals.

(1) Is your desired custom function something that could benefit everyone ?

(2) Perhaps there is another way to get the functionality your extension needs in another way?


Thanks Dan !

I’m coding only “in house extension”, ( I’ve got only one or two extension in the warehouse extension)
According to your message , I ve been able to find my previous code !

Thanks again!

hi. i am a skp user for many years. i work on a furnishing company and made for them a large library of dynamic components. recently i asked for myself: how can i protect my dynamic components if skp does not give me such features? i digged on the web and came to the option that i could use some custom operators and functions in my dynamic components that are defined by a third party plugin or extension, and which will be understood by skp only if that plugin is loaded (after entered my company user name and password). so my question is: is it even possible to make a plugin that will add custom funtions and operators readable by standard dynamic components plugin from sketchup ? for example instead using IF or CHOOSE or ROUND i would use any other combination of characters defined in my custom plugin. i need to know if it worth to dig more into it or simply leave it as is… thanks.

I myself am of the opinion that this is NOT a good thing to do.
You would be modifying a Trimble proprietary extension which is closed source.

Also, your components would create errors for users who do not have the plugin or password.

Please do not highjack old topics that are already solved. Although your question is related to DC Functions it really is not about creation of functions. It is about misuse of functions for Intellectual Property Protection.

You should have created a new linked topic through the [Share] button at the bottom of the topic.