RobotStudio event

Develops new 3D importer with SDK 6.0

Hello,<div>I want to make a new RS add-in that can import a PLY file format.</div><div>I have an external dll that can import this file format, but I don't know how to represents this ( vertices, faces, normals, material, ecc) with SDK internal geometry.</div><div><span style="font-size: 10pt;">There are some internal tutorial that show this?</span><span style="font-size: 10pt;">   </span></div>

Comments

  • <p>Hi, here is some sample code that creates a Part with a mesh consisting of a single flat Surface:</p>

    Part BuildPart()
    {
    // Create a face
    var meshFace = new MeshFace();
    meshFace.Material = new Material(System.Drawing.Color.Azure);
    // Add vertices and normals
    meshFace.Vertices.Add(new Vector3(0, 0, 0));
    meshFace.Vertices.Add(new Vector3(1, 0, 0));
    meshFace.Vertices.Add(new Vector3(0, 1, 0));
    meshFace.Vertices.Add(new Vector3(1, 1, 0));
    meshFace.Normals.Add(new Vector3(0, 0, 1));
    meshFace.Normals.Add(new Vector3(0, 0, 1));
    meshFace.Normals.Add(new Vector3(0, 0, 1));
    meshFace.Normals.Add(new Vector3(0, 0, 1));
    // Add triangles
    meshFace.TriangleIndices.AddRange(new int[] { 0, 1, 2, 2, 1, 3 });
    // Add wireframe
    meshFace.WireIndices.AddRange(new int[] { 1, 0, 2, -1, 0, 3, 2, 1 });

    // Add the face to a body
    var meshBody = new MeshBody();
    meshBody.Faces.Add(meshFace);
    // Add the body to a part
    var meshPart = new MeshPart();
    meshPart.Bodies.Add(meshBody);

    // Assign the part
    Part part = new Part(false);
    part.Mesh[DetailLevels.Medium] = meshPart;

    // Call Rebuild() to commit the data to the graphics system
    part.Mesh.Rebuild();
    return part;
    }
    Johannes Weiman
    Software Engineer
    RobotStudio Team, ABB Robotics
  • Thank you very match.<div><br></div><div>Just another questions..</div><div><br></div><div>Where I can enable or disable material culling?</div><div><br></div><div><br></div>
  • If you mean backface culling, it is enabled by default and you can disable it by setting a flag on each MeshFace:
    meshFace.Flags = MeshFlags.DisableBackFaceCull
    Johannes Weiman
    Software Engineer
    RobotStudio Team, ABB Robotics