Script Draw in a Dynamic Component

Is it possible to delete and redraw a cube by a script (which is inside a dynamic component) when there is a modification of the dynamic component. If so, give me a hint, how to do it?

 model = Sketchup.active_model
 defs    = model.definitions
 ents    = model.active_entities

you need to use either ents.each or defs.each to find the item you wish to modify…

john

Which element triggers the execution of the script that redraws the cube,
A script or the dynamic component itself?

you offer far too little information to reply in any detail…

for example:

is the cube or the script inside the DC. it’s not obvious which you refer to.

I was assuming you have a cube that you want to change with a script…

it’s alway better to add a .skp and any code you have tried…

john

My main problem is that I have built a dynamic component whose height, width and thickness I can modify. But the textures are distorted when the size is changed. So I thought the solution of a script that (draws / redraws) the textured cube that is inside the dynamy component. Is it easily achievable?

How to prevent texture from scaling

is at topic discussed on
http://sketchucation.com/forums/viewtopic.php?f=289&t=66642\51

Mettre la définition à l’échelle
L’élément de menu Mettre la définition à l’échelle applique toute opération de mise à l’échelle effectuée
sur le composant actuellement sélectionné à la définition du composant dans le navigateur de
composants.

Scale the definition
The “Scale To Definition” menu item applies any scaling operations performed
on the currently selected component at the component definition in the
components.

The contextual menu “Scale the definition” do what i need on a component (correction of textures stretching), but how can i do this in a ruby script?
Someone know how?

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