I have created a MeshBox Using its 8 Vertices. That I have in specific order.
But When I try to access the VertexTopology again in another component. it shows a different order of Points than the one I set it with.
Here is the Code
{
Plane mPlane = new Plane(basePlane, Plane.WorldXY.XAxis, Plane.WorldXY.YAxis);
ICModule myModule = new ICModule(mPlane, width, depth, height);
Mesh iModule = myModule.CreateBaseModule();
A = iModule;
// B = mPlane2;
}
// <Custom additional code>
public class ICModule
{
public Plane BasePlane = Plane.WorldXY;
public double Width = 1.0;
public double Depth = 1.0;
public double Height = 1.0;
//Create default constructor method/function
public ICModule(double width, double depth, double height)
{
Width = width;
Depth = depth;
Height = height;
}
//Create method/function overload to be used in different situation
//We can create more functions to make modules using the assigned variables with different inputs
public ICModule(Plane basePlane, double width, double depth, double height)
{
BasePlane = basePlane;
Width = width;
Depth = depth;
Height = height;
}
public Mesh CreateBaseModule()
{
//Generate the Mesh Vertices
List<Point3d> meshVertices = new List<Point3d>();
{
meshVertices.Add(BasePlane.Origin);
meshVertices.Add(BasePlane.Origin + BasePlane.XAxis * Width);
meshVertices.Add(BasePlane.Origin + BasePlane.XAxis * Width + BasePlane.YAxis * Depth);
meshVertices.Add(BasePlane.Origin + BasePlane.YAxis * Depth);
meshVertices.Add(BasePlane.Origin + BasePlane.ZAxis * Height);
meshVertices.Add(BasePlane.Origin + BasePlane.XAxis * Width + BasePlane.ZAxis * Height);
meshVertices.Add(BasePlane.Origin + BasePlane.XAxis * Width + BasePlane.YAxis * Depth + BasePlane.ZAxis * Height);
meshVertices.Add(BasePlane.Origin + BasePlane.YAxis * Depth + BasePlane.ZAxis * Height);
}
Mesh outModule = Mesh.CreateFromBox(meshVertices, 1, 1, 1);
return outModule;
}
}
// </Custom additional code>
}
Here in the image you can see the vertex topology on right(Expectation) on left( actual)
Any Idea how to fix it.
Attached is the Script.MeshTopologyExercise.gh (5.9 KB)
MeshTopologyExercise.3dm (36.7 KB)
