How can I Modify or transfer edges component Ids

How can I Modify or transfer edges component Ids

Anonymous
Not applicable
1,010 Views
3 Replies
Message 1 of 4

How can I Modify or transfer edges component Ids

Anonymous
Not applicable

Hi~ I need some help.

I want to modify or transfer edges component IDs.

I export a object to a obj file. and then,  import the obj file. but edges component IDs of the object is changed. 

I saw about that transfer vertex order. but I have no idea about edges.
moreover. I can't find to edit edges component IDs.
I need a way of in Maya or python.

1,011 Views
3 Replies
Replies (3)
Message 2 of 4

jmreinhart
Advisor
Advisor

Unfortunately there's no easy to use tool like there is for vertex order. If you have a mesh whose edge IDs you need it to match you can blendShape that one to match the shape of your new mesh. So you'll have mesh with the new shape but old edge Ids.

Message 3 of 4

Anonymous
Not applicable

My tasks are used with creaseSet. so I want to keep edge component IDs.  Is there any way?

0 Likes
Message 4 of 4

jmreinhart
Advisor
Advisor

The only way that I can think of, is to use the MFnMesh class in the maya API.

create (int numVertices, int numPolygons, const MPointArray &vertexArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner=MObject::kNullObj, MStatus *ReturnStatus=NULL)

If you can query the polygonConnects info from the mesh with the correct edge order and then use it to build the mesh that should work

jonahrnhrt_0-1592729423217.png

If you don't have experience with the Maya API, then this probably isn't a feasible solution, and I don't know how well it would work for a complex mesh.

# using Python API 2.0 for Maya
import maya.api.OpenMaya as om

meshFn = om.MFnMesh()

# list of vertex points
vertexPoints = [
    om2.MPoint(0,0,0),
    om2.MPoint(1,0,0),
    om2.MPoint(1,0,1),
    om2.MPoint(0,0,1),
    ]
    
# list of number of vertices per polygon
polygonFaces = [4]

# list of vertex indices that make the 
# the polygons in our mesh
polygonConnects = [0,1,2,3]

# create the mesh
meshFn.create(vertices, polygonFaces, [0,1,2,3] )
meshFn.create(vertices, polygonFaces, [1,2,3,0] )

 

The edge Id's are loosely tied to the face IDs, so you can't give the edge IDs any arbitrary order. 

0 Likes