Cut and Paste-in-place from within Component Instances
-
This project I am working on is becoming more challenging every day.
The challenge. I have several instances of a component spaced and aligned along, you guessed it. a couple of Sine Wave paths. This "parent" component consists of several sub-components and groups. Alot of effort was spent placing other miscellaneious geometry in model around to each instance of the parent component.
Today the designer told me that one of the sub-components has been radically redesigned into 3 options. Because of this it can no longer be contained within the parent component; each instance needs to be cut out and placed outside of the parent component in it's same place relative to the model origin.
Is there a script that can accomplish a "Cut-and-Place" geometry from an instance of a component and then paste-in-place outside of all of the instances?
-
John, if you select the component you want to cut out, then ctrl-x it onto the clipboard before closing the main grouo/component. Then go edit-> paste in place. The component should go outside the overall group. this the sorta thing your looking for? or do you want ti to work on multiple components at the same time?
-
No, Remus, that doesn't work. If you cut out of a subcomponent it surely cuts all instances out but when you paste in place, only the one you worked on will be placed back. There should be a command to "Paste all (instances) in place" for this - or a ruby might help with this really.
Unfortunately you cannot Ctrl+seletc multiple instances of the same component in different parent components in the Outliner either since it would mean that you are within the context (editing) of more than one component at the same time.
John, could you, for instance, use the selection memory ruby for this? I haven't used it yet but I read about it that it can re-select things within already closed groups / components as well and cutting them out this way could eventually let you paste them in place. (Just wondering and thinking - I'm not sure about this.)
-
G:
No, I haven't tried the select memory.In one model I had to convert the parent components to a groups, then go into each group and cut and paste in place, etc.
I suppose could have then (but I didn't think of it at the time or not did I have hour to waste) save the file to a new name. Delete the groups, save and close that file, open the old file, select all the original parent components, CTRL_C copy them, close the old file, open the new, and Paste-in-Place, and then go into the parent component and delete the duplcate geometry ..... UGLY.
-
Use Paste in Place to create the first one. Then make it a Component, and replace the old components with the new one. Finally, explode them.
Selecting and replacing Component Instances can be done by right-clicking in the Component Browser.
-
That also, Jim (I like this "post review" thing )
Bu I got it in a different way. Do this (make a backup first )
- Make two layers: one for the component you want to cut out and one for the rest of teh parts (components/groups) within the model.
- Move the certain components on their respective layers
- Turn on the layer with the component you want to cut out but turn the rest off.
- explode the parent component (yes, explode)
- now select all the instances of the component and cut them out.
- now undo until everything is restored (the cut/copy command cannot be undone!) to the point you have the original parent component still containing the one you want to cut out
- edit this component by simply deleting the one you want outside
- exit its context and now paste in place
I have tried with two sets of components (on top of it one was scaled already) and everything worked like charm.
This tutorial of Coen gave the idea (not a stupid guy we have to admit...)
-
G:
I'll give this a try in a bit. I think I may have problems, however, due to the way I use layers, for example I have layers for certain elements for each entity, group, etc., such as a layer for construction points-center lines and hidden edges/surfaces. Most all my groups and components contain geometry assigned to those layers.
-
Another way is to make 2 of them unique, so that you get 2 new components, then edit these new the way you have to, then use a component definition transfer ruby (applyto.rb) to sample first new comp. apply it to all the instances you want and do the same with the 2nd new comp..
Once u download the ruby script, it is Right click on a comp. >component definitions>get def. / apply def.
http://www.smustard.com/script/ApplyTo
btw: thanks rick for this invaluable script
this suggestion by jim:
@unknownuser said:Selecting and replacing Component Instances can be done by right-clicking in the Component Browser
does essentially the same, but the script by rick allows for direct clicking on components in the scene, and not having to look for the right component in the component browser -
@jclements said:
G:
I'll give this a try in a bit. I think I may have problems, however, due to the way I use layers, for example I have layers for certain elements for each entity, group, etc., such as a layer for construction points-center lines and hidden edges/surfaces. Most all my groups and components contain geometry assigned to those layers.
Give a damn to your current layers - you are going to undo everything at the end (including creating new layers AND assigning everything onto these layers).
Think of the UNDOcommand, John!
-
Yes, father, I will experiment with your suggestion... but give a while to do so.
-
I may be missing something, but can't you insert the subcomponent in the main model space directly where the instance exists within the parent component? Then, go into the parent and delete the instance after you've used it for reference positioning.
-
Yes Rick but his problem is that he already has several of these subcomponents and cutting / pasting in place will cut all instances but paste only the one you actually clicked on.
-
If everything is components, I think a ruby could work. If there's a combination of groups/components in the tree, then it gets very VERY messy.
-
the most elegant way is
to save as (export to ext. file)those blocks, simultaneosly edit them in separated files
and finally re-assemle (paste in place) back new definition in addition with edited one.
it's harder to explain than to proceed -
Okay, I think I have a (non-ruby) solution:
- Rename the parent component to something like "parentcomponent-old"
- Go into one of the parent components, then select all, then unselect the subcomponent that was redesigned.
- Make the selected objects into a new component with the original parent component name
- Exit the parent component, then right-click on it and "Select all instances"
- Explode them all! You'll have parent components and un-nested subcomponents, everything in its proper place.
-
Rick it sure would be worth investigating. The use of components has been emphasized and encouraged as the way to go when modeling, but this issue now causes me to think twice before setting up an assembly of components. Anything that could be done to make this a more efficient process would be appreciated.
Regards, John
-
RV:
I think you've got a good procedure.
1- Select the 'original' component
2- Right-Click, choose "Save As" from the Context Menu and name it 'version 2'
3- Save current model and open version 2.skp
4- Select all geometry that needs to remain in 'original' component. Make that selection a component and call it "Original". Select the remaining geometry and make it a a different component with a unique name (lets call it 'PasteMeInPlace') and then edit it and group all the geometry within it. Save the version2.skp file.
5- Open the first model. Right-click on the component named 'original' and choose Reload from the Context Menu and reload with version 2.skp. Pick Smustard's "Select All Instances" from the Context Menu and then EXPLODE that set of instances.
6- What remains should be a new version of 'original' and the other geometry which is the component 'PasteMeInPlace'. Select it. Right-click and use Smustard's "Select All Instances" again. You can then EXPLODE all those instances if you want. .....Optionally, you could edit 'PasteMeInPlace' first and ungroup the contents before exploding all of it's instances.
-
Rick, looks like you just beat me to the punch. Thanks anyway. and to RV.
-
I think the advantage to my method (though it's substantially similar) is that you don't have to save an external file - everything is in the original model. The "save as..." and reloading seem to be extra steps that could be avoided.
-
Try this script which Sdmitch created.
Edit a "top level" instance, make a selection (can be a group, a component, loose geometry or any combination of them), then run the script from the Edit menu > item "Cut selection within Comp Instance and Paste in Place from all Instances" (it is a long description, change if it if you want one less lengthy). You will be given an option to place the objects to be pasted onto a specific layer.
I tested it in SU2014 and SU2014.
Advertisement