Selecting parallel edges

Is there any tool or plugin to select edges that are parallel to the edge(s) that was preselected?

A quick one…

Open Window>>Ruby Console
Select the desired edge(s)
Copy-and paste this code to Ruby Console and Hit Return (Enter)

def select_parallel_edges
  ents = Sketchup.active_model.active_entities
  sel = Sketchup.active_model.selection
  edges = sel.grep(Sketchup::Edge)
  return unless edges[0].is_a?(Sketchup::Edge)
  sel.clear
  sel.add edges
  edges.each{|edge|
    sel.add( ents.grep(Sketchup::Edge).find_all{
      |e| e.line[1].parallel?(edge.line[1])
    } )
  }
  sel.size
end
select_parallel_edges

UPDATE: The returned selection will contain only edges (the pre-selected & parallel)
(Animation not updated)
(Click on a picture for animation)

selpar

5 Likes

Dezmo, thank you really much! Cool and clean script, just what I needed.
What do I need if I want to turn it into a “plugin”? What I want is to be able to assign a hotkey for it and have an icon that I would design.
I know there is a plugin called Toolbar Editor that I can use to make a button for a custom script, but I never used it. I gotta try it out but don’t know if assigning a hotkey is be possible.

I’m also think about right click (context) menu “Select paralel edges” or similar, if the selection contains edge(s). But sure, there will be an icon and you will be able to assign shortcut too.
I will wrap to new extension later today… a cupule of hours or so…, and post it here. (It will be an unsigned, but you can switch on the “Unrestricted” in Extension manager to be able to install)

1 Like

Here I am! :slight_smile:

Dezmo_select_parallel_edges.rbz (3.0 KB)

There is only a context menu and icon to start.
The icon will be grayed out and the context menu will not appear if there is no edge selected.
Therefore to be able to assign shortcut, first you must select something containing an edge(s).

The result - total number of parallel edges, including the pre-selected one(s) - will shown in a measurement area. After 5 sec will be cleared out.
If you
-start an other tool within this 5 sec,
-or you use this plugin while other tool is running
that may conflict with “measurement display” of that tool…)

If you want to change the icon, after installed. Go to
c:\Users\YOUR_USER_NAME\AppData\Roaming\SketchUp\SketchUp 20XX\SketchUp\Plugins\Dezmo_select_parallel_edges\ folder
and change the spe.png

As usual it should work, but no warranties! Use your own risk!
Report here if you have issues.
Good look!

selparext

3 Likes

Wow, Dezmo, you are amazing!
I’m glad you found my request useful because I guess otherwise you wouldn’t invest time in creating an extension especially for it :smiley:
For me personally it’ll be very useful when working with window niches and small wood constructions.

Some time ago I talked to both Thom Thom and Suforyou with a suggestion for adding this feature to their plugins - respectedly: Selection Toys and S4U Select, but I think they weren’t interested in doing that. The plugin you wrote is truly complementary to their toolkits. It would be really cool to have one huge beast with all selection criteria put altogether. But I’m just sayin - that’s my little dream :stuck_out_tongue:
Anyway, thanks again for this script!

1 Like