Edges: Remove any Material assigned to an edge?
-
Looking for a quick way to remove materials assigned to edges in a model.
Is there a script that does this?If not, then would someone be willing to create one that could to the following:
-
If loose geometry is preselected then the script would remove the materials from visible edges.
-
If groups/components are preselected, then the script would recursively remove the material from all visible edges contained within the groups/components. The script would be context sensitive.
-
The script would not execute unless there was preselected geometry.
-
-
Try putting this RB file into your Plugins folder.
Restart SketchUp.
To run it, type in the Ruby Console:
TIG::DefaultEdges.now
If it does what you want, then I can add a menu item, and RBZ etc...
I haven't tested it extensively.......
-
That was quick. Your help much appreciated.
Results were kind of hard to predict.
Among other things, it has problem affecting all edges inside of a group or subgroups.Attached is my test file.
Also noticed that when doing a Ctrl+Z (undo) that each segment of a circle had its material undone, one-at-a-time. If the code cycled through a sequence of a Select-All function, followed by a Deselect-Face, and then apply the Default Material ... would that be more efficient?
Could the script be located in the EDIT menu and be display as "Edge Remove Material"?
-
You could edit the style and set edges to all the same.
Edit:reading your post again I guess you don't want all edges to change. -
It was very basic - no undo etc, no menu...
Give me a few minutes and I'll post an updated / improved version... -
Here's a 'better' version...
Please put the attached RB file into your Plugins folder and restart SketchUp.
Please remove the earlier RB which is now redundant.The main changes are:
File is renamed and etc added to header.
The tool is renamed "Remove Edge Material"
It can now be run from an item of that name in the Edit menu [or run from the Ruby Console...]
If there's preselected geometry including edges, or groups/component-instances, it processes the selection and as it completes it reports how many edges have had their material removed.
If there is no suitable preselection an error message tells you and it aborts.
The removal is one step undo-able.If it's doing what you want, then I can look at making it into an extension and packaging it in an RBZ etc...
EDIT: RB file updated to fix typos !
-
I tested with SU2018.
It works as you mentioned in the above posting when a selected object is not in a group, but not recursively for any of selected groups or "subgroups" (all groups within selected group)
If you do a Select All and then run the script you'll see what I mean.
-
Finally I see what's up !
I've corrected two stupid typos in my code and I now think it works OK.
I've swapped a working version of the RB in the recent post, please re-download/install and test... -
Thanks, TIG!
I also did a test of View > Hidden geometry with a Push-Pull circle. When turned ON, the smoothed edges were processed. When turned OFF, the smoothed edges maintained their existing material/color.
P.S.
Missed you at the BaseCamp 2018. It was quite good. -
The reason a surface's smoothed edges aren't process is because when you make a selection with View > Hidden Geometry > OFF they aren't in that selection.
And the tool processes a selection.
However, if it's View > Hidden Geometry > ON, then they'll get selected and will be processed.So the correct usage is, if you want to process hidden/smoothed edges, first use View > Hidden Geometry > ON, then those edges can be in the selection selected.
PS: I was all geared up to go to Basecamp and Trimble had offered to pay for the flights and accommodation etc [as I'm a 'Sage'], however, the plan was also for my wife to go with me, but sadly she was unwell in the preceding weeks, so I had to cancel.
Maybe the next one... -
@tig said:
So the correct usage is, if you want to process hidden/smoothed edges, first use View > Hidden Geometry > ON, then those edges can be in the selection selected.
...That is exactly what I was hoping for.
Hope hope your wife is feeling better.
-
It would be possible to remove material from un-preselected 'hidden' edges [it already does that to any hidden edges inside preselected 'containers']
It first needs to assemble a list of all faces associated with the preselected edges, then it has to look at those edges and if any are hidden/smoothed etc and they have a material it is also removed - such hidden edges could be reported separately ?
So do you want it to do this ?
Do you want it to be optional - i.e. a Y/N dialog asks if any hidden edges might be processed ?
It could ask this in select geometry AND select containers...
I'll prepare a version for this... -
Sure, a Yes/No would be fine. I hadn't considered that there would be away to do that.
-
Try this attached version.
If your selected edges support faces which have some non-preselected hidden/smoothed edges, OR the preselected surface[s] have hidden/smoothed edges, which also have materials, then you are prompted to process them.
The closing Report dialog also lists how many of the processed edges were 'hidden/smoothed and non-preselected'...
-
Nice job.
Seems to work well.
Thanks, again.
-
Can you put a little image for show what is a "material assigned to an edge" ?
-
Palou:
Download and install TIG's latest .rb file.Open the attached skp file
View Scene 1 which has View Hidden Edges turned OFF and then Scene 2 which has View Hidden Geometry turned ON and notice that smoothed edges of the cylinder are colored red.
While on Scene 1, select all the geometry, go the the Edit menu, TIG's plugin should be listed near the bottom of the menu, click on it and follow the instructions (Choose Yes to process hidden edges).
Now go to Scene 2, and notice that the smoothed edges which were not visible in Scene 1 have been recolored to the Default edge color as well as all the other edges.
-
Thx very educative!
-
How often does everyone experience this problem where edges have materials applied?
-
I've noticed, mostly from models from the 3D warehouse or from folks new to SU, that there seems to have been unintended edge-coloring. Normally, I wouldn't have noticed, except when doing more "artzy" modeling or when emphasizing functional elements in the model such as process equipment and I turn on Edge Style > Color by Material.
I know that I have often been in a hurry, triple-clicked surfaces or done a Select All and applied a material to edges mistakenly.
So the script is handy for reviewing a model and doing a quick cleanup.
Advertisement