Selection of Dynamic component using ruby
-
**I need to know how to select the existing dynamic component using ruby.
Is it same as selection of component?
Thanks!**
-
Can you be more specific?
Yes, selecting a DC is the same as a normal component, because a DC is a component with some attributes.
But what do you mean by "select the existing dynamic component"?
-
I just meant that dynamic components have been created in sketchup itself but not with ruby script.
Can you write the script to select a single DC?
Thanks for your help!
-
An instance of a DC is an entity like most other things in the API.
Once you get a reference to it you can use that to do things to i; or you could clear the current model.selection and add the DC_instance to it using the reference you have got earlier.
How you you expect to 'find' the DC to 'select' it ? -
If you are trying to figure out how to determine if a component is dynamic or not, then like Thom suggested - it is just a regular component with special libraries attached to it. So you would iterate through all the component definitions in the model and find the ones that have the dynamic component attribute library. Then you would select all of their instances, or you would need some other criteria to determine which single instance you want.
Do you know how you are planning on singling out the specific instance you want to select?
Advertisement