Exemplo n.º 1
0
 public void cmdStartPB_Click(System.Object sender, System.EventArgs e)
 {
     boolstatus = pb.Start(0, 160, "Status");
     while (!(Position == 160))
     {
         Position = Position + 10;
         lRet     = pb.UpdateProgress(Position);
     }
     Position = 0;
 }
Exemplo n.º 2
0
        //Recursive method for exporting each link (and writing it to the URDF)
        private void ExportFiles(Link link, URDFPackage package, int count, bool exportSTL = true)
        {
            progressBar.UpdateProgress(count);
            progressBar.UpdateTitle("Exporting mesh: " + link.Name);
            logger.Info("Exporting link: " + link.Name);
            // Iterate through each child and export its files
            logger.Info("Link " + link.Name + " has " + link.Children.Count + " children");
            foreach (Link child in link.Children)
            {
                count += 1;
                if (!child.isFixedFrame)
                {
                    ExportFiles(child, package, count, exportSTL);
                }
            }

            // Copy the texture file (if it was specified) to the textures directory
            if (!link.isFixedFrame && !String.IsNullOrWhiteSpace(link.Visual.Material.Texture.wFilename))
            {
                if (File.Exists(link.Visual.Material.Texture.wFilename))
                {
                    link.Visual.Material.Texture.Filename =

                        package.TexturesDirectory + Path.GetFileName(link.Visual.Material.Texture.wFilename);
                    string textureSavePath =
                        package.WindowsTexturesDirectory + Path.GetFileName(link.Visual.Material.Texture.wFilename);
                    File.Copy(link.Visual.Material.Texture.wFilename, textureSavePath, true);
                }
            }

            // Create the mesh filenames. SolidWorks likes to use / but that will get messy in filenames so use _ instead
            string linkName            = link.Name.Replace('/', '_');
            string meshFilename        = package.MeshesDirectory + linkName + ".STL";
            string windowsMeshFileName = package.WindowsMeshesDirectory + linkName + ".STL";

            // Export STL
            if (exportSTL)
            {
                SaveSTL(link, windowsMeshFileName);
            }

            link.Visual.Geometry.Mesh.Filename    = meshFilename;
            link.Collision.Geometry.Mesh.Filename = meshFilename;
        }
Exemplo n.º 3
0
        //Recursive method for exporting each link (and writing it to the URDF)
        public string exportFiles(link Link, URDFPackage package, int count)
        {
            progressBar.UpdateProgress(count);
            progressBar.UpdateTitle("Exporting mesh: " + Link.name);
            // Iterate through each child and export its files
            foreach (link child in Link.Children)
            {
                count += 1;
                if (!child.isFixedFrame)
                {
                    string filename = exportFiles(child, package, count);
                    child.Visual.Geometry.Mesh.filename    = filename;
                    child.Collision.Geometry.Mesh.filename = filename;
                }
            }

            // Copy the texture file (if it was specified) to the textures directory
            if (!Link.isFixedFrame && Link.Visual.Material.Texture.wFilename != "")
            {
                if (System.IO.File.Exists(Link.Visual.Material.Texture.wFilename))
                {
                    Link.Visual.Material.Texture.filename =
                        package.TexturesDirectory + Path.GetFileName(Link.Visual.Material.Texture.wFilename);
                    string textureSavePath =
                        package.WindowsTexturesDirectory + Path.GetFileName(Link.Visual.Material.Texture.wFilename);
                    System.IO.File.Copy(Link.Visual.Material.Texture.wFilename, textureSavePath, true);
                }
            }

            // Create the mesh filenames. SolidWorks likes to use / but that will get messy in filenames so use _ instead
            string linkName            = Link.name.Replace('/', '_');
            string meshFileName        = package.MeshesDirectory + linkName + ".STL";
            string windowsMeshFileName = package.WindowsMeshesDirectory + linkName + ".STL";

            // Export STL
            saveSTL(Link, windowsMeshFileName);

            return(meshFileName);
        }