Hi,
I have STL/PLY/OBJ file and there coordinates for this existing file,
I need to change color/add text for particular coordinates.
Is this possible in Apsope 3D .Net ?
Below code draft not sure what I am doing right or not…
Am very new to this 3D Apsose, Could you please help me on this.
Scene scene = new Scene();
scene.Open(@“Input.STL”, FileFormat.STLBinary);
DirectoryInfo d = new DirectoryInfo(@“coordinatesfiles”);
List controlPoints = new List();
using (var reader = new StreamReader(file.OpenRead())) // $"{d.FullName}/{file.Name}.csv"))
{
int i = 0;
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
if (i != 0)
{
var values = line.Split(’,’);
controlPoints.Add(new Vector4(Convert.ToDouble(values[0]), Convert.ToDouble(values[1]), Convert.ToDouble(values[2])));
uvsId.Add(Convert.ToInt32(values[9]));
}
i++;
}
}
Mesh mesh = new Mesh();
List colors = new List { new Vector3(Color.AliceBlue), new Vector3(Color.Red), new Vector3(Color.Green) };
foreach (Vector3 color in colors)
{
LambertMaterial mat = new LambertMaterial { EmissiveColor = color, DiffuseColor = color, AmbientColor = color };
Node cube = new Node("cube")
{
Entity = mesh,
Material = mat
};
cube.Transform.Translation = color;
scene.RootNode.ChildNodes.Add(cube);
scene.RootNode.Entity = mesh;
scene.RootNode.Material = mat;
}
mesh.ControlPoints.AddRange(controlPoints);