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.

:pray:

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?

2 Likes

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!