Getting the ID of a new edge from the AddEdgeOp


The other week I posted a KB article that showed how to run a VBScript snippet to get the ID of a new edge added by the AddEdge command. I did it that way because the new edge ID is an output argument to AddEdge, and JScript and Python don’t support output arguments.

Now, however, I found a way to get the new edge ID directly from the AddEdgeOp:

// Get the AddEdgeOp
var oOp = Dictionary.GetObject( "grid.polymsh.addedgeop[2]" );

// Now get the new Edge ID and the new Point ID
var sNewptid = GetValue(oOp + ".newptid") ;
var sNewedgeid = GetValue(oOp + ".newedgeid") ;

LogMessage( "Edge["+sNewedgeid+"] : PointID=" + sNewptid );