Trimming group


I have got:
and I would like to trim one of them using:
But, Group_2 is a part of Group_3.
Is there possible to trim Group 2 without explode Group_3?


If Group_1 and _2 are in Group_3, then Edit Group_3 - double-click it or select it and use context or Edit menu item.
Now do the trim operation on Group_1 & _2

If Group_2 is in a different context from Group_1…
Edit its context, select Group_2 and use Edit > Copy [or Cut to move it in the next step…]
Now exit the Edit and back in the Group_1 context use Edit > Paste-in-Place
You now do the trim on Group_1 and Group_2_copy - the result is in the Group_1 context.
If you want the end result to be in the Group_2’s context use these steps…

Select Group_1 and either use Edit > Copy [or Cut] as above.
Edit Group_3 and Edit > Paste-in-Paste.
Still in the Edit trim Group_1_copy and Group_2.
The result is now inside the Group_3 context.


Thanks TIG,
Buty I have to make it using Ruby. On groups I have written parameters which I wouldn’t to lose


It’s the same thing really…
Instead of Edit > … etc [unfortunately the Paste-in-Place is not a send_action ! ] you do something like this…
Assuming you gave a reference to a group and you want to duplicate it in another context…

# you might need to use * on that transformation... 
# to adjust it for the the_other_context's transformation, perhaps 'inverse'... 
# play around and see what's needed...
dup=the_other_context.add_instance(defn, tr)
# process all of the attributes associated with 'group'
# and add them to 'dup'...
# now 'trim' as desired
# if desired group.erase! - so it's moved not copied...


are you sure?

this works on a mac…

Sketchup.send_action('pasteInPlace:')  ## Paste In Place 



Not available on PC !?

Sketchup.send_action( 21939 )


So it IS available on a PC and MAC using different send_actions
How daft !

So… perhaps we could use a send_action to copy [or cut] the selected group, change the entities-context and use a send_action to paste-in-place [varying the argument depending on the OS…]

But hang on ! :roll_eyes:
Using the API you can only change the entities-context ‘upwards’, towards the model context.
So any entities-context change that would want to go in the other direction [for example into another group] is completely barred - unless you use the other approach of add_instance()…

If there were methods to change the entities-context, then the paste-in-place send_action would actually be useful !!


… and, send_actions are usually asynchronous and the Ruby doesn’t wait until the “action” is done, it often processes the next statement immediately, which can cause unpredictable results.

General “rule of thumb” is that send actions were meant for “macro buttons” used by the end user, not really for complex coding.


I agree - as devised current ‘send_actions’ have a limited use.


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