It just depends on what you want to do and how you want to automate the 
selection (every nth edge, following a pattern, only edge loops, edge loop 
segments etc)

To select multiple edges you can use slices:
import maya.cmds as mc
start_edge, end_edge = 1, 40
helix, helix_shape = mc.polyHelix()
mc.select(helix_shape+'.e[%d:%d'] % (start_edge, end_edge), r=True)

>From what I´ve just hopefully understood about how they construct the shape 
for a helix specifically it looks like every edge loop is comprised of sets 
of edges where their indices are spaced out by n, where n is the number of 
subdivisions down the axis.  So if you wanted to select a line from a given 
starting edge:

import maya.cmds as mc
import re

selection = mc.ls(sl=True, fl=True)
# Get the shape node of the selection
shape = mc.listRelatives(selection[0], p=True)[0]
# Get the index of the selected edge
start_index = [int(re.findall(r"[\w]+", i)[2]) for i in selection][0]

# Define what we know about the helix
num_edges = 10
axis_subdivisions = 8

edges = [shape+'.e[%d]' % (start_index + (edge_index * axis_subdivisions)) 
for edge_index in range(num_edges)]
mc.select(edges, r=True)

You kind of need to know a bit about the shape you're querying and how it's 
constructed etc.  As long as you can run through the idea in your head and 
come up with a way of doing it, you can write an algorithm for it. 

However maybe someone else can think of a clever way of doing this on a 
grander scale or with custom/non default shapes, but I haven't found common 
patterns between shapes to be able to always select patterns I want 
regardless of types of shapes/construction.  I have seen some pretty neat 
scripts out there that do things like every nth edge etc so at least that 
kind of idea is well trodden if you want to go script hunting!

On Tuesday, December 5, 2017 at 5:37:49 PM UTC-5, Chrysoula Kaloumenou 
wrote:
>
> Hello there!
>
> I am fairly new to Maya, and a proper newbie to Maya scripting, so I'm 
> sorry if my question seems silly.
>
> So, I want to select a line of edges of a given object (a helix - image 
> attached, in case it helps), but I haven't found any way that I could 
> script that. According to the script editor, each edge is numbered, but 
> it's practically impossible to name every edge that I want selected.
>
> Do you think there is a way to resolve that?
>
> Thank you very much! :)
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c66cd6b8-98ad-4c62-a2cb-65b5b51fe786%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to