-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract vertices data (X,Y,Z) from a *.fbx #13
Comments
Hi @pmorshed, to extract the vertices you just need to access to the Scene scene = FbxReader.Read(test, ErrorLevel.Checked);
//Iterate throgh all the nodes in the scene
foreach (Node item in scene.Nodes)
{
//Here you can apply filter if you know the name of the node
//Each node can contain geometric elements so you have to look in the elements contained in the main node
foreach (Element c in item.Children)
{
//Check if the element is a geometric type
if (!(c is Geometry geometry))
continue;
//Get the vertices of the element
List<CSMath.XYZ> vertices = geometry.Vertices;
}
} |
Hi. Thanks for the quick reply. I tried it but it didn't give any output. Have you tried it yourself? |
You are right, the problem is that the mesh is inside another node, so 2 levels public static IEnumerable<Geometry> GetAllGeometryInTheScene(string path)
{
Scene scene = FbxReader.Read(path, ErrorLevel.Checked);
List<Geometry> geometries = new List<Geometry>();
//Iterate throgh all the nodes in the scene
foreach (Node item in scene.Nodes)
{
//Here you can apply filter if you know the name of the node
geometries.AddRange(GetAllGeometryInTheNode(item));
}
return geometries;
}
public static List<Geometry> GetAllGeometryInTheNode(Node node)
{
List<Geometry> list = new List<Geometry>();
//Each node can contain geometric elements so you have to look in the elements contained in the main node
foreach (Element c in node.Children)
{
//Check if the element is a geometric type
if (c is Geometry geometry)
{
list.Add(geometry);
continue;
}
else if (c is Node n)
{
list.AddRange(GetAllGeometryInTheNode(n));
}
}
return list;
} I've tried with your document and it worked find. |
Yes, works like a charm. Thanks so much |
Hi. How can I extract vertices data (X,Y,Z list) from a *.fbx 3D model via MeshIO?
For example, suppose I have a box in the fbx file (attached) and I want to extract the coordinates of its vertices in CSV format. What should I do?
box1.zip
The text was updated successfully, but these errors were encountered: