Hi,
The following code returns a line geometry that doesn’t correspond to the given TopologyVertices (10, 11 in that case). Is it a bug ?
var line = myMesh.TopologyEdges.EdgeLine(myMesh.TopologyEdges.GetEdgeIndex(10, 11));
Hi,
The following code returns a line geometry that doesn’t correspond to the given TopologyVertices (10, 11 in that case). Is it a bug ?
var line = myMesh.TopologyEdges.EdgeLine(myMesh.TopologyEdges.GetEdgeIndex(10, 11));
I doubt it. But you have not provided enough information for us to be able diagnose your problem. Can you provide more information, perhaps the geometry and any additional sample code that will allow us to replicate what you are seeing?
hi dale,
here is rhino file enclosed with GH C# code.
I first display Topology.Vertices and Topology.Edges
public static Mesh myMesh;
public override void DrawViewportWires(IGH_PreviewArgs args)
{
//display TopologyVertices
for (int i = 0; i < myMesh.TopologyVertices.Count; i++)
{
var p = new Point3d(myMesh.TopologyVertices[i].X, myMesh.TopologyVertices[i].Y, myMesh.TopologyVertices[i].Z);
args.Display.DrawDot(p, Convert.ToString(myMesh.TopologyVertices.TopologyVertexIndex(i)));
}
// for (int i = 0; i < myMesh.TopologyVertices.Count; i++)
// {
// var p = new Point3d(myMesh.TopologyVertices[i].X, myMesh.TopologyVertices[i].Y, myMesh.TopologyVertices[i].Z);
// args.Display.DrawDot(p, Convert.ToString(myMesh.TopologyVertices.MeshVertexIndices(i)[0]));
// }
//display TopologyEdges
for (int i = 0; i < myMesh.TopologyEdges.Count; i++)
{
var p = new Point3d(myMesh.TopologyEdges.EdgeLine(i).PointAt(0.5));
args.Display.DrawDot(p, Convert.ToString(i));
}
}
then when I check for example edgeIndex between TopologyVertices 10 and 11 it returns EdgeIndex = 19 instead of 9.
var edgeIndex = myMesh.TopologyEdges.GetEdgeIndex(10,11);
Print(Convert.ToString(edgeIndex));
var line = myMesh.TopologyEdges.EdgeLine(edgeIndex);
thanks for your help
edgeIndexIssue.gh (4.8 KB)
edgeIndexIssue.3dm (168.8 KB)
Mesh.TopologyVertices.TopologyVertexIndex
returns the topology vertex index for an existing mesh vertex in the mesh’s VertexList
. In your code, you are passing a topology vertex index, to this function, instead of a mesh vertex index.
Does this help?
yep. thx!
args.Display.DrawDot(p, Convert.ToString(myMesh.TopologyVertices.TopologyVertexIndex(myMesh.TopologyVertices.MeshVertexIndices(i)[0])))